Page 1 of 1

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
by NourEdinDarwish
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:
  1. 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.
  2. 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.
Currently, my only workaround is to insert multiple separate Notice items sequentially into the results, but this is visually clunky.

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!

Re: Notice ignores newlines (\n) due to frontend CSS and HTML sanitization - any workarounds to allow multi-line notices

Posted: Sat Feb 21, 2026 4:57 am
by vjalby
You may also use a "type: Html" result element. Content may include css to format the notice the way you want.

Code: Select all

    
    - name:  htmlNotice
      title: "My Notice"
      type:  Html
      visible: true
      content: "line 1<br />line2"

Re: Notice ignores newlines (\n) due to frontend CSS and HTML sanitization - any workarounds to allow multi-line notices

Posted: Sun Feb 22, 2026 2:53 am
by jonathon
let us take a look at this ... we really want to discourage people from using the Html element as much as possible.

jonathon