Page MenuHomePhabricator

Reply tool inserts `<nowiki/>` when switching input modes
Open, Needs TriagePublic



This issue was raised in T246190#6121892.

Steps to reproduce

  1. Visit
  2. Click any "Reply" link on the page
  3. Click the Source mode (if you're not already in it)
  4. Enter the following into the text input: normal '''bold ''bold-italics''' italics'' normal
  5. Switch to the Reply tool's visual mode; observe the text appears as such: "normal bold bold-italics italics normal"
  6. Switch to the Reply tool's source mode; observe the <nowiki/> tag that is inserted: normal '''bold ''bold-italics'''''<nowiki/>'' italics'' normal

Open questions

  • Why is the <nowiki/> tag mentioned in Step 6 above being inserted?
  • What purpose does the <nowiki/> tag mentioned in Step 6 above serve?

Event Timeline

I have tested which shows
normal '''bold ''bold-italics''''' ''italics'' normal roundtrips correctly between visual and source.
That is I replaced "<nowiki/>" in "normal '''bold ''bold-italics'''''<nowiki/>'' italics'' normal" with a space: " ".
I think this is general VE or parsoid behavior, and has nothing to do with the reply tool.

@ppelberg: The nowiki tag prevents this from producing an HTML problem called "misnested tags". See The example at the top of that help page will look very familiar.

@AdHuikeshoven + @Whatamidoing-WMF: the context y'all shared is helpful...thank you.

I am moving this to the backlog for the following reasons:

  • This issue seems to be caused by a known lint error [i], as @Whatamidoing-WMF noted.
  • We have not yet received reports from people who have experienced this issue in the course of using the Reply tool in production
  • I am no longer able to reproduce this issue. See:


I’d even say close this as invalid. What happens here is:

  • We have the invalid wikitext normal '''bold ''bold-italics''' italics'' normal.
  • Both the MediaWiki parser and Parsoid manage to understand it, fortunately their results look the same. MediaWiki converts it into the HTML representation of normal <b>bold <i>bold-italics</i></b><i> italics</i> normal. Parsoid used to do the same, but it changed since and now it decides to make the space non-italic, so its HTML representation is now normal <b>bold <i>bold-italics</i></b> <i>italics</i> normal.
  • Parsoid converts the HTML back to wikitext, and produces valid result (i.e. no misnested tags). If there was no space betweeen the </b> and the <i>, a <nowiki/> tag would be needed to precisely represent the HTML. (This is the case if the space before italics is omitted in the initial wikitext.)

I think if the input is broken (misnested tags), we don’t need to care that much about broken output (<nowiki/>). User education about not to use broken wikitext would be good, but I don’t think that’s in scope of this task.