language-xyz property is not passed through in code blocks
phiresky opened this issue · 4 comments
running something like
```testing
hi
```
through https://github.com/remarkjs/remark-react/ yields <pre><code>hi</code></pre>, with missing language information.
It is correctly passed to HAST here (https://github.com/syntax-tree/mdast-util-to-hast/blob/master/lib/handlers/code.js) but gets lost in hast->hyperscript translation.
Hi @phiresky!
I believe the problem is not configuring hast-util-sanitize, which is probably also in your pipeline.
Furthermore, I believe when posting this issue you were asked for a type of issue, and had to fill out some more information like this. You don’t provide enough information about how you are using the plugins or utilities, so it’s not possible to debug or help your problem, other than my above guess.
Hey - sorry for not filling out the template. This happens with completely default options in remark-react, I tried to debug it and the property seemed to disappear somewhere near this library. Thanks for the link.
Seems to me like there is some issue with the defaults, since GitHub does not strip class= attributes from code tags (they have e.g. class="highlight highlight-source-js"). It's kind of important to have because otherwise code highlighting is impossible.. but I think I'm too lazy to find out how to fix it.
Class names are not allowed, unlike in GitHub, because they cause safety issues.
The docs for hast-util-santize explain how to allow class names!