hugo/content/en/functions/RenderString.md
Bjørn Erik Pedersen acb9109df7 Squashed 'docs/' changes from ef9c4913c..d343ebf71
d343ebf71 Document ignoreImports
f912ea1cc Fix the github workflow (#1332)
617894052 Add site function
f3be651f9 Minor typo/markdown fixes (#1328)
7a95e9db5 Fix a formatting error for Github Actions (#1323)
260106669 Fix #1120 Use Github Action
d8847a144 docs: Fix HTML code in .RenderString description being stripped out (#1320)
7a67c38c4 Correct sitemap version (#1318)
6a163f53a Removed noise. (#1317)
b02902121 Fix a minor typo (#1314)
399c74acd Revert "js: Update shims setup"
77def8a8c Revert "Update js.md"
13aeb2c73 Update js.md
704987dc1 js: Update shims setup

git-subtree-dir: docs
git-subtree-split: d343ebf718393ea704da132de508db712f7bcb44
2021-02-18 17:52:49 +01:00

1.3 KiB

title description godocref date categories menu keywords signature
.RenderString Renders markup to HTML. 2019-12-18
functions
docs
parent
functions
markdown
goldmark
render
.RenderString MARKUP

{{< new-in "0.62.0" >}}

.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).

Note that this method does not parse and render shortcodes.

The method takes an optional map argument with these options:

display ("inline")
inline or block. If inline (default), surrounding <p></p> on short snippets will be trimmed.
markup (defaults to the Page's markup)
See identifiers in List of content formats.

Some examples:

{{ $optBlock := dict "display" "block" }}
{{ $optOrg := dict "markup" "org" }}
{{ "**Bold Markdown**" | $p.RenderString }}
{{  "**Bold Block Markdown**" | $p.RenderString  $optBlock }}
{{  "/italic org mode/" | $p.RenderString  $optOrg }}

Note that this method is more powerful than the similar markdownify function as it also supports Render Hooks and it has options to render other markup formats.