Page MenuHomePhabricator

Parsoid should support section editing links
Open, HighPublic


The core parser emits links to edit every section; right now we emit both 'edit' and 'edit source' links, but it (AIUI) depends on some user and wiki configuration as to how many edit links we emit, whether we emit links to visual editor, etc. But in any case, Parsoid needs to be compatible & emit these before it can replace the legacy parser for read views.

This would (likely) be a post-processing pass, as the exact links emitted is user-dependent. It would also ensure we don't clutter/invalidate parser tests every time we decide to tweak how the section edit links look or what editor they link to, like the legacy parser does.

A simple test case:

Note that transcluded sections also have direct links to edit the page on the transcluded section. On the example page these look something like:

Note that we don't currently make any guaranteees about content inside a transclusion. Properly emitting the above links would probably require us *not* to strip some Parsoid info from the transclusion and come closer to guaranteeing that the contents of a transclusion are a valid Parsoid document with its own data-mw and data-parsoid that can be interpreted to reconstruct the template tree. See T269629: Generalize rules about rendering-transparent content before sections, T260169: Parsoid API to "expand page X with parameter Y and Z", and T259824: DiscussionTools's reply tool doesn't work when the comments are transcluded from another page using a template (not directly) (where DiscussionTools has to chase down recursive transclusions to find the "true" page holding a given discussion topic/reply/etc).

See also: T270199: Table of contents in Parsoid output.

Related Objects

Event Timeline

ssastry triaged this task as Medium priority.Dec 7 2020, 11:02 PM
ssastry moved this task from Needs Triage to Missing Functionality on the Parsoid board.

This is probably Just Another Postprocessing pass. It would be great if we could refactor this to share code between core and Parsoid, so we don't have to keep updating to chase changes here. Even better would be if we could turn this postprocessiing option *off* (for both legacy and Parsoid) when running parser tests, as it is almost always "just noise" when evalutating parser test results.

It occurs to me that the legacy ID tags (with the alternate encoding) could also be added in read views, they are just stripped by VE as far as I know.

MSantos raised the priority of this task from Medium to High.Tue, Sep 19, 3:51 PM