npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

HTML headers from readme.md are incorrectly parsed on npmjs.com

What I Wanted to Do

When I’ve published my npm module with readme.md that looks great on github, the headers were parsed strange on npmjs. After some code redundancy I figured out that the line breaks are the real culprit.
The readme.md code without line breaks:

<h1>Header A</h1>
<p>some paragraph</p>
<h2 id="a">header a</h2>
<p>some paragraph</p>
<h2 id="b">header b</h2>
<p>some paragraph</p>
<h2 id="c">header c</h2>
<p>some paragraph</p>
<h2 id="d">header d</h2>
<p>some paragraph</p>
<h1>Header B</h1>
<p>some paragraph</p>

The readme.md code with line breaks:

<h1>Header A</h1>
<p>some paragraph</p>

<h2 id="a">header a</h2>
<p>some paragraph</p>

<h2 id="b">header b</h2>
<p>some paragraph</p>

<h2 id="c">header c</h2>
<p>some paragraph</p>

<h2 id="d">header d</h2>
<p>some paragraph</p>

<h1>Header B</h1>
<p>some paragraph</p>

What Happened Instead

This is how the readme.md looks like without line breaks on the left and with line breaks on the right. This is the screen of how two readme.md versions look like on npmjs. On the right screen you can see that the npmjs duplicates the last header:

Reproduction Steps

Details

I’ve also figured out that:

Platform Info

$ npm --versions
{ 'test-cde': '0.0.28',
  npm: '5.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.29.0',
  node: '8.11.2',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }
$ node -p process.platform
  win32


This happens in marky-markdown. If you can find what the parsing issue is and push a patch to that, we’ll be able to pull it into the website.