feat(md-print): use mm font and corner page numbers

Body font size is now specified in millimetres and defaults to 3mm. Page numbers move from the centre footer to the outer bottom corners, alternating left and right per A5 page.
This commit is contained in:
2026-10-23 11:28:22 +08:00
parent 80da5364e5
commit 1ce76dca64
12 changed files with 60 additions and 34 deletions
+10 -2
View File
@@ -90,7 +90,15 @@ export function PrintPreview(props: PrintPreviewProps) {
const result = paginate(source, options(), mount);
result.pages.forEach((page, index) => {
const footer = page.querySelector(".md-print-footer");
if (footer) footer.textContent = `${index + 1} / ${result.pages.length}`;
if (footer) {
footer.textContent = `${index + 1} / ${result.pages.length}`;
// Left A5 gets the left corner, right A5 gets the right corner.
footer.classList.add(
index % 2 === 0
? "md-print-footer--left"
: "md-print-footer--right",
);
}
});
setPages(result.pages);
setWarnings(result.warnings);
@@ -224,7 +232,7 @@ export function PrintPreview(props: PrintPreviewProps) {
class="md-print-content prose"
style={{
width: `${columnWidthMm(props.config)}mm`,
"--md-print-font-size": `${props.config.font}pt`,
"--md-print-font-size": `${props.config.font}mm`,
position: "absolute",
left: "-99999px",
top: "0",