I want all H2 headings that contain specific symbols (✎ ✄ ✑) to not wrap under when the note width shrinks. In other words, I want such headings to be always displayed as a single line no matter the editor width:
Problem: for Live Preview, this fails to match the desired behavior for headings with these symbols only. This makes it so that all H2 headings don’t wrap.
This line is the catch it all line, as it targets all the .cm-header-2 lines and ends the selector with the comma. So for starters try without this line.
In live preview none of the actual header text are copied into any of the attributes of the DOM elements. This means there is nothing for your CSS selector to grab a hold on. In reading mode the header text is copied into the data-heading attribute allowing for that to work.
So you’ll need to add something to your headings which you can target from CSS, and I’ve recently used tags for this purpose. One option could therefore be to use something like #no-wrap, and target the headings with .cm-header-2:has(.cm-tag-no-wrap) or similar. If you don’t like the visual appearance of the tag, you could just hide it using display: none for that tag.