-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Question: Way to securely include raw HTML code blocks? #741
Comments
So, running
yields the following result: <pre><code><h1>test</h1>
</code></pre> As you can see the HTML tags are properly escaped. Can you provide a standalone example that doesn't work for you? |
What about the exact snippet I posted, I'm not familiar with the My next question would be is there also a setting to disable it (that might be a culprit)? Are you aware of any special aspects about kramdown's use by Jekyll that would have an impact on this behavior? IE, if someone TRULY wanted the injection (people sometimes say they do for highlighting purposes, etc), ie, exactly:
Is that possible (somehow) with kramdown or impossible? |
The backticks are used by the GFM parser extension, not by kramdown itself. The triple tildes are the original way of doing code blocks and should work everywhere where triple backticks work (like here in Github comments). If you are using kramdown with Jekyll and it doesn't work in conjunction, you will need to ask your question there since this works fine with kramdown. And yes, you can embed HTML blocks, see https://kramdown.gettalong.org/syntax.html#html-blocks |
I opened an issue there also. Could be I don't fully understand the scope of the problem yet.
Can you embed HTML blocks inside code [ |
No, not with a standard code block because that would negate the main reason for its existence. What you can do is use a special syntax highlighter. If a syntax highlighter is used, the verbatim text of the code block is given to it and the result returned. So this way you could embed HTML blocks. |
Closing this. The user in question was trying to use both rouge and and Highlight.js and we were complaining loudly because of all the HTML we detected inside |
Say given the markdown:
In this case the
<
and>
should be encoded to avoid theH1
tag from literally being injected directly into the persons website unintentionally. Is this supported or a configurable option? I know some might want to do this, but I think much of the time this is accidental and a big security issue. This has come up multiple times with Highlight.js and the security alert we issue when we detect HTML tags inside a code block (which we do not support by default because of all the related security issues).Related:
The text was updated successfully, but these errors were encountered: