Jim Rootham
Jim Rootham

Reputation: 455

Difference between Github and npm markdown

I have an Node package up on Github (https://github.com/jrootham/argument-spec) and npm (https://www.npmjs.com/package/argument-spec). There is a specification table where the first cell contains the word 'undefined'. It shows up fine on Github but is blank on npm. Anybody have any idea what is going on. I searched for docs on npm markdown but none appeared.

Upvotes: 4

Views: 1468

Answers (2)

Sam Mikes
Sam Mikes

Reputation: 10848

@Jim Rootham is right about the process npm uses to display markdown: they are filtered through marky-markdown and then displayed. It looks like you've found a bug somewhere in this process; you should open an issue on the npm website repository, https://github.com/npm/newww

Upvotes: 0

VonC
VonC

Reputation: 1328192

If npm readme html pages are generated (as in this question) with evilstreak/markdown-js, then you have some table examples, like this one:

| First Header | Second Header |
| ------------- | ------------- |
| Content 1 | Content 2 |
| Content 3 | Content 4 |

There is issue 230 discussing about the proper supoprt for table with this package, but it should be able to render most tables correctly.

In your case, see if adding delimiters change anything:

####Specification meanings

|Specification|Valid argument|
-----------|----------
|undefined|anything|
|''|string|

The PR (Pull Request 480 mentions:

This updates newww to use marky-markdown to process readme content. Highlights include:

  • Human-readable code!
  • Lots of tests
  • Explicit HTML content policy with sanitize-html
  • Server-side syntax highlighting
  • Gravatar URL cleanup
  • GitHub relative link cleanup
  • Better tagging of badge elements
  • Forward-looking CDN image support

That project in turn uses markdown-it, which has a few issues around table.

Upvotes: 1

Related Questions