I have a multi-line text field that I am rendering using scriban. the Field Content is an address

some building, some floor
some street
PO box somePOboxNumber

How can I render this field as uneditable in experience editor while keeping the line breaks intact?

I have tried sc_raw i_item "Address" and i_item.Address.raw but this renders the field as a string without the line breaks so the entire address shows in a single line.

Line breaks render correctly when I am using sc_field i_item "Address" but this is editable in experience editor.

Sitecore version: 10.1

1 Answer 1


If you have a multi-line text field with multiple lines in it, lines in the value of the field are separated with \r\n line endings. When you render them in html, they will never convert automatically into <br /> tags, which means they will not cause line breaks in html.

I can only assume that you have custom processor in renderField pipeline which converts line breaks into <br /> tags. And when you call i_item.Address.raw (which is the correct approach to what you need), that pipeline is not executed as you're using raw extension.

Standard approach here would be to use Rich Text field instead of multi-line field. That would just work without any customization when calling .raw method.

What you can try instead (if you cannot change the type of your field) is calling string.replace after .raw (see https://github.com/scriban/scriban/blob/master/doc/builtins.md#stringreplace ).

Something like this should do the trick, but I haven't tested it:

{{ i_item.Address.raw | string.replace "\r\n" "<br />" }}
  • I read somewhere that the multiline text field not rendering <br /> for line breaks was a bug in some versions of Sitecore which was fixed in version 9.3. Apparently, it does not work with Scriban as of now. Will check if there is any performance implications but {{ i_item.Address.raw | string.replace "\r\n" "<br />" }} worked. Thank you! ` did work
    – Shaurya
    Jan 27, 2022 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.