Data provided to getJSON: items:\r\nitem1\r\nitem2\r\nitem3
Data renders as this:
items: item1 item2 item3
I would like it to render as this:
items:
item1
item2
item3
I guess I don’t know how to make sure that the regex isn’t escaped.
Piping getJSON to safeHTML didn’t help. I get an error the following error: <safeHTML>: wrong type for value; expected string; got map[string]interface {}
No matter how I try to display the data, it’s always filtered.
If you have any other ways to accomplish what I am trying to render, I’d like to hear it.
I realized my error. This is not a problem with Hugo or Go templates. I was not aware regular expressions were ignored/filtered in HTML.
I am working around this by providing Hugo with HTML in that JSON field, instead of plain text or markdown. It’s actually a better solution than what I was trying.
That’s just the relevant field. The JSON is formatted properly. I just misunderstood how that field’s data is rendered in HTML. Thanks anyway!