Marked: Whitespace in fenced code info string breaks rendering

Created on 1 Aug 2018  路  4Comments  路  Source: markedjs/marked

Describe the bug

When there is whitespace in the info string of a fenced code block, like so:

```html foo

...the block is not parsed as a code block. It appears to be rendered as a paragraph:

<p>```html foo</p>

To Reproduce

Steps to reproduce the behavior:

  1. Add a whitespace character in the info string of a fenced code block.
  2. Render with the default renderer.



Expected behavior

When there is whitespace in the info string, GFM appears to use the first word as the language and ignore the rest. (As demonstrated here) I would expect Marked to do the same by default and pass the entire info string to a custom renderer.

Thank you! 馃憢

L2 - annoying

Most helpful comment

All 4 comments

For reference, here is the GFM spec on info strings.

1387 returns this:

~
bin/marked
```html foo
^D

~~

which seems correct

Thanks for addressing this! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eGavr picture eGavr  路  4Comments

woodyrew picture woodyrew  路  4Comments

FireflyAndStars picture FireflyAndStars  路  3Comments

bennycode picture bennycode  路  4Comments

priyesh-diukar picture priyesh-diukar  路  3Comments