diff options
Diffstat (limited to 'themes/hugo-book/layouts/_markup')
7 files changed, 62 insertions, 0 deletions
diff --git a/themes/hugo-book/layouts/_markup/render-blockquote.html b/themes/hugo-book/layouts/_markup/render-blockquote.html new file mode 100644 index 0000000..88809a1 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-blockquote.html @@ -0,0 +1,9 @@ +{{- $attributes := .Attributes }} +{{- $class := printf "book-hint %s" ($.AlertType | lower) }} +{{- if isset $attributes "class" }} + {{ $class = printf "%s %s" $class (index $attributes "class") }} +{{ end -}} +{{- $attributes = merge $attributes (dict "class" $class) }} +<blockquote {{ range $key, $value := $attributes }}{{printf "%s='%s'" $key $value | safeHTMLAttr}}{{ end }}> + {{ .Text }} +</blockquote>
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-katex.html b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html new file mode 100644 index 0000000..94bcb55 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html @@ -0,0 +1,13 @@ +{{- if not (.Page.Store.Get "katex") -}} +<!-- Include katex only first time --> +<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" /> +<script defer src="{{ "katex/katex.min.js" | relURL }}"></script> +{{ with resources.Get "katex.json" }} +<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body, {{ .Content | safeJS }});"></script> +{{ end }} +{{- .Page.Store.Set "katex" true -}} +{{- end -}} + +{{- with .Inner }} +<span>\[ {{ .| htmlEscape | safeHTML }} \]</span> +{{ end -}} diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..097857a --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html @@ -0,0 +1,12 @@ +{{ if not (.Page.Store.Get "mermaid") }} +<!-- Include mermaid only first time --> +<script src="{{ "mermaid.min.js" | relURL }}"></script> +{{ with resources.Get "mermaid.json" }} + <script>mermaid.initialize({{ .Content | safeJS }})</script> +{{ end }} +{{ .Page.Store.Set "mermaid" true }} +{{ end }} + +<pre class="mermaid"> + {{- .Inner -}} +</pre> diff --git a/themes/hugo-book/layouts/_markup/render-codeblock.html b/themes/hugo-book/layouts/_markup/render-codeblock.html new file mode 100644 index 0000000..a79563f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock.html @@ -0,0 +1,10 @@ +{{- with (index .Attributes "filename") -}} + {{- $href := index $.Attributes "href" -}} + {{- if $href -}} + {{- $href = partial "docs/links/portable-link" (dict "Page" $.PageInner "Destination" $href) -}} + {{- end -}} +<div class="book-codeblock-filename"> + <a {{ with $href }}href="{{ . }}"{{ end }}>{{ . }}</a> +</div> +{{- end -}} +{{- (transform.HighlightCodeBlock . .Options).Wrapped -}} diff --git a/themes/hugo-book/layouts/_markup/render-heading.html b/themes/hugo-book/layouts/_markup/render-heading.html new file mode 100644 index 0000000..d2b3c28 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-heading.html @@ -0,0 +1,6 @@ +<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}> + {{ .Text }} + {{ if default true .Page.Params.bookHeadingAnchor }} + <a class="anchor" href="#{{ .Anchor }}">#</a> + {{ end }} +</h{{ .Level }}> diff --git a/themes/hugo-book/layouts/_markup/render-image.html b/themes/hugo-book/layouts/_markup/render-image.html new file mode 100644 index 0000000..2453b46 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-image.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-image" . -}} +{{- end -}} +<img src="{{ $destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> +{{- /**/ -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-link.html b/themes/hugo-book/layouts/_markup/render-link.html new file mode 100644 index 0000000..8aefa3f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-link.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-link" . -}} +{{- end -}} +<a href="{{ $destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> +{{- /**/ -}}
\ No newline at end of file |
