Page MenuHomePhabricator

Heading syntaxes that does not emit headings breaks "reply to section"
Closed, ResolvedPublic

Description

Steps to replicate the issue (include links if applicable):

  • In the first comment of a thread, write wikitext heading syntaxes that does not emit headings (e.g. with {{void}} or the match-and-replace codes in zh:{{比較條文}})
  • Use the "Reply to Section" feature.
  • Check the diff in source code.

What happens?: The comment is inserted before the first "fake headings", for example:

== The Thread ==
Ordinary contents.
{{void|1=
<!-- [COMMENT WRONGLY INSERTED HERE] -->
=== I am hidden! ===
Other contents that will never be seen.
}}
And the end. [[User:Example|Example]] 2026-06-11 03:21
: <!-- [COMMENT SHOULD BE HERE INSTEAD] -->

See for example zh:Special:Diff/93018910 and zh:Special:Diff/93021711.

What should have happened instead?: The comment should be placed below the whole comment.

Event Timeline

A light fix so far — templates with no nested templates are now cloaked when searching for section heading markup. Just "templates with no nested templates", as doing full parsing would be somewhat costly. And rarely sections can really be wrapped in templates. I can add logic for those cases but won't until it proves to be a real use case.

Alright, added a full-fledged template parser. Templates having nested templates are now handled as well.