-
Notifications
You must be signed in to change notification settings - Fork 87
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
innerHTML breaks syntax highlighting #85
Comments
Hi @maikhorma - I think you are using this incorrectly. The This is clearly not the case from your code sandbox sample. This could be the case if your use case is more complex, and the code you want to highlight comes directly from a markdown compiler (as the author mentions) - which produces HTML, where the markdown code is wrapped in the Going back to your sample, either remove the Or change the inner content to this:
That way you don't need to do any hacking! Hope this helps! :) |
Thanks for the response and that makes sense that I can just wrap the outside source instead of hacking (the codesandbox was just a simplified example), but what's the point of the Highlight plugin if it doesn't highlight anything unless you wrap it in a |
Also, maybe i'm misunderstanding something:
Removing the |
I'm on nodejs 18.3, so I'm wondering if it's a compatibility thing, but here's a codesandbox that demonstrates it.
I was able to make it to work by hacking here to do this:
This is because this function doesn't find the element thanks to lack of
<pre><code>
wrapper:I'd do a PR myself but i'm a novice at this js and react stuff and i'm pretty sure my hack isn't the right way to fix it. If you want to explain what I need to do I can submit the PR.
The text was updated successfully, but these errors were encountered: