CSS for numbered headers in live-preview?

Hey,

I’m trying to write a css file to show numbered headings in live-preview mode. Right now, I have some code that works for the usual preview mode, but not in live-preview

body {counter-reset: h1 h2 h3 h4 h5 h6}
h1 {counter-reset: h2}
h2 {counter-reset: h3}
h3 {counter-reset: h4}
h4 {counter-reset: h5}
h5 {counter-reset: h6}
h2:before {counter-increment: h2; content: counter(h2) ". "}
h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "}
h4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "}
h5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
h6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". " }
h1.nocount:before, h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before {content: ""; counter-increment: none} 

Things I have tried

I have tried changing it by using various forms of .cm-s-obsidian span.cm-formatting-header, without success. Any help would be greatly appreciated.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.