Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default HR styling from background-color to border-top #10535

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

nathanlesage
Copy link
Contributor

Hi all,

I propose to change the way horizontal rules are styled in HTML exports from applying a background-color to using border-top. This change does not affect how they are displayed; so all exports will still look like before.

However, this way, horizontal rules will be printed out if someone decides to save a document exported to HTML to PDF or print it.

Why?

I just had a user mentioning that, if you use a horizontal rule in a document, export it to HTML and then print it, the horizontal rule doesn't show up (see Zettlr/Zettlr#5562). After some fiddling around, I found that in the styles section, Pandoc applies a background instead of a border color. By default, every browser will not print backgrounds to save toner/ink, which applies even if someone wants to save down a PDF file.

In my specific case, it affects the way Zettlr's "Simple PDF" exporter works (which literally exports to HTML and then "prints" it using Chromium's HTML-to-PDF converter), but I believe that changing this will yield benefits for anyone using Pandoc to export to HTML. In addition, using a border color rather than a background color brings horizontal rule styling closer to how these elements are styled by default in a browser (using borders, not backgrounds).

Caveats

This PR does not affect the way horizontal rules are displayed, only how browsers treat them during PDF export/printing.

However, I want to note that this PR would necessitate minimal changes to two other open PRs:

@jgm
Copy link
Owner

jgm commented Jan 14, 2025

Good idea.

@jgm jgm merged commit 0a2e8dd into jgm:main Jan 14, 2025
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants