# HTML in code blocks

**URL:** <https://zola.discourse.group/t/html-in-code-blocks/150>\
**Category:** Support\
**Created:** [July 9, 2019, 4:18pm UTC](https://zola.discourse.group/t/html-in-code-blocks/150 "2019-07-09T16:18:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://zola.discourse.group/u/abc)\
**Post date:** [July 9, 2019, 4:18pm UTC](https://zola.discourse.group/t/html-in-code-blocks/150/1 "2019-07-09T16:18:34Z")

</div>

How can I e.g. use italics to mark up placeholders in code snippets (like in the arch linux wiki)?

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [July 10, 2019, 9:08am UTC](https://zola.discourse.group/t/html-in-code-blocks/150/2 "2019-07-10T09:08:58Z")

</div>

I am not sure. You can disable syntax highlighting and write the code block by hand. I am guessing the Arch wiki has a WYSIWYG editor that does it for them.

---

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://zola.discourse.group/u/abc)\
**Post date:** [July 10, 2019, 2:53pm UTC](https://zola.discourse.group/t/html-in-code-blocks/150/3 "2019-07-10T14:53:09Z")

</div>

I don’t care about having to write `<pre>` and `</pre>`, but I’d prefer not losing syntax highlighting. Could there be a `{% code() %}` shortcode for example? with an optional parameter to control how the syntax highlighter behaves with HTML tags, which e.g. can be set to `"ignore"` or `"unwrap"`.

---

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://zola.discourse.group/u/abc)\
**Post date:** [July 10, 2019, 2:58pm UTC](https://zola.discourse.group/t/html-in-code-blocks/150/4 "2019-07-10T14:58:28Z")

</div>

Another motivation for this feature is explaining code by parts. See [this section](https://nixos.org/nix/manual/#sec-expression-syntax) in the nix manual for an example.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [July 12, 2019, 7:44pm UTC](https://zola.discourse.group/t/html-in-code-blocks/150/5 "2019-07-12T19:44:49Z")

</div>

It would have to hook pretty deep in `syntect` I think, definitely not a trivial change.

There are some additional things that would be nice to have with regards to syntax highlighting: line numbers, line highlighted ([Tis a draft · Keats/vincentprouillet@c5db5e8 · GitHub](https://github.com/Keats/vincentprouillet/commit/c5db5e8fde18145879f61d959b4a13b1c607c0e6)) and your suggestion could be another nice thing to add to the list. I won’t have time to implement those myself though 😕

---

<div class="post-metadata">

**Author:** ![robinm](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/robinm/32/404_2.png) [@robinm](https://zola.discourse.group/u/robinm)\
**Post date:** [January 7, 2021, 8:42am UTC](https://zola.discourse.group/t/html-in-code-blocks/150/6 "2021-01-07T08:42:13Z")

</div>

When I read [this blog post from matklad](https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html) I found that using annotations with numbers (in black circle), as well as highlighting part of the code (in yellow) in its code-block was very clever. Was there any progress in this regards? If not, do you know any static site generator that supports it?
