mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-11 13:53:15 -04:00
Add class attribute to heading render hook examples
This commit is contained in:
parent
f0f4bcb243
commit
5391dddeac
@ -64,7 +64,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C
|
|||||||
[CommonMark specification]: https://spec.commonmark.org/current/
|
[CommonMark specification]: https://spec.commonmark.org/current/
|
||||||
|
|
||||||
{{< 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 }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
|
||||||
{{- .Text -}}
|
{{- .Text -}}
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
@ -72,7 +72,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C
|
|||||||
To add an anchor link to the right of each heading:
|
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 }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
|
||||||
{{ .Text }}
|
{{ .Text }}
|
||||||
<a href="#{{ .Anchor }}">#</a>
|
<a href="#{{ .Anchor }}">#</a>
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user