posthtml / posthtml-expressions

Use variables, JS-like expressions, and even markup-powered logic in your HTML.
Other
123 stars 20 forks source link

Can't render simple html inside an expression #141

Open andrew-dotson opened 1 year ago

andrew-dotson commented 1 year ago

Not sure why this does not work. I tried the {{{}}} option as well. I am kinda a new to this but was hoping someone could point me in the right direction...

{{text ? '<strong>yes</strong>': ''}}

am I missing something? it just shows written out in the browser instead of actually rendering the html.

cossssmin commented 1 year ago

Use triple braces {{{text ? '<strong>yes</strong>': ''}}} to unescape the tags.

andrew-dotson commented 1 year ago

@cossssmin Hmm for some reason that does not work for me, is there any options that need to be set? I am using parcel and a posthtmlrc file. For some reason anytime I include html in a string it does not work, but everything else does...

Different example: {{{'<strong>yes</strong>'}}}

The above example literally just shows {{{'<strong>yes</strong>'}}} in the browser window.

But when I remove the strong tags everything works like normal and it doesn't show the "{{{" in the browser.