Skip to content

Commit d32f785

Browse files
jmooringbep
authored andcommitted
Document change to data type returned by render hook Text methods
See gohugoio/hugo#12813.
1 parent 83fe7cc commit d32f785

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

‎content/en/render-hooks/blockquotes.md‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ block = true
6868
(`string`) The position of the blockquote within the page content.
6969

7070
###### Text
71-
(`string`) The blockquote text, excluding the alert designator if present. See the [alerts](#alerts) section below.
71+
(`template.HTML`) The blockquote text, excluding the alert designator if present. See the [alerts](#alerts) section below.
7272

7373
###### Type
7474

@@ -82,7 +82,7 @@ In its default configuration, Hugo renders Markdown blockquotes according to the
8282

8383
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
8484
<blockquote>
85-
{{ .Text | safeHTML }}
85+
{{ .Text }}
8686
</blockquote>
8787
{{< /code >}}
8888

@@ -91,7 +91,7 @@ To render a blockquote as an HTML `figure` element with an optional citation and
9191
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
9292
<figure>
9393
<blockquote {{ with .Attributes.cite }}cite="{{ . }}"{{ end }}>
94-
{{ .Text | safeHTML }}
94+
{{ .Text }}
9595
</blockquote>
9696
{{ with .Attributes.caption }}
9797
<figcaption class="blockquote-caption">
@@ -129,7 +129,6 @@ Also known as _callouts_ or _admonitions_, alerts are blockquotes used to emphas
129129
> Advises about risks or negative outcomes of certain actions.
130130
{{< /code >}}
131131
132-
133132
{{% note %}}
134133
This syntax is compatible with both the GitHub Alert Markdown extension and Obsidian's callout syntax.
135134
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
154153
{{ transform.Emojify (index $emojis .AlertType) }}
155154
{{ or (i18n .AlertType) (title .AlertType) }}
156155
</p>
157-
{{ .Text | safeHTML }}
156+
{{ .Text }}
158157
</blockquote>
159158
{{ else }}
160159
<blockquote>
161-
{{ .Text | safeHTML }}
160+
{{ .Text }}
162161
</blockquote>
163162
{{ end }}
164163
{{< /code >}}

‎content/en/render-hooks/headings.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ title = true
5555

5656
###### Text
5757

58-
(`string`) The heading text.
58+
(`template.HTML`) The heading text.
5959

6060
## Examples
6161

@@ -65,15 +65,15 @@ In its default configuration, Hugo renders Markdown headings according to the [C
6565

6666
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
6767
<h{{ .Level }} id="{{ .Anchor }}">
68-
{{- .Text | safeHTML -}}
68+
{{- .Text -}}
6969
</h{{ .Level }}>
7070
{{< /code >}}
7171

7272
To add an anchor link to the right of each heading:
7373

7474
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
7575
<h{{ .Level }} id="{{ .Anchor }}">
76-
{{ .Text | safeHTML }}
76+
{{ .Text }}
7777
<a href="#{{ .Anchor }}">#</a>
7878
</h{{ .Level }}>
7979
{{< /code >}}

‎content/en/render-hooks/images.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ block = true
7373

7474
###### Text
7575

76-
(`string`) The image description.
76+
(`template.HTML`) The image description.
7777

7878
###### Title
7979

@@ -143,7 +143,7 @@ The embedded image render hook is automatically enabled for multilingual single-
143143
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
144144
{{% /note %}}
145145

146-
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.
146+
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.
147147

148148
[page resource]: /getting-started/glossary/#page-resource
149149
[global resource]: /getting-started/glossary/#global-resource

‎content/en/render-hooks/links.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Link render hook templates receive the following context:
5454

5555
###### Text
5656

57-
(`string`) The link description.
57+
(`template.HTML`) The link description.
5858

5959
###### Title
6060

@@ -74,7 +74,7 @@ In its default configuration, Hugo renders Markdown links according to the [Comm
7474
<a href="{{ .Destination | safeURL }}"
7575
{{- with .Title }} title="{{ . }}"{{ end -}}
7676
>
77-
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
77+
{{- with .Text }}{{ . }}{{ end -}}
7878
</a>
7979
{{- /* chomp trailing newline */ -}}
8080
{{< /code >}}
@@ -87,7 +87,7 @@ To include a `rel` attribute set to `external` for external links:
8787
{{- with .Title }} title="{{ . }}"{{ end -}}
8888
{{- if $u.IsAbs }} rel="external"{{ end -}}
8989
>
90-
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
90+
{{- with .Text }}{{ . }}{{ end -}}
9191
</a>
9292
{{- /* chomp trailing newline */ -}}
9393
{{< /code >}}
@@ -113,7 +113,7 @@ The embedded link render hook is automatically enabled for multilingual single-h
113113
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
114114
{{% /note %}}
115115

116-
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.
116+
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.
117117

118118
[page resource]: /getting-started/glossary/#page-resource
119119
[global resource]: /getting-started/glossary/#global-resource

‎content/en/render-hooks/tables.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Each table cell within the slice of slices returned by the `THead` and `TBody` m
6363
(`string`) The alignment of the text within the table cell, one of `left`, `center`, or `right`.
6464

6565
###### Text
66-
(`string`) The text within the table cell.
66+
(`template.HTML`) The text within the table cell.
6767

6868
## Example
6969

@@ -83,7 +83,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
8383
<tr>
8484
{{- range . }}
8585
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
86-
{{- .Text | safeHTML -}}
86+
{{- .Text -}}
8787
</th>
8888
{{- end }}
8989
</tr>
@@ -94,7 +94,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
9494
<tr>
9595
{{- range . }}
9696
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
97-
{{- .Text | safeHTML -}}
97+
{{- .Text -}}
9898
</td>
9999
{{- end }}
100100
</tr>

0 commit comments

Comments
 (0)