zola: Codeblock naming

Add some more custom syntax to the codeblock to allow for codeblock naming.

By writing

```rust,name="Shell code"
```

If this seems like too much of a change, then we could instead introduce a config variable to include the language name in the codeblock.

Prototype of how this looks: image

with HTML looking like:

<pre data-linenos="" data-lang="rust" class="language-rust z-code">
    <div class="codeblock-name">rust</div><code class="language-rust" data-lang="rust">
    <code class="language-rust" data-lang="rust">...</code>
</pre>

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 23 (16 by maintainers)

Most upvoted comments

pre code[data-lang][data-linenos]::before {
	content: attr(data-lang);
	color: white;
}

The above pattern has turned out to be immensely useful.

How about revising the proposal to instead have

```rust,name="Shell code"
```

generate the following:

<pre data-linenos="" data-lang="rust" data-title="Shell code" class="language-rust z-code">
    <code class="language-rust" data-lang="rust">...</code>
</pre>

so it doesn’t impose any custom HTML beyond what is already in use?