Compare Hugo’s Markup Languages (featuring a renderas shortcode)⁠⚖️
Updated  by  nm  2024-March-9

Page contents

News

Ongoing  According to the Repology Hugo badges, the latest packaged Hugo is version [no network :(]. To keep up with Hugo releases, see github.com/gohugoio/hugo/releases, discourse.gohugo.io/c/announcements, or @gohugoio@fosstodon.org. To learn about upcoming Hugo releases, see github.com/gohugoio/hugo/milestones.

Introduction

Hugo’s .RenderString method makes it possible to use more than one of Hugo’s markup languages in the source of a single page. This means you can test features of Hugo’s markup languages without creating a separate file for each markup language.

For details, see Infinite Ink’s Hugo’s .RenderString Method. That article discusses this renderas shortcode:

{{/*
* CREATED: 2021-July by nm
* 
* PATH: layouts/shortcodes/renderas.html
* 
* EXAMPLE USAGE:
* 
*   {{< renderas adoc >}}
*   AsciiDoc markup
*   {{< /renderas >}}
* 
*/}}

{{ $options := (dict 
  "markup" (.Get 0) 
  "display" "block"
) }}

{{ .Inner | .Page.RenderString $options }}

 

This renderas shortcode is used in the tests and exercises below.

 

Markdown tests: Inline footnotes in two Markdown flavors

To learn about Markdown footnotes, see the Footnotes👣 section of Infinite Ink’s Ordinary and Extraordinary Markdown. Some (not all) Markdown flavors support the following syntax for inline footnotes:

some text^[This is an inline footnote.]

In the source of the first two tests below, I use Infinite Ink’s renderas shortcode to test this syntax in the Markdown flavors that are supported by Hugo v0.100.0+.

 

Starting with version 0.92.0, Hugo no longer supports Mmark-⁠flavored Markdown.

Starting with version 0.100.0, Hugo no longer supports Blackfriday-⁠flavored Markdown.

 


Test 1: Pandoc-flavored Markdown

Source fragment

{{< renderas pandoc >}}

some text^[This is an inline footnote.]

{{< /renderas >}}

 

Rendered in your web browser

some text1


  1. This is an inline footnote.↩︎

 


Test 2: Goldmark-flavored Markdown

Source fragment

{{< renderas goldmark >}}

some text^[This is an inline footnote.]

{{< /renderas >}}

 

Rendered in your web browser

some text^[This is an inline footnote.]

 


Markdown conclusion

Pandoc-⁠flavored Markdown supports this inline footnote syntax, but Goldmark-⁠flavored Markdown does not. It’s possible, but not likely, inline footnotes will be supported in a future version of Goldmark.

 

More tests: Inline footnotes in AsciiDoc and Org-⁠mode

Test 3: AsciiDoc

 

Source fragment

{{< renderas adoc >}}

some textfootnote:[This is an inline footnote.]

{{< /renderas >}}

 

Rendered in your web browser

some text[1]


1. This is an inline footnote.

 

Test 3’s renderas argument can be ad, adoc, or asciidocext (but not asciidoc, which is a bug).

 


Test 4: Org-mode

To learn about Org-mode footnotes, see orgmode.org/manual/Creating-Footnotes.html.

 

Source fragment

{{< renderas org >}}

some text[fn:: This is an inline footnote.]

{{< /renderas >}}

 

Rendered in your web browser

some text1


1

This is an inline footnote.

 

Inline footnotes conclusion

Three of the four markup languages tested above support inline footnotes.⁠👍

 

Exercises for the reader (and me)

Exercise 1: Nested footnotes

Determine which of Hugo’s markup languages support nested footnotes (footnotes within footnotes). In the next two sections, I begin the exercise.

Goldmark source fragment

{{< renderas goldmark >}}
some text[^1]

[^1]: footnote 1[^2]

[^2]: footnote 2
{{< /renderas >}}

 

Goldmark rendering

some text1


  1. footnote 12 ↩︎

  2. footnote 2 ↩︎


Conclusion:  Goldmark-flavored Markdown supports nested footnotes.🎉


Next: AsciiDoc, Org-mode, Pandoc, etc.

Your mission, if you choose to accept it, is to use the renderas shortcode to see if AsciiDoc, Org-mode, Pandoc, etc. support nested footnotes.

 

Exercise 2: Multiple references to a single footnote

I think most of Hugo’s markup languages support having multiple references to a single footnote. I’m mainly interested in seeing how the footnote itself signals that it is referred to from multiple places.

See also


Please share & discuss 📝 👎 👍 📯