Document change to data type returned by render hook Text methods

See https://github.com/gohugoio/hugo/pull/12813.
This commit is contained in:
Joe Mooring 2024-08-31 09:34:10 -07:00 committed by Bjørn Erik Pedersen
parent 83fe7ccc38
commit d32f7856d1
5 changed files with 17 additions and 18 deletions

View File

@ -68,7 +68,7 @@ block = true
(`string`) The position of the blockquote within the page content.
###### Text
(`string`) The blockquote text, excluding the alert designator if present. See the [alerts](#alerts) section below.
(`template.HTML`) The blockquote text, excluding the alert designator if present. See the [alerts](#alerts) section below.
###### Type
@ -82,7 +82,7 @@ In its default configuration, Hugo renders Markdown blockquotes according to the
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
<blockquote>
{{ .Text | safeHTML }}
{{ .Text }}
</blockquote>
{{< /code >}}
@ -91,7 +91,7 @@ To render a blockquote as an HTML `figure` element with an optional citation and
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
<figure>
<blockquote {{ with .Attributes.cite }}cite="{{ . }}"{{ end }}>
{{ .Text | safeHTML }}
{{ .Text }}
</blockquote>
{{ with .Attributes.caption }}
<figcaption class="blockquote-caption">
@ -129,7 +129,6 @@ Also known as _callouts_ or _admonitions_, alerts are blockquotes used to emphas
> Advises about risks or negative outcomes of certain actions.
{{< /code >}}
{{% note %}}
This syntax is compatible with both the GitHub Alert Markdown extension and Obsidian's callout syntax.
But note that GitHub will not recognize callouts with one of Obsidian's extensions (e.g. callout title or the foldable sign).
@ -154,11 +153,11 @@ The blockquote render hook below renders a multilingual alert if an alert design
{{ transform.Emojify (index $emojis .AlertType) }}
{{ or (i18n .AlertType) (title .AlertType) }}
</p>
{{ .Text | safeHTML }}
{{ .Text }}
</blockquote>
{{ else }}
<blockquote>
{{ .Text | safeHTML }}
{{ .Text }}
</blockquote>
{{ end }}
{{< /code >}}

View File

@ -55,7 +55,7 @@ title = true
###### Text
(`string`) The heading text.
(`template.HTML`) The heading text.
## Examples
@ -65,7 +65,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
<h{{ .Level }} id="{{ .Anchor }}">
{{- .Text | safeHTML -}}
{{- .Text -}}
</h{{ .Level }}>
{{< /code >}}
@ -73,7 +73,7 @@ To add an anchor link to the right of each heading:
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
<h{{ .Level }} id="{{ .Anchor }}">
{{ .Text | safeHTML }}
{{ .Text }}
<a href="#{{ .Anchor }}">#</a>
</h{{ .Level }}>
{{< /code >}}

View File

@ -73,7 +73,7 @@ block = true
###### Text
(`string`) The image description.
(`template.HTML`) The image description.
###### Title
@ -143,7 +143,7 @@ The embedded image render hook is automatically enabled for multilingual single-
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
{{% /note %}}
The embedded image render hook resolves internal Markdown destinations by looking for a matching [page resource], falling back to a matching [global resource]. Remote destinations are passed through, and the render hook will not throw an error or warning if it is unable to resolve a destination.
The embedded image render hook resolves internal Markdown destinations by looking for a matching [page resource], falling back to a matching [global resource]. Remote destinations are passed through, and the render hook will not throw an error or warning if unable to resolve a destination.
[page resource]: /getting-started/glossary/#page-resource
[global resource]: /getting-started/glossary/#global-resource

View File

@ -54,7 +54,7 @@ Link render hook templates receive the following context:
###### Text
(`string`) The link description.
(`template.HTML`) The link description.
###### Title
@ -74,7 +74,7 @@ In its default configuration, Hugo renders Markdown links according to the [Comm
<a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{ end -}}
>
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
{{- with .Text }}{{ . }}{{ end -}}
</a>
{{- /* chomp trailing newline */ -}}
{{< /code >}}
@ -87,7 +87,7 @@ To include a `rel` attribute set to `external` for external links:
{{- with .Title }} title="{{ . }}"{{ end -}}
{{- if $u.IsAbs }} rel="external"{{ end -}}
>
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
{{- with .Text }}{{ . }}{{ end -}}
</a>
{{- /* chomp trailing newline */ -}}
{{< /code >}}
@ -113,7 +113,7 @@ The embedded link render hook is automatically enabled for multilingual single-h
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
{{% /note %}}
The embedded link render hook resolves internal Markdown destinations by looking for a matching page, falling back to a matching [page resource], then falling back to a matching [global resource]. Remote destinations are passed through, and the render hook will not throw an error or warning if it is unable to resolve a destination.
The embedded link render hook resolves internal Markdown destinations by looking for a matching page, falling back to a matching [page resource], then falling back to a matching [global resource]. Remote destinations are passed through, and the render hook will not throw an error or warning if unable to resolve a destination.
[page resource]: /getting-started/glossary/#page-resource
[global resource]: /getting-started/glossary/#global-resource

View File

@ -63,7 +63,7 @@ Each table cell within the slice of slices returned by the `THead` and `TBody` m
(`string`) The alignment of the text within the table cell, one of `left`, `center`, or `right`.
###### Text
(`string`) The text within the table cell.
(`template.HTML`) The text within the table cell.
## Example
@ -83,7 +83,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
<tr>
{{- range . }}
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
{{- .Text | safeHTML -}}
{{- .Text -}}
</th>
{{- end }}
</tr>
@ -94,7 +94,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
<tr>
{{- range . }}
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
{{- .Text | safeHTML -}}
{{- .Text -}}
</td>
{{- end }}
</tr>