`calc` in margins not handled correctly
It seems, calc
isn't supported in the calculation of margins:
@page {
/* Handled correctly */
margin-top: 4.5rem;
/* Handled incorrectly */
margin-top: calc(4rem + 0.5rem)
}
After looking at the margin height, the height seems to be set to 1in
in the second case.
I'd expect this to be handled correctly, or to fail completely.
The docs don't mention calc
, so I expected that calc
is supported.
I guess, paged.js
expects a "number + unit" value to calculate the margin size, and fails with everything else, in which case it falls back to the default value.
A potential solution would be, to mention this in the docs (I guess evaluating arbitrage CSS expressions is out-of-scope at the moment).
My workaround (because I use PostCSS) is, to use the PostCSS calc plugin, which evaluates calc
at CSS compile-time.
In theory, paged.js
could switch to using PostCSS, which most likely would bring other benefits and enable easier implementation of other missing features.