diff options
Diffstat (limited to 'docs/content/en/render-hooks')
-rwxr-xr-x | docs/content/en/render-hooks/blockquotes.md | 13 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/code-blocks.md | 19 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/headings.md | 4 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/images.md | 4 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/introduction.md | 24 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/links.md | 4 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/passthrough.md | 11 | ||||
-rwxr-xr-x | docs/content/en/render-hooks/tables.md | 2 |
8 files changed, 38 insertions, 43 deletions
diff --git a/docs/content/en/render-hooks/blockquotes.md b/docs/content/en/render-hooks/blockquotes.md index 7ba282a0a..411c6c796 100755 --- a/docs/content/en/render-hooks/blockquotes.md +++ b/docs/content/en/render-hooks/blockquotes.md @@ -53,7 +53,7 @@ Type In its default configuration, Hugo renders Markdown blockquotes according to the [CommonMark specification]. To create a render hook that does the same thing: -```go-html-template {file="layouts/_default/_markup/render-blockquote.html" copy=true} +```go-html-template {file="layouts/_markup/render-blockquote.html" copy=true} <blockquote> {{ .Text }} </blockquote> @@ -61,7 +61,7 @@ In its default configuration, Hugo renders Markdown blockquotes according to the To render a blockquote as an HTML `figure` element with an optional citation and caption: -```go-html-template {file="layouts/_default/_markup/render-blockquote.html" copy=true} +```go-html-template {file="layouts/_markup/render-blockquote.html" copy=true} <figure> <blockquote {{ with .Attributes.cite }}cite="{{ . }}"{{ end }}> {{ .Text }} @@ -126,7 +126,7 @@ The extended syntax is compatible with [Obsidian]. This blockquote render hook renders a multilingual alert if an alert designator is present, otherwise it renders a blockquote according to the CommonMark specification. -```go-html-template {file="layouts/_default/_markup/render-blockquote.html" copy=true} +```go-html-template {file="layouts/_markup/render-blockquote.html" copy=true} {{ $emojis := dict "caution" ":exclamation:" "important" ":information_source:" @@ -168,10 +168,9 @@ Although you can use one template with conditional logic as shown above, you can ```text layouts/ -└── _default/ - └── _markup/ - ├── render-blockquote-alert.html - └── render-blockquote-regular.html + └── _markup/ + ├── render-blockquote-alert.html + └── render-blockquote-regular.html ``` {{% include "/_common/render-hooks/pageinner.md" %}} diff --git a/docs/content/en/render-hooks/code-blocks.md b/docs/content/en/render-hooks/code-blocks.md index d1a01e9b0..6e0ea011f 100755 --- a/docs/content/en/render-hooks/code-blocks.md +++ b/docs/content/en/render-hooks/code-blocks.md @@ -72,7 +72,7 @@ Type In its default configuration, Hugo renders fenced code blocks by passing the code sample through the Chroma syntax highlighter and wrapping the result. To create a render hook that does the same thing: -```go-html-template {file="layouts/_default/_markup/render-codeblock.html" copy=true} +```go-html-template {file="layouts/_markup/render-codeblock.html" copy=true} {{ $result := transform.HighlightCodeBlock . }} {{ $result.Wrapped }} ``` @@ -81,16 +81,15 @@ Although you can use one template with conditional logic to control the behavior ```text layouts/ -└── _default/ - └── _markup/ - ├── render-codeblock-mermaid.html - ├── render-codeblock-python.html - └── render-codeblock.html + └── _markup/ + ├── render-codeblock-mermaid.html + ├── render-codeblock-python.html + └── render-codeblock.html ``` For example, to create a code block render hook to render [Mermaid] diagrams: -```go-html-template {file="layouts/_default/_markup/render-codeblock-mermaid.html" copy=true} +```go-html-template {file="layouts/_markup/render-codeblock-mermaid.html" copy=true} <pre class="mermaid"> {{ .Inner | htmlEscape | safeHTML }} </pre> @@ -99,7 +98,7 @@ For example, to create a code block render hook to render [Mermaid] diagrams: Then include this snippet at the _bottom_ of your base template, before the closing `body` tag: -```go-html-template {file="layouts/_default/baseof.html" copy=true} +```go-html-template {file="layouts/baseof.html" copy=true} {{ if .Store.Get "hasMermaid" }} <script type="module"> import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs'; @@ -118,10 +117,10 @@ Hugo includes an [embedded code block render hook] to render [GoAT diagrams]. [`RenderShortcodes`]: /methods/page/rendershortcodes [Chroma]: https://github.com/alecthomas/chroma/ -[code fence]: https://spec.commonmark.org/0.31.2/#code-fence +[code fence]: https://spec.commonmark.org/current/#code-fence [diagrams]: /content-management/diagrams/#mermaid-diagrams [embedded code block render hook]: {{% eturl render-codeblock-goat %}} [GoAT diagrams]: /content-management/diagrams/#goat-diagrams-ascii [highlighting options]: /functions/transform/highlight/#options -[info string]: https://spec.commonmark.org/0.31.2/#info-string +[info string]: https://spec.commonmark.org/current/#info-string [Mermaid]: https://mermaid.js.org/ diff --git a/docs/content/en/render-hooks/headings.md b/docs/content/en/render-hooks/headings.md index 89868d478..5279dff78 100755 --- a/docs/content/en/render-hooks/headings.md +++ b/docs/content/en/render-hooks/headings.md @@ -46,7 +46,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C [CommonMark specification]: https://spec.commonmark.org/current/ -```go-html-template {file="layouts/_default/_markup/render-heading.html" copy=true} +```go-html-template {file="layouts/_markup/render-heading.html" copy=true} <h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}> {{- .Text -}} </h{{ .Level }}> @@ -54,7 +54,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C To add an anchor link to the right of each heading: -```go-html-template {file="layouts/_default/_markup/render-heading.html" copy=true} +```go-html-template {file="layouts/_markup/render-heading.html" copy=true} <h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}> {{ .Text }} <a href="#{{ .Anchor }}">#</a> diff --git a/docs/content/en/render-hooks/images.md b/docs/content/en/render-hooks/images.md index a4faac672..9f8ef1efb 100755 --- a/docs/content/en/render-hooks/images.md +++ b/docs/content/en/render-hooks/images.md @@ -64,7 +64,7 @@ Title In its default configuration, Hugo renders Markdown images according to the [CommonMark specification]. To create a render hook that does the same thing: -```go-html-template {file="layouts/_default/_markup/render-image.html" copy=true} +```go-html-template {file="layouts/_markup/render-image.html" copy=true} <img src="{{ .Destination | safeURL }}" {{- with .PlainText }} alt="{{ . }}"{{ end -}} {{- with .Title }} title="{{ . }}"{{ end -}} @@ -74,7 +74,7 @@ In its default configuration, Hugo renders Markdown images according to the [Com To render standalone images within `figure` elements: -```go-html-template {file="layouts/_default/_markup/render-image.html" copy=true} +```go-html-template {file="layouts/_markup/render-image.html" copy=true} {{- if .IsBlock -}} <figure> <img src="{{ .Destination | safeURL }}" diff --git a/docs/content/en/render-hooks/introduction.md b/docs/content/en/render-hooks/introduction.md index 045d25c3d..aafebf3e6 100755 --- a/docs/content/en/render-hooks/introduction.md +++ b/docs/content/en/render-hooks/introduction.md @@ -47,25 +47,23 @@ Each render hook is a template, with one template for each supported element typ ```text layouts/ -└── _default/ - └── _markup/ - ├── render-blockquote.html - ├── render-codeblock.html - ├── render-heading.html - ├── render-image.html - ├── render-link.html - ├── render-passthrough.html - └── render-table.html + └── _markup/ + ├── render-blockquote.html + ├── render-codeblock.html + ├── render-heading.html + ├── render-image.html + ├── render-link.html + ├── render-passthrough.html + └── render-table.html ``` The template lookup order allows you to create different render hooks for each page [type](g), [kind](g), language, and [output format](g). For example: ```text layouts/ -├── _default/ -│ └── _markup/ -│ ├── render-link.html -│ └── render-link.rss.xml +├── _markup/ +│ ├── render-link.html +│ └── render-link.rss.xml ├── books/ │ └── _markup/ │ ├── render-link.html diff --git a/docs/content/en/render-hooks/links.md b/docs/content/en/render-hooks/links.md index 23f725eb7..af0a8f0dd 100755 --- a/docs/content/en/render-hooks/links.md +++ b/docs/content/en/render-hooks/links.md @@ -48,7 +48,7 @@ Title In its default configuration, Hugo renders Markdown links according to the [CommonMark specification]. To create a render hook that does the same thing: -```go-html-template {file="layouts/_default/_markup/render-link.html" copy=true} +```go-html-template {file="layouts/_markup/render-link.html" copy=true} <a href="{{ .Destination | safeURL }}" {{- with .Title }} title="{{ . }}"{{ end -}} > @@ -59,7 +59,7 @@ In its default configuration, Hugo renders Markdown links according to the [Comm To include a `rel` attribute set to `external` for external links: -```go-html-template {file="layouts/_default/_markup/render-link.html" copy=true} +```go-html-template {file="layouts/_markup/render-link.html" copy=true} {{- $u := urls.Parse .Destination -}} <a href="{{ .Destination | safeURL }}" {{- with .Title }} title="{{ . }}"{{ end -}} diff --git a/docs/content/en/render-hooks/passthrough.md b/docs/content/en/render-hooks/passthrough.md index 356a030af..ea0df8824 100755 --- a/docs/content/en/render-hooks/passthrough.md +++ b/docs/content/en/render-hooks/passthrough.md @@ -86,7 +86,7 @@ Instead of client-side JavaScript rendering of mathematical markup using MathJax [`transform.ToMath`]: /functions/transform/tomath/ -```go-html-template {file="layouts/_default/_markup/render-passthrough.html" copy=true} +```go-html-template {file="layouts/_markup/render-passthrough.html" copy=true} {{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq .Type "block") }} {{- with try (transform.ToMath .Inner $opts) }} {{- with .Err }} @@ -100,7 +100,7 @@ Instead of client-side JavaScript rendering of mathematical markup using MathJax Then, in your base template, conditionally include the KaTeX CSS within the head element: -```go-html-template {file="layouts/_default/baseof.html" copy=true} +```go-html-template {file="layouts/baseof.html" copy=true} <head> {{ $noop := .WordCount }} {{ if .Page.Store.Get "hasMath" }} @@ -115,10 +115,9 @@ Although you can use one template with conditional logic as shown above, you can ```text layouts/ -└── _default/ - └── _markup/ - ├── render-passthrough-block.html - └── render-passthrough-inline.html + └── _markup/ + ├── render-passthrough-block.html + └── render-passthrough-inline.html ``` {{% include "/_common/render-hooks/pageinner.md" %}} diff --git a/docs/content/en/render-hooks/tables.md b/docs/content/en/render-hooks/tables.md index c7671aff4..619090797 100755 --- a/docs/content/en/render-hooks/tables.md +++ b/docs/content/en/render-hooks/tables.md @@ -57,7 +57,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git [GitHub Flavored Markdown specification]: https://github.github.com/gfm/#tables-extension- -```go-html-template {file="layouts/_default/_markup/render-table.html" copy=true} +```go-html-template {file="layouts/_markup/render-table.html" copy=true} <table {{- range $k, $v := .Attributes }} {{- if $v }} |