Page MenuHomePhabricator

HTML comment next to a heading disables heading highlighting
Closed, ResolvedPublic3 Estimated Story Points

Description

If an HTML comment is on either side of a heading, the heading won't get highlighted and the size won't change.

Watch this GIF and you will understand:
https://upload.wikimedia.org/wikipedia/commons/b/be/HTML_comments_and_headings.gif

Event Timeline

There are two problems:

  1. font size can be changed only for whole line and big comments looks ugly for me.
  2. processing comments required some optimizations of tokenizer, it should be able to change type of previous tokens without processing all next tokens again.

For the first point we should choose:

  • make a heading the same size as usual text
  • make comments the same size as a heading
  • make a heading with inline comments the same size as usual text

The second point requires the same solution as for complicated templates T108450 and touches T109822

I talked this over with @kaldari and @Niharika -- I don't want to break a useful feature (size changes on the heading) just to fix an edge case.

When there's a heading with inline comments, we should make the whole line the size of a heading. That gives us occasional big comments, but if the comment is on the same line as the heading then it's probably important.

In the translation use case from the GIF, having a big <!--T:5--> next to the heading would probably help -- you'd be able to tell which translate tags are connected to headings, and which aren't. The translate feature is ugly and confusing; this would be just as ugly but maybe a little less confusing.

DannyH set the point value for this task to 3.
DannyH moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.

Change 763600 had a related patch set uploaded (by AntiCompositeNumber; author: AntiCompositeNumber):

[mediawiki/extensions/CodeMirror@master] Highlight headings with trailing comments

https://gerrit.wikimedia.org/r/763600

Took a shot at adding support for trailing comments. I didn't do leading comments because it would be more complex and I don't have a use case for it. Matching the size to the rest of the line makes sense to me.

image.png (376×443 px, 33 KB)

TheDJ assigned this task to AntiCompositeNumber.

Change 763600 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] Highlight headings with trailing comments

https://gerrit.wikimedia.org/r/763600