content: Replace calls to the code shortcode with fenced code blocks

This commit is contained in:
Joe Mooring authored and GitHub committed 2025-03-06 02:49:11 -08:00
1 parent b23c9a583a
commit fd628be6ed
110 files changed
+483 -555

No files matched your search

+4 -4
View File
@@ -18,15 +18,15 @@ Hugo increments the ordinal with each shortcode call, regardless of the specific
This method is useful for, among other things, assigning unique element IDs when a shortcode is called two or more times from the same page. For example:
{{< code file=content/about.md lang=text >}}
```text {file="content/about.md"}
{{</* img src="images/a.jpg" */>}}
{{</* img src="images/b.jpg" */>}}
{{< /code >}}
```
This shortcode performs error checking, then renders an HTML `img` element with a unique `id` attribute:
{{< code file=layouts/shortcodes/img.html >}}
```go-html-template {file="layouts/shortcodes/img.html"}
{{ $src := "" }}
{{ with .Get "src" }}
{{ $src = . }}
@@ -39,7 +39,7 @@ This shortcode performs error checking, then renders an HTML `img` element with
{{ else }}
{{ errorf "The %q shortcode requires a 'src' argument. See %s" .Name .Position }}
{{ end }}
{{< /code >}}
```
Hugo renders the page to: