mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-12 04:14:45 -04:00
Document change to data type returned by render hook Text methods
See https://github.com/gohugoio/hugo/pull/12813.
This commit is contained in:
parent
83fe7ccc38
commit
d32f7856d1
@ -68,7 +68,7 @@ block = true
|
|||||||
(`string`) The position of the blockquote within the page content.
|
(`string`) The position of the blockquote within the page content.
|
||||||
|
|
||||||
###### Text
|
###### 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
|
###### 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 >}}
|
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
|
||||||
<blockquote>
|
<blockquote>
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{{< /code >}}
|
{{< /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 >}}
|
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
|
||||||
<figure>
|
<figure>
|
||||||
<blockquote {{ with .Attributes.cite }}cite="{{ . }}"{{ end }}>
|
<blockquote {{ with .Attributes.cite }}cite="{{ . }}"{{ end }}>
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{{ with .Attributes.caption }}
|
{{ with .Attributes.caption }}
|
||||||
<figcaption class="blockquote-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.
|
> Advises about risks or negative outcomes of certain actions.
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
This syntax is compatible with both the GitHub Alert Markdown extension and Obsidian's callout syntax.
|
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).
|
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) }}
|
{{ transform.Emojify (index $emojis .AlertType) }}
|
||||||
{{ or (i18n .AlertType) (title .AlertType) }}
|
{{ or (i18n .AlertType) (title .AlertType) }}
|
||||||
</p>
|
</p>
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<blockquote>
|
<blockquote>
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
@ -55,7 +55,7 @@ title = true
|
|||||||
|
|
||||||
###### Text
|
###### Text
|
||||||
|
|
||||||
(`string`) The heading text.
|
(`template.HTML`) The heading text.
|
||||||
|
|
||||||
## Examples
|
## 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 >}}
|
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
|
||||||
<h{{ .Level }} id="{{ .Anchor }}">
|
<h{{ .Level }} id="{{ .Anchor }}">
|
||||||
{{- .Text | safeHTML -}}
|
{{- .Text -}}
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
{{< /code >}}
|
{{< /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 >}}
|
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
|
||||||
<h{{ .Level }} id="{{ .Anchor }}">
|
<h{{ .Level }} id="{{ .Anchor }}">
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text }}
|
||||||
<a href="#{{ .Anchor }}">#</a>
|
<a href="#{{ .Anchor }}">#</a>
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
@ -73,7 +73,7 @@ block = true
|
|||||||
|
|
||||||
###### Text
|
###### Text
|
||||||
|
|
||||||
(`string`) The image description.
|
(`template.HTML`) The image description.
|
||||||
|
|
||||||
###### Title
|
###### 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
|
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
|
||||||
{{% /note %}}
|
{{% /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
|
[page resource]: /getting-started/glossary/#page-resource
|
||||||
[global resource]: /getting-started/glossary/#global-resource
|
[global resource]: /getting-started/glossary/#global-resource
|
||||||
|
@ -54,7 +54,7 @@ Link render hook templates receive the following context:
|
|||||||
|
|
||||||
###### Text
|
###### Text
|
||||||
|
|
||||||
(`string`) The link description.
|
(`template.HTML`) The link description.
|
||||||
|
|
||||||
###### Title
|
###### Title
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ In its default configuration, Hugo renders Markdown links according to the [Comm
|
|||||||
<a href="{{ .Destination | safeURL }}"
|
<a href="{{ .Destination | safeURL }}"
|
||||||
{{- with .Title }} title="{{ . }}"{{ end -}}
|
{{- with .Title }} title="{{ . }}"{{ end -}}
|
||||||
>
|
>
|
||||||
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
|
{{- with .Text }}{{ . }}{{ end -}}
|
||||||
</a>
|
</a>
|
||||||
{{- /* chomp trailing newline */ -}}
|
{{- /* chomp trailing newline */ -}}
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
@ -87,7 +87,7 @@ To include a `rel` attribute set to `external` for external links:
|
|||||||
{{- with .Title }} title="{{ . }}"{{ end -}}
|
{{- with .Title }} title="{{ . }}"{{ end -}}
|
||||||
{{- if $u.IsAbs }} rel="external"{{ end -}}
|
{{- if $u.IsAbs }} rel="external"{{ end -}}
|
||||||
>
|
>
|
||||||
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
|
{{- with .Text }}{{ . }}{{ end -}}
|
||||||
</a>
|
</a>
|
||||||
{{- /* chomp trailing newline */ -}}
|
{{- /* chomp trailing newline */ -}}
|
||||||
{{< /code >}}
|
{{< /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
|
[duplication of shared page resources]: /getting-started/configuration-markup/#duplicateresourcefiles
|
||||||
{{% /note %}}
|
{{% /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
|
[page resource]: /getting-started/glossary/#page-resource
|
||||||
[global resource]: /getting-started/glossary/#global-resource
|
[global resource]: /getting-started/glossary/#global-resource
|
||||||
|
@ -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`.
|
(`string`) The alignment of the text within the table cell, one of `left`, `center`, or `right`.
|
||||||
|
|
||||||
###### Text
|
###### Text
|
||||||
(`string`) The text within the table cell.
|
(`template.HTML`) The text within the table cell.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
|
|||||||
<tr>
|
<tr>
|
||||||
{{- range . }}
|
{{- range . }}
|
||||||
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
|
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
|
||||||
{{- .Text | safeHTML -}}
|
{{- .Text -}}
|
||||||
</th>
|
</th>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</tr>
|
</tr>
|
||||||
@ -94,7 +94,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
|
|||||||
<tr>
|
<tr>
|
||||||
{{- range . }}
|
{{- range . }}
|
||||||
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
|
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
|
||||||
{{- .Text | safeHTML -}}
|
{{- .Text -}}
|
||||||
</td>
|
</td>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user