Rendering HTML and Escape characters inside of text fields

I was wondering if it’s possible to parse HTML and new line characters contained within text fields returned by a query.

I feel like I got this to work when working at another company but forgot the approach I used. I also feel like articles existed for this at one point, but seem to have been purged/archived by the new Looker Community platform.

I tried this but to no avail:

  dimension: test {
    sql: '<b>some text</b>\nnew line' ;;
    html: <html>{{rendered_value}}</html> ;;
  }

The expected result would be:

some text
new line

However, what I get is this:

To get new lines working, I did the following which works:

  dimension: test {
    sql: '<b>some text</b>|new line' ;;
    html: 
      {% assign rows = {{value}} | split: '|' %} 
      {% for row in rows %}
        {{row}}<br>
      {% endfor %}
    ;;
  }
2 Likes