Skip to content

remove css warning on weasyprint#11606

Merged
jgm merged 1 commit into
jgm:mainfrom
kbrock:screen-scope-columns-css
May 2, 2026
Merged

remove css warning on weasyprint#11606
jgm merged 1 commit into
jgm:mainfrom
kbrock:screen-scope-columns-css

Conversation

@kbrock
Copy link
Copy Markdown
Contributor

@kbrock kbrock commented May 1, 2026

Issue

Styles unconditionally emits css that uses screen-only properties. Paged-media engines (weasyprint, prince, pagedjs) have no viewport and complain. Fix it to hide these properties from the engines.

Before

Building any document with pandoc --pdf-engine=weasyprint prints:

WARNING: Ignored `gap: min(4vw, 1.5em)` at 6:32, invalid value.
WARNING: Ignored `overflow-x: auto` at 7:28, unknown property.

After

Same two rules, wrapped in @media screen { ... }. HTML browsers render identically. Print engines skip the block, no warnings.

Fixes: #11524

@jgm
Copy link
Copy Markdown
Owner

jgm commented May 1, 2026

make TESTARGS=--accept will regenerate the tests; you should carefully check any changes.

@jgm
Copy link
Copy Markdown
Owner

jgm commented May 1, 2026

If I understand correctly, it's the use of the vw dimension that makes this screen-only.
So maybe with non-screen viewers we should just specify 1.5em unconditionally, rather than min(4vw, 1.5em). Otherwise we lose the gap between columns, which we should keep.

Issue
-----
Styles unconditionally emits css that uses screen-only properties.
Paged-media engines (weasyprint, prince, pagedjs) have no viewport
and complain. Fix it to hide these properties from the engines.

Before
------
Building any document with `pandoc --pdf-engine=weasyprint` prints:

    WARNING: Ignored `gap: min(4vw, 1.5em)` at 6:32, invalid value.
    WARNING: Ignored `overflow-x: auto` at 7:28, unknown property.

After
-----
Same two rules, wrapped in `@media screen { ... }`. HTML browsers
render identically. Print engines skip the block, no warnings.

Fixes: jgm#11524
@kbrock kbrock force-pushed the screen-scope-columns-css branch from b2f5413 to 1fbf0ea Compare May 2, 2026 10:27
@jgm jgm merged commit 2b5600f into jgm:main May 2, 2026
7 of 10 checks passed
@jgm
Copy link
Copy Markdown
Owner

jgm commented May 2, 2026

thanks!

@kbrock kbrock deleted the screen-scope-columns-css branch May 2, 2026 20:23
@kbrock
Copy link
Copy Markdown
Contributor Author

kbrock commented May 2, 2026

Thank you @jgm
Really appreciate pandoc. Also appreciate your attention to detail.

have a great weekend

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.

Default inline HTML CSS emits avoidable WeasyPrint warnings (while syntax-highlighted PDF output is otherwise fine)

2 participants