@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Diffusion - add ToC for readme files

Summary: see title. Fixes T4549.

Test Plan: made a readme that had some headers and observed a nice ToC

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: aran, epriestley, Korvin

Maniphest Tasks: T4549

Differential Revision: https://secure.phabricator.com/D8490

+14 -2
+13 -2
src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php
··· 8 8 9 9 public function getMethodDescription() { 10 10 return 11 - 'Retrieve any "readme" that can be found for a set of paths in '. 12 - 'repository.'; 11 + pht('Retrieve any "readme" that can be found for a set of paths in '. 12 + 'repository.'); 13 13 } 14 14 15 15 public function defineReturnType() { ··· 89 89 $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); 90 90 $engine->setConfig('viewer', $request->getUser()); 91 91 $readme_content = $engine->markupText($readme_content); 92 + $toc = PhutilRemarkupEngineRemarkupHeaderBlockRule::renderTableOfContents( 93 + $engine); 94 + if ($toc) { 95 + $toc = phutil_tag_div('phabricator-remarkup-toc', array( 96 + phutil_tag_div( 97 + 'phabricator-remarkup-toc-header', 98 + pht('Table of Contents')), 99 + $toc, 100 + )); 101 + $readme_content = array($toc, $readme_content); 102 + } 92 103 93 104 $class = 'phabricator-remarkup'; 94 105 }
+1
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 352 352 */ 353 353 public static function newDiffusionMarkupEngine(array $options = array()) { 354 354 return self::newMarkupEngine(array( 355 + 'header.generate-toc' => true, 355 356 )); 356 357 } 357 358