hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

RenderString.md (1325B)

    1 ---
    2 title: .RenderString
    3 description: "Renders markup to HTML."
    4 date: 2019-12-18
    5 categories: [functions]
    6 menu:
    7   docs:
    8     parent: "functions"
    9 keywords: [markdown,goldmark,render]
   10 signature: [".RenderString MARKUP"]
   11 ---
   12 
   13 {{< new-in "0.62.0" >}} 
   14 
   15 `.RenderString` is a method on `Page` that renders some markup to HTML using the content renderer defined for that page (if not set in the options).
   16 
   17 *Note* that this method does not parse and render shortcodes.
   18 
   19 The method takes an optional map argument with these options:
   20 
   21 display ("inline")
   22 : `inline` or `block`. If `inline` (default), surrounding `<p></p>` on short snippets will be trimmed.
   23 
   24 markup (defaults to the Page's markup)
   25 : See identifiers in [List of content formats](/content-management/formats/#list-of-content-formats).
   26 
   27 Some examples:
   28 
   29 ```go-html-template
   30 {{ $optBlock := dict "display" "block" }}
   31 {{ $optOrg := dict "markup" "org" }}
   32 {{ "**Bold Markdown**" | $p.RenderString }}
   33 {{  "**Bold Block Markdown**" | $p.RenderString  $optBlock }}
   34 {{  "/italic org mode/" | $p.RenderString  $optOrg }}
   35 ```
   36 
   37 
   38 **Note** that this method is more powerful than the similar [markdownify](/functions/markdownify/) function as it also supports [Render Hooks](/getting-started/configuration-markup/#markdown-render-hooks) and it has options to render other markup formats.