RenderString.md - hugo - [fork] hugo port for 9front
 (HTM) git clone https://git.drkhsh.at/hugo.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
       RenderString.md (1371B)
       ---
            1 ---
            2 title: RenderString
            3 description: Renders markup to HTML.
            4 categories: []
            5 keywords: []
            6 params:
            7   functions_and_methods:
            8     returnType: template.HTML
            9     signatures: ['PAGE.RenderString [OPTIONS] MARKUP']
           10 aliases: [/functions/renderstring]
           11 ---
           12 
           13 ```go-html-template
           14 {{ $s := "An *emphasized* word" }}
           15 {{ $s | .RenderString }} → An <em>emphasized</em> word
           16 ```
           17 
           18 This method takes an optional map of options:
           19 
           20 display
           21 : (`string`) Specify either `inline` or `block`. If `inline`, removes surrounding `p` tags from short snippets. Default is `inline`.
           22 
           23 markup
           24 : (`string`) Specify a [markup identifier] for the provided markup. Default is the `markup` front matter value, falling back to the value derived from the page's file extension.
           25 
           26 Render with the default markup renderer:
           27 
           28 ```go-html-template
           29 {{ $s := "An *emphasized* word" }}
           30 {{ $s | .RenderString }} → An <em>emphasized</em> word
           31 
           32 {{ $opts := dict "display" "block" }}
           33 {{ $s | .RenderString $opts }} → <p>An <em>emphasized</em> word</p>
           34 ```
           35 
           36 Render with [Pandoc]:
           37 
           38 ```go-html-template
           39 {{ $s := "H~2~O" }}
           40 
           41 {{ $opts := dict "markup" "pandoc" }}
           42 {{ $s | .RenderString $opts }} → H<sub>2</sub>O
           43 
           44 {{ $opts := dict "display" "block" "markup" "pandoc" }}
           45 {{ .RenderString $opts $s }} → <p>H<sub>2</sub>O</p>
           46 ```
           47 
           48 [markup identifier]: /content-management/formats/#classification
           49 [pandoc]: https://pandoc.org/