Documentation for Code Block Render Hooks

I finally got my lazy ass out of the sofa and wrote some documentation:

8 Likes

Hi @bep you wrote all the documentations yourself?

Do you have an answer to the current documentation content order which is bit confusing when learning. I have shared an example of what I mean here

Thanks

short sample of layouts/_default/_markup/render-codeblock.html, if you want to test it

{{ $class := .Attributes.class | default ""    }}
{{ $lang  := .Attributes.lang  | default .Type }}
{{ if transform.CanHighlight $lang }}
<div class="{{ $class }}">{{ highlight .Inner $lang }}</div>
{{else}}
<pre><code class="{{ $class }}">{{.Inner}}</code></pre>
{{end}}

usage with language tag

```CSS 
:root {
	color-scheme: light dark;
}
```

HTH

5 Likes