mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-12-25 02:02:11 +00:00
84cde2e97f
Create a for <figcaption> and a render hook for code snippets inside figures, replacing some ugly and complex inline HTML in my markdown sources. The only visible change is slightly worse HTML alignment and programming language indicators (with microdata). This removed the need to use one of the regex replacements in the processed_content.html shortcode, and increased the minimum required Hugo version to 0.93.
22 lines
603 B
HTML
22 lines
603 B
HTML
<figcaption>
|
|
{{ if .Get "type" | eq "code" }}
|
|
<strong itemprop="codeSampleType">Code snippet</strong>{{with .Get "lang"}} (<span itemprop="programmingLanguage">{{ . }}</span>){{end}}:
|
|
{{- end }}
|
|
|
|
{{ $contents := (.Inner | markdownify | safeHTML) }}
|
|
|
|
{{ if .Get "type" | eq "citation" }}
|
|
—
|
|
<span class="h-cite" itemprop="citation" role="doc-credit">
|
|
{{with .Get "partOfType" }}
|
|
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/{{ . }}">
|
|
{{ end }}
|
|
{{ $contents }}
|
|
{{with .Get "partOfType" }}
|
|
</span>
|
|
{{ end }}
|
|
</span>
|
|
{{ else }}
|
|
{{ $contents }}
|
|
{{- end }}
|
|
</figcaption>
|