Add render hooks for codeblocks, headings, and images

This commit is contained in:
Eryn Wells 2024-06-28 09:04:37 -07:00
parent 4bc1390b3c
commit d73c779508
3 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,4 @@
{{- $highlighted := transform.HighlightCodeBlock . -}}
<pre class="codeblock">
{{- $highlighted.Inner -}}
</pre>

View file

@ -0,0 +1,3 @@
<h{{ .Level }} id="{{ .Anchor }}" class="heading">
{{ .Text | safeHTML }} <a class="heading__anchor" href="#{{ .Anchor }}">#</a>
</h{{ .Level }}>

View file

@ -0,0 +1,15 @@
{{- if .IsBlock }}
<figure id="figure-{{ .Ordinal }}">
<img src="{{ .Destination | safeURL }}"
{{- with .Text }} alt="{{ . }}"{{ end -}}
>
{{- with .Title }}
<figcaption>{{ . }}</figcaption>
{{- end }}
</figure>
{{ else -}}
<img src="{{ .Destination | safeURL }}"
{{- with .Text }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}}
>
{{- end }}