Format rich text in template

Hi,

I am generating a report and need to add there a value that is created with the Rich text editor. The output within my pdf is a text with some HTML tags (<p <br…)

Is there any way to tell the template to treat the value of the variable as an HTML code instead of a text?

[edit]
I have tried to skip the Rich text and just stay with the multiline, but all lines end up in a single line.

I was trying to do something similar a few days back but I wasn’t able to find out how to trick the templating engine in not escaping HTML (from the user interface that is).
I’ll take another look next week to see if I can put together a better reply then this.

In the mean time, if you’re only using rich text editor for the sake of preserving new lines, you could try to…

  1. use a multi-value String field
  2. use a loop in the template to handle each row (so you can wrap it in a paragraph/list).

A loop would look like this:

{{range $index, $element := .ListOfItems}}

{{end}}

This should do the trick for now

1 Like