But what can I do when I want use <br>
in parameter/argument in my shortcode?
outputData = `Some long title with
<br>
line breaks
<br>
and see this breaks on the page.`
I see this <br>
like a normal text.
Do you have some solution for that?
Thanks!
Here’s a simple example…
markdown
{{< my-shortcode text="foo<br>bar<br>baz" >}}
layouts/shortcodes/my-shortcode.html
{{ .Get "text" | safeHTML }}
rendered HTML
foo<br>bar<br>baz
screen capture
2 Likes
egrep
3
One of the possible options is to create layouts/shortcodes/br.html
shortcode with the following content:
<br>
and following usage:
foo{{< br >}}bar{{< br >}}baz
Or, just create layouts/shortcodes/raw.html
with the following content:
{{ .Inner }}
and following usage:
{{<raw-html >}}
foo<br>bar<br>baz
{{< /raw-html >}}
bep
4
One other option would also be:
{{< my-shortcode text=`line1
line2
line3` >}}
And then:
{{ .Get "text" | .Page.RenderString }}
2 Likes
system
Closed
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.