Notice ignores newlines (\n) due to frontend CSS and HTML sanitization - any workarounds to allow multi-line notices?
Posted: Fri Feb 20, 2026 11:13 pm
Hi everyone,
I'm currently developing a Jamovi module using jmvtools and jmvcore, and I've run into an issue when trying to display multi-line text using a Notice element.
When I pass a string containing newline characters (\n) to setContent() in my R code, the newlines are ignored in the Jamovi UI and everything is rendered on a single line.
I took a peek at the Jamovi frontend source code to trace what was happening, and it seems there are two overlapping reasons preventing multi-line notices:
Is my understanding correct? and is there an existing or planned way to emit multi-line notices in Jamovi?
Thanks for your time and for the amazing software!
I'm currently developing a Jamovi module using jmvtools and jmvcore, and I've run into an issue when trying to display multi-line text using a Notice element.
When I pass a string containing newline characters (\n) to setContent() in my R code, the newlines are ignored in the Jamovi UI and everything is rendered on a single line.
I took a peek at the Jamovi frontend source code to trace what was happening, and it seems there are two overlapping reasons preventing multi-line notices:
- CSS Styling: The newline characters are successfully passed to the frontend via protobuf and injected via inner HTML, but the CSS selector for the notice content does not use "white-space: pre-wrap". Because of standard HTML rendering, the browser collapses the literal \n characters into single spaces.
- Strict HTML Sanitization: If I try to force a line break by passing an HTML tag from R, it gets intercepted by the localization and sanitization function. Since this function explicitly restricts allowed HTML tags to a hardcoded whitelist (i, em, b, strong, sub, sup), the
tag is escaped into <br> and printed as literal text.
Is my understanding correct? and is there an existing or planned way to emit multi-line notices in Jamovi?
Thanks for your time and for the amazing software!