Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace in fenced code info string breaks rendering #1314

Closed
camwiegert opened this issue Aug 1, 2018 · 4 comments · Fixed by #1387
Closed

Whitespace in fenced code info string breaks rendering #1314

camwiegert opened this issue Aug 1, 2018 · 4 comments · Fixed by #1387
Labels
L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@camwiegert
Copy link

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! 👋

@camwiegert
Copy link
Author

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

@UziTech
Copy link
Member

UziTech commented Aug 1, 2018

comfirmed

common mark spec example #112

@UziTech UziTech added the L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue label Aug 1, 2018
@Feder1co5oave
Copy link
Contributor

#1387 returns this:

bin/marked
```html foo
^D
<pre><code class="language-html"></code></pre>

which seems correct

@camwiegert
Copy link
Author

Thanks for addressing this! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants