{{.Inner}} not working with iframe srcdoc?

I’ve been trying to make a shortcode for making an iframe with the text in between the shortcode

This is the shortcode and I want to insert any HTML in between.


But at the end I just end up with this:

Could you help me? Please.

Please provide a minimal repo that reproduces the issue you encountered.

Is is difficult to figure out what’s going from the above description.

The current Markdown processor does not render raw HTML by default.

In the project config enter:

unsafe= true

And see if that fixes your issue.

no it doesn’t fix it :((

with the unsafe I can place raw HTML in the markdown but not to pass it to the iframe srcdoc

You need to escape the HTML for it to be rendered in an attribute.


Change the contents of sandbox.html to:
<iframe {{ printf "srcdoc=%q" $inner | safeHTMLAttr }} frameborder="0" sandbox></iframe>

Am I doing something wrong? Because it doesn’t work on my side.

I found it’s working like this if anyone faces the same problem

<iframe srcdoc="{{ .Inner | safeHTMLAttr }}" frameborder="0" sandbox></iframe>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.