Page MenuHomePhabricator

Multiline code tag results in strange html
Closed, DuplicatePublic


Author: dan

When creating a new wiki page with the following content:

The generated html is:
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">

The empty code tags are a bit curious.

Version: 1.23.0
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:13 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz66655.
bzimport added a subscriber: Unknown Object (MLST).

The output in the description happens when Tidy is enabled. When it's disabled, this happens instead:


Note that it's also wrong, so we can't blame this bug on Tidy.

Daimona added a subscriber: Daimona.EditedMay 4 2018, 11:20 AM

This still happens with RemexHTML, see example. The generated code is slightly different, though.

ssastry added a subscriber: ssastry.May 4 2018, 1:29 PM

This has nothing to do with Tidy or Remex. This is more specific to how <code> is parsed in wikitext. This is a result of T134469: doBlockLevels() inserts <p> and </p> randomly with no regard for HTML validity

@ssastry Thanks for the hit! Anyway, the bug on itwiki was also caused by the presence of PRE tags inside CODE, which I didn't notice since they were generated with indentation.