Page MenuHomePhabricator

DiscussionTools inserts colons into <syntaxhighlight> blocks when replying
Closed, DuplicatePublicBUG REPORT

Description

This might also apply to other <tags> that output block-level elements, but <syntaxhighlight> is probably most pertinent.

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

  • Reply to any discussion (so that your reply will be indented) and insert [1] or [2] as your reply.
  • Save (or just preview, it appears in preview too)

What happens?:

  • Colons are inserted at line breaks inside the syntaxhighlight block where they shouldn't be, rendering code inside the block invalid.

What should have happened instead?:

  • Colons should not be inserted within the <syntaxhighlight> tags.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Link to a permanent revision where I tested this issue: https://test.wikipedia.org/w/index.php?title=User_talk%3AJon_Harald_S%C3%B8by&oldid=563468#This_is_a_test.
(It seems to happen with the <pre> tag as well, but that one also has some other issues that seem to be parser-related and not specific to DiscussionTools.)

[1]

This is a reply to your coding question. Instead of doing what you're donig on line 123, you should do this instead:

<syntaxhighlight lang="javascript">
function foo() {
  console.log( 'This is just dummy code!' );
}
</syntaxhighlight>

Hope that helps!

[2]

Let's just be evil and do the same with <nowiki>{{#tag:}}</nowiki> syntax instead, shall we?

{{#tag:syntaxhighlight|
function foo() {
  console.log( 'This is just dummy code!' );
}
|lang=javascript}}

Edge cases FTW!