This is a tracking task for incorrect edit section links rendered by Parsoid.
The root cause is that Parsoid uses the legacy preprocessor to expand templates, and since the legacy parser assigns heading ids in that pass, Parsoid loses information related to those id assignments. While we considered a number of different strategies to address this, for simplicity, we eventually landed on having the preprocessor bundle information and pass it back to Parsoid to ensure Parsoid assigns section ids in a manner compatible with the legacy parser.
The child tasks capture the various scenarios where this manifests, plus other edge cases related to bad markup.
Previous solution strategy (not pursued)
Previously, this task linked to a google doc that is not externally accessible, so recording a brief summary here:
- Make edit section save functionality be Parsoid-aware: If we make the edit section API be Parsoid-aware, we ensure that we don’t behave in an unexpected manner when using it even if the id assignment is different from what the core parser would have assigned. We didn't pursue this because it means that bookmarked links will be broken plus in the transition phase, gadgets and clients relying on section ids might need to deal with different section editing APIs.
- Don’t assign heading ids in the tokenizer: This is T214538. This required too many changes to the legacy parser and unsure what else we might break
- Reduce id-assignment discrepancies between legacy and Parsoid: This is a good thing but won't address the root cause.