diff options
Diffstat (limited to 'docs/content/en/functions/markdownify.md')
-rw-r--r-- | docs/content/en/functions/markdownify.md | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/docs/content/en/functions/markdownify.md b/docs/content/en/functions/markdownify.md index 8d8726cff..9f1f3329e 100644 --- a/docs/content/en/functions/markdownify.md +++ b/docs/content/en/functions/markdownify.md @@ -1,29 +1,30 @@ --- title: markdownify -linktitle: markdownify -description: Runs the provided string through the Markdown processor. -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2023-02-09 +description: Renders markdown to HTML. keywords: [markdown,content] categories: [functions] menu: docs: - parent: "functions" + parent: functions signature: ["markdownify INPUT"] -workson: [] -hugoversion: relatedfuncs: [] -deprecated: false -aliases: [] --- - -``` +```go-html-template {{ .Title | markdownify }} ``` -{{< new-in "0.93.0" >}} **Note**: `markdownify` now supports [Render Hooks] just like [`.Page.RenderString`]. However, if you use more complicated [Render Hooks] relying on page context, use [`.Page.RenderString`] instead. See [GitHub issue #9692](https://github.com/gohugoio/hugo/issues/9692) for more details. +If the resulting HTML is a single paragraph, Hugo removes the wrapping `p` tags to produce inline HTML as required per the example above. + +To keep the wrapping `p` tags for a single paragraph, use the [`.Page.RenderString`] method, setting the `display` option to `block`. + +If the resulting HTML is two or more paragraphs, Hugo leaves the wrapping `p` tags in place. -[Render Hooks]: /templates/render-hooks/ [`.Page.RenderString`]: /functions/renderstring/ + +{{% note %}} +Although the `markdownify` function honors [markdown render hooks] when rendering markdown to HTML, use the `.Page.RenderString` method instead of `markdownify` if a render hook accesses `.Page` context. See issue [#9692] for details. + +[markdown render hooks]: /templates/render-hooks/ +[#9692]: https://github.com/gohugoio/hugo/issues/9692 +{{% /note %}} |