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

@@ -15,7 +15,7 @@ This allows us to effectively bypass the rules governing [indentation] as provid
Consider this Markdown, an unordered list with a small gallery of thumbnail images within each list item:
{{< code file=content/about.md lang=text >}}
```text {file="content/about.md"}
- Gallery one
{{</* gallery */>}}
@@ -29,17 +29,17 @@ Consider this Markdown, an unordered list with a small gallery of thumbnail imag
![kitten c](thumbnails/c.jpg)
![kitten d](thumbnails/d.jpg)
{{</* /gallery */>}}
{{< /code >}}
```
In the example above, notice that the content between the opening and closing shortcode tags is indented by four spaces. Per the CommonMark specification, this is treated as an indented code block.
With this shortcode, calling `Inner` instead of `InnerDeindent`:
{{< code file=layouts/shortcodes/gallery.html >}}
```go-html-template {file="layouts/shortcodes/gallery.html"}
<div class="gallery">
{{ .Inner | strings.TrimSpace | .Page.RenderString }}
</div>
{{< /code >}}
```
Hugo renders the Markdown to:
@@ -66,11 +66,11 @@ Hugo renders the Markdown to:
Although technically correct per the CommonMark specification, this is not what we want. If we remove the indentation using the `InnerDeindent` method:
{{< code file=layouts/shortcodes/gallery.html >}}
```go-html-template {file="layouts/shortcodes/gallery.html"}
<div class="gallery">
{{ .InnerDeindent | strings.TrimSpace | .Page.RenderString }}
</div>
{{< /code >}}
```
Hugo renders the Markdown to: