mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 22:17:28 +00:00
content: Replace calls to the code shortcode with fenced code blocks
This commit is contained in:
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
|
||||

|
||||

|
||||
{{</* /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:
|
||||
|
||||
|
||||
Reference in new issue
Block a user