Page MenuHomePhabricator

html comment at begin of page leaves newline
Open, LowPublicFeature

Description

The html comment at the begin of a page, leaves a newline and this newline can produce a paragraf.

The wikitext:

<!--comment--><newline>
<newline>
text

produce a paragraf at the top of page and is parsed the same way than

<newline>
<newline>
text

But it better to parse it like

<newline>
text

and produce no paragraf.

Thanks.


Version: unspecified
Severity: enhancement

Details

Reference
bz23698

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:00 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz23698.
bzimport added a subscriber: Unknown Object (MLST).

Looks like expected behavior to me.
I see your point, but there's probably some case where that newline shouldn't be stripped.

I have found in Preprocessor_DOM.php:

TODO: This could theoretically be done if $wsStart == 0, i.e. for comments at the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but it's a possible beneficial b/c break.

  • Bug 26645 has been marked as a duplicate of this bug. ***
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: wikibugs-l-list.