Thanks for the tip regarding @media print {}. That works well to specify css that only affects PDF output.
However, that doesnāt solve the problem Iām seeing.
The issue is that export to PDF seems to be ignoring the cssclass: directive in the frontmatter. I can get regular css to appear in the PDF, e.g. h1 { color:green; }, but if I add a page-level class to the frontmatter using cssclass: it does not appear in the PDF.
Iāve attached a mini-vault that demonstrates the issue. To see it, unzip the vault and load it in Obsidian, and see that āRegular Pageā has black headers and āSpecial Pageā has green headers using the cssclass directive. Then export āSpecial Pageā to PDF and observe that the PDF headers are black, not green.
Just bumping this, because itās not just about @media print {} (and I should know this since Iām one of the only few people working on @media print{} in Obsidian at the moment.
the HTML for PDF renders drops CSSclasses (the cssclass here being cornell)
Unfortunately the lack of the css class applied to the .markdown-preview-view.markdown-rendered section means that people cannot print or export to PDF except what is already originally rendered in the original theme, which kinda defeats the entire purpose of CSS classes. For use cases, stuff like LaTeX rendered document printing cannot be supported in-house by a theme that usually doesnāt look like LaTeX, or things like clean-embeds cssclasses wonāt print as such.
if you see the second image from the previous post, .markdown-preview-view.markdown-rendered has .cornell appended to the back of it. This behaviour is not replicated in .print > .markdown-preview-view.markdown-rendered (first image)