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

class injection in code block renderer #54

Closed
rlidwka opened this issue Jul 1, 2015 · 1 comment
Closed

class injection in code block renderer #54

rlidwka opened this issue Jul 1, 2015 · 1 comment

Comments

@rlidwka
Copy link
Contributor

rlidwka commented Jul 1, 2015

Did you know that CommonMark supports buttons? Apparently it does:

The trouble is: renderer appends the character class blindly to the language- part. If there are spaces there, we'll end up with <code class="language-foo bar"> which is two separate classes.

Well technically space (0x20) is filtered. But HTML5 allows 5 space characters according to 2.4 part of the spec. I'll quote:

The space characters, for the purposes of this specification, are U+0020 SPACE, "tab" (U+0009), "LF" (U+000A), "FF" (U+000C), and "CR" (U+000D).

So, this code block will have three classes: language-foo, bar and baz:

```foo&#x09;bar&#x0C;baz
code
```

Second and third are essentially user-supplied, which is usually a bad thing.

@jgm jgm closed this as completed in 5aa8ff1 Jul 1, 2015
@jgm
Copy link
Member

jgm commented Jul 1, 2015

Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants