4 ms·
Did you know you can embed code blocks in HTML without escaping anything? You put them inside <script> tag with type="text/html". Then you style such tags to be
by BrainVirus 4y ago
Did you know you can embed code blocks in HTML without escaping anything? You put them inside <script> tag with type="text/html". Then you style such tags to be visible and preserve whitespace. E.g.:
<script type="text/plain">
> hello world <- this is legal
</script>
- klysm 4y agoI didnt know this but the semantics do seem odd as we have <pre> and <code> right?
- BrainVirus 4y ago<pre> and <code> still require you to escape all HTML special symbols. <script> and <style> do not.
- krapp 4y agowhat about <xmp>?
- BrainVirus 4y agoI don't know what it does in practice, since it's obsolete. Heck, I've never even heard about it until right now. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/xmp https://developer.mozilla.org/en-US/docs/Web/HTML/Element/xm... I think HTML should have a dedicated tag for this, but sadly <script> is the closest thing that I know of.