]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Squashed 'docs/' changes from f0f4bcb24..4429eeeea
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 16 Jan 2025 09:35:07 +0000 (10:35 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 16 Jan 2025 09:35:07 +0000 (10:35 +0100)
4429eeeea Update image render hooks examples to conform with Commonmark
5391dddea Add class attribute to heading render hook examples

git-subtree-dir: docs
git-subtree-split: 4429eeeea84bfa4b9e636deaab5c9620ccf776a6

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

index dc64296eac050abff40832ae0bff59d293dea415..2635802e870c714cb3e7a98eb420871633cef380 100755 (executable)
@@ -64,7 +64,7 @@ In its default configuration, Hugo renders Markdown headings according to the [C
 [CommonMark specification]: https://spec.commonmark.org/current/
 
 {{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
-<h{{ .Level }} id="{{ .Anchor }}">
+<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
   {{- .Text -}}
 </h{{ .Level }}>
 {{< /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:
 
 {{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
-<h{{ .Level }} id="{{ .Anchor }}">
+<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
   {{ .Text }}
   <a href="#{{ .Anchor }}">#</a>
 </h{{ .Level }}>
index eca346c109db3fd8d7b2b8744d46e90fd8aa3b7e..d3067c5a4835bf4c8f515c8f484144e8c677fd95 100755 (executable)
@@ -91,7 +91,7 @@ In its default configuration, Hugo renders Markdown images according to the [Com
 
 {{< code file=layouts/_default/_markup/render-image.html copy=true >}}
 <img src="{{ .Destination | safeURL }}"
-  {{- with .Text }} alt="{{ . }}"{{ end -}}
+  {{- with .PlainText }} alt="{{ . }}"{{ end -}}
   {{- with .Title }} title="{{ . }}"{{ end -}}
 >
 {{- /* chomp trailing newline */ -}}
@@ -103,13 +103,13 @@ To render standalone images within `figure` elements:
 {{- if .IsBlock -}}
   <figure>
     <img src="{{ .Destination | safeURL }}"
-      {{- with .Text }} alt="{{ . }}"{{ end -}}
+      {{- with .PlainText }} alt="{{ . }}"{{ end -}}
     >
     {{- with .Title }}<figcaption>{{ . }}</figcaption>{{ end -}}
   </figure>
 {{- else -}}
   <img src="{{ .Destination | safeURL }}"
-    {{- with .Text }} alt="{{ . }}"{{ end -}}
+    {{- with .PlainText }} alt="{{ . }}"{{ end -}}
     {{- with .Title }} title="{{ . }}"{{ end -}}
   >
 {{- end -}}