diff --git a/pandoc/viewer-template.html b/pandoc/viewer-template.html
index eaf5464..f64acd8 100644
--- a/pandoc/viewer-template.html
+++ b/pandoc/viewer-template.html
@@ -577,17 +577,33 @@ th, td {
}
/* Layout adjustments */
+ html, body {
+ width: 100% !important;
+ max-width: 100% !important;
+ margin: 0 !important;
+ }
+
.app-container {
display: block !important;
+ width: 100% !important;
+ max-width: 100% !important;
}
-
+
.content-wrapper {
margin-left: 0 !important;
width: 100% !important;
+ /* The screen layout caps content-wrapper at 900px; in print, the
+ printable area is page-width minus @page margins (~6.5in =
+ ~624px for letter at 96dpi), which is narrower than 900px BUT
+ chromium's --print-to-pdf renders at the full page width and
+ only clips at print time — so without max-width:none the
+ element extends past the right margin. */
+ max-width: none !important;
}
.content-page {
max-width: none !important;
+ width: 100% !important;
padding: 0 !important;
}
@@ -597,6 +613,25 @@ th, td {
padding: 0 0.5in !important;
border-left: none !important;
min-height: calc(100vh - 130pt) !important;
+ max-width: 100% !important;
+ box-sizing: border-box !important;
+ }
+
+ /* Wide content that wouldn't otherwise wrap: tables, code blocks,
+ long URLs in inline code. Force them to stay within the
+ printable area instead of running off the right edge. */
+ pre, code, table, blockquote, img, video {
+ max-width: 100% !important;
+ overflow-wrap: break-word !important;
+ word-wrap: break-word !important;
+ }
+ pre {
+ white-space: pre-wrap !important;
+ word-break: break-word !important;
+ }
+ table {
+ table-layout: fixed !important;
+ width: 100% !important;
}
/* Fix list formatting in print */
diff --git a/zddc/internal/convert/viewer-template.html b/zddc/internal/convert/viewer-template.html
index eaf5464..f64acd8 100644
--- a/zddc/internal/convert/viewer-template.html
+++ b/zddc/internal/convert/viewer-template.html
@@ -577,17 +577,33 @@ th, td {
}
/* Layout adjustments */
+ html, body {
+ width: 100% !important;
+ max-width: 100% !important;
+ margin: 0 !important;
+ }
+
.app-container {
display: block !important;
+ width: 100% !important;
+ max-width: 100% !important;
}
-
+
.content-wrapper {
margin-left: 0 !important;
width: 100% !important;
+ /* The screen layout caps content-wrapper at 900px; in print, the
+ printable area is page-width minus @page margins (~6.5in =
+ ~624px for letter at 96dpi), which is narrower than 900px BUT
+ chromium's --print-to-pdf renders at the full page width and
+ only clips at print time — so without max-width:none the
+ element extends past the right margin. */
+ max-width: none !important;
}
.content-page {
max-width: none !important;
+ width: 100% !important;
padding: 0 !important;
}
@@ -597,6 +613,25 @@ th, td {
padding: 0 0.5in !important;
border-left: none !important;
min-height: calc(100vh - 130pt) !important;
+ max-width: 100% !important;
+ box-sizing: border-box !important;
+ }
+
+ /* Wide content that wouldn't otherwise wrap: tables, code blocks,
+ long URLs in inline code. Force them to stay within the
+ printable area instead of running off the right edge. */
+ pre, code, table, blockquote, img, video {
+ max-width: 100% !important;
+ overflow-wrap: break-word !important;
+ word-wrap: break-word !important;
+ }
+ pre {
+ white-space: pre-wrap !important;
+ word-break: break-word !important;
+ }
+ table {
+ table-layout: fixed !important;
+ width: 100% !important;
}
/* Fix list formatting in print */