Make 'Export to PDF' respect CSSClass

From here:

When exporting to PDF, the CSSClass is dropped:

(in print)
image

(versus in Obsidian - see the .markdown-preview-view portion)
image

On the latter, .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 (in the first image).

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 kind of defeats the entire purpose of CSS classes. In terms of 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.


This is evident in an PDF export of the document:
image
vs in Obsidian
image

The PDF export is similar to other documents exported using the Willemstad theme, although the point of the CSS Class is literally to ensure otherwise.

3 Likes