Debian Codegraph @

docs/content/en/functions/transform/Markdownify.md

raw
1 ---
2 title: transform.Markdownify
3 description: Returns the given Markdown rendered to HTML.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: [markdownify]
9 returnType: template.HTML
10 signatures: [transform.Markdownify INPUT]
11 aliases: [/functions/markdownify]
12 ---
13
14 ```go-html-template
15 <h2>{{ .Title | markdownify }}</h2>
16 ```
17
18 If the resulting HTML is a single paragraph, Hugo removes the wrapping `p` tags to produce inline HTML as required per the example above.
19
20 To keep the wrapping `p` tags for a single paragraph, use the [`RenderString`][] method on the `Page` object, setting the `display` option to `block`.
21
22 > [!NOTE]
23 > Although the `markdownify` function honors [Markdown render hooks][] when rendering Markdown to HTML, use the `RenderString` method instead of `markdownify` if a render hook accesses `.Page` context. See issue [#9692][] for details.
24
25 [#9692]: https://github.com/gohugoio/hugo/issues/9692
26 [Markdown render hooks]: /render-hooks/
27 [`RenderString`]: /methods/page/renderstring/