When rendering Markdown to HTML, render hooks override the conversion. Each render hook is a template, with one template for each supported element type:
Blockquotes Code blocks Headings Images Links Passthrough elements Tables Hugo supports multiple [content formats] including Markdown, HTML, AsciiDoc, Emacs Org Mode, Pandoc, and reStructuredText.
The render hook capability is limited to Markdown. You cannot create render hooks for the other content formats.
For example, consider this Markdown:
...
Context # Blockquote render hook templates receive the following [context]:
AlertType # (string) Applicable when Type is alert, this is the alert type converted to lowercase. See the alerts section below.
AlertTitle # (template.HTML) Applicable when Type is alert, this is the alert title. See the alerts section below.
AlertSign # (string) Applicable when Type is alert, this is the alert sign. Typically used to indicate whether an alert is graphically foldable, this is one of +, -, or an empty string.
...
Markdown # This Markdown example contains a fenced code block:
content/example.md ```bash {class="my-class" id="my-codeblock" lineNos=inline tabWidth=2} declare a=1 echo "$a" exit ``` A fenced code block consists of:
A leading [code fence] An optional [info string] A code sample A trailing code fence In the previous example, the info string contains:
The language of the code sample (the first word) An optional space-delimited or comma-delimited list of attributes (everything within braces) The attributes in the info string can be generic attributes or highlighting options.
...
Context # Heading render hook templates receive the following [context]:
Anchor # (string) The id attribute of the heading element.
Attributes # (map) The [Markdown attributes], available if you configure your site as follows:
hugo. yaml toml json markup: goldmark: parser: attribute: title: true [markup] [markup.goldmark] [markup.goldmark.parser] [markup.goldmark.parser.attribute] title = true { "markup": { "goldmark": { "parser": { "attribute": { "title": true } } } } } Level # (int) The heading level, 1 through 6.
...
Markdown # A Markdown image has three components: the image description, the image destination, and optionally the image title.
 ------------ ------------------ --------- description destination title These components are passed into the render hook [context] as shown below.
Context # Image render hook templates receive the following context:
Attributes # (map) The [Markdown attributes], available if you configure your site as follows:
hugo. yaml toml json markup: goldmark: parser: attribute: block: true wrapStandAloneImageWithinParagraph: false [markup] [markup.
...
Markdown # A Markdown link has three components: the link text, the link destination, and optionally the link title.
[Post 1](/posts/post-1 "My first post") ------ ------------- ------------- text destination title These components are passed into the render hook [context] as shown below.
Context # Link render hook templates receive the following context:
Destination # (string) The link destination.
Page # (page) A reference to the current page.
PageInner # (page) A reference to a page nested via the [RenderShortcodes] method.
...
Overview # Hugo uses [Goldmark] to render Markdown to HTML. Goldmark supports custom extensions to extend its core functionality. The Goldmark [passthrough extension] captures and preserves raw Markdown within delimited snippets of text, including the delimiters themselves. These are known as passthrough elements.
Depending on your choice of delimiters, Hugo will classify a passthrough element as either block or inline. Consider this contrived example:
content/sample.md This is a \[block\] passthrough element with opening and closing block delimiters.
...
Context # Table render hook templates receive the following [context]:
Attributes # (map) The [Markdown attributes], available if you configure your site as follows:
hugo. yaml toml json markup: goldmark: parser: attribute: block: true [markup] [markup.goldmark] [markup.goldmark.parser] [markup.goldmark.parser.attribute] block = true { "markup": { "goldmark": { "parser": { "attribute": { "block": true } } } } } Ordinal # (int) The zero-based ordinal of the table on the page.
...