@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.

Render object monograms and embedding references more gracefully when building a Remarkup table of contents

Summary:
Fixes T8845. Ref T13102. See PHI467. Currently, object monograms like `L1` which appear in Remarkup headers render incorrectly (with an internal placeholder "x") in the table of contents:

{F5475505}

Instead, render them down to just, e.g., `L1` in plain text.

For `{P123}` I just rendered it to `{P123}` since it's not really clear to me what users intend. This could be adjusted if there's some reasonable thing that someone is trying to do with this.

Test Plan: Wrote a Phriction document with several object references (like `L1` and `{P123}`) in headers. After patch, saw "x"-free, sensible-looking header names in the table of contents.

Maniphest Tasks: T13102, T8845

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

+15
+15
src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
··· 279 279 return $matches[0]; 280 280 } 281 281 282 + // If we're rendering a table of contents, just render the raw input. 283 + // This could perhaps be handled more gracefully but it seems unusual to 284 + // put something like "{P123}" in a header and it's not obvious what users 285 + // expect? See T8845. 286 + $engine = $this->getEngine(); 287 + if ($engine->getState('toc')) { 288 + return $matches[0]; 289 + } 290 + 282 291 return $this->markupObject(array( 283 292 'type' => 'embed', 284 293 'id' => $matches[1], ··· 289 298 290 299 public function markupObjectReference(array $matches) { 291 300 if (!$this->isFlatText($matches[0])) { 301 + return $matches[0]; 302 + } 303 + 304 + // If we're rendering a table of contents, just render the monogram. 305 + $engine = $this->getEngine(); 306 + if ($engine->getState('toc')) { 292 307 return $matches[0]; 293 308 } 294 309