htmlliquid

Show html with format in Liquid


I've been looking for a while for a solution to what I want to achieve.

What I want is to insert some html text into a Liquid html file, for example I have some HTML text I received and use it as a variable in my code.

Here is a snippet of what I want to achieve:

{% assign name = "<b>liquid</b>" %}

 {{ name }} 

I have a var name with a HTML string in it, and i want to show it as:

liquid

but instead, all I get is <b.>liquid<./b> (without dots, I'm still new posting here).

I know that "strip_html" exists so HTML tags are removed and I keep the text, but I want to keep the HTML format from the string.

Is it even possible? Thanks!


Solution

  • I just had to put the html part inside a capture tag. With the example above it would be like:

    {% capture name %} <b>liquid</b> {% endcapture %}

    And it works, the html is correctly displayed. Thanks to Tasawer Khan for the answer! I hope it's useful for someone else.