I stumbled upon this question while checking out the forum’s most viewed posts.
Use case or problem
When I export to PDF natively via the Obsidian menu. I would like to have the pages breaking at the correct point of the content. Not during a paragraph or item.
Proposed solution
Insert a char for page breaks that the export to pdf feature adheres to.
I came up with a solution that might be useful, but unfortunately the topic was closed. So I open this new one.
The idea is to use the ---
markdown syntax (used to insert a horizontal rule), for this purpose.
You can add to .obsidian/snippets
the following snippet in a file called for example hrule-is-page-break.css
:
@media print {
hr {
visibility: hidden;
page-break-before: always;
}
}
If you activate this snippet in Obsdian Settings → Appearance, then the ---
is transformed into a page break when converting to pdf (it remains visible as a horizontal rule in Obsidian preview).
If you have other notes with horizontal rules and you want to print those “normally”, deactivate the snippet before exporting to pdf.