Open imjoehaines opened 6 years ago
Hi @reimertz! Any chance this can get merged?
Hey there, I am sorry for not replying to this earlier and it taking you to close it for me to respond.
Can you please elaborate what the issue is. If I am not misstaken, you should be able to have HTML in <code>
blocks.
Just like I do here: https://reimertz.github.io/lagom/#12
I'm going to reopen this til we figured this out.
Again, sorry for the delay and thanks for taking the time to try and help out here!
Hi, sorry for not being clear originally. This is to allow having your own markup in a code block, so you can do something like this:
<pre><code class="noescape">
<span class="beep-boop">Content-Security-Policy</span>: connect-src 'none';
</code></pre>
Where the <span class="beep-boop">Content-Security-Policy</span>
adds custom HTML in the middle of a code block. In this case it renders the text "Content-Security-Policy" in a span with the beep-boop
class, rather than rendering the span as text and highlighting it as HTML
My use-case was a presentation on HTTP headers for security and HLJS didn't highlight it very nicely, which made it really hard to read. So I disabled the custom highlighting and applied this patch to let me add spans to highlight header names and values myself
Using a
noescape
class (to mimicnohighlight
from HLJS) you can specify that you don't want HTML tags in code blocks to be escaped.This lets you add custom markup to a code block, which currently doesn't seem possible.