HUGO
Menu
GitHub 90206 stars Mastodon

transform.Markdownify

Returns the given Markdown rendered to HTML.
Syntax
transform.Markdownify INPUT
Returns
template.HTML
Alias
markdownify

Usage

The transform.Markdownify function returns the given Markdown rendered to HTML.

If the resulting HTML is a single paragraph, Hugo removes the wrapping p tags to produce inline HTML. To keep the wrapping p tags for a single paragraph, use the RenderString method on the Page object, setting the display option to block.

Although the transform.Markdownify function honors Markdown render hooks when rendering Markdown to HTML, use the RenderString method instead if a render hook accesses .Page context. See issue #9692 for details.

Examples

{{ transform.Markdownify "An *emphasized* word" }} → An <em>emphasized</em> word

Rendering a page title as inline HTML:

<h2>{{ .Title | transform.Markdownify }}</h2>