Files
dotfiles/bin/md2pdf.css
T
Eric Wagoner 157336d9a8 Add md2pdf: Markdown-to-PDF CLI with Finder Quick Action
- bin/md2pdf: converts .md to PDF via pandoc + headless Chrome
  (no LaTeX needed); writes alongside source, supports -o and --css
- bin/md2pdf.css: clean GitHub-style default stylesheet
- bin/md2pdf-install-quickaction: installs the Finder right-click action
- macos/md2pdf.workflow: version-controlled Quick Action bundle
  (right-click .md files to Convert to PDF)
2026-08-27 12:49:44 -04:00

121 lines
2.7 KiB
CSS

/* md2pdf default stylesheet — clean, GitHub-flavored, print-friendly. */
@page {
margin: 2cm 1.9cm;
}
html {
font-size: 12pt;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
sans-serif;
line-height: 1.55;
color: #1f2328;
max-width: 46em;
margin: 0 auto;
padding: 0 0.5em;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
word-wrap: break-word;
}
/* --- Headings --- */
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
margin-bottom: 0.5em;
font-weight: 600;
line-height: 1.25;
}
h1 { font-size: 1.9em; border-bottom: 1px solid #d1d9e0; padding-bottom: 0.3em; }
h2 { font-size: 1.45em; border-bottom: 1px solid #d1d9e0; padding-bottom: 0.3em; }
h3 { font-size: 1.2em; }
h4 { font-size: 1em; }
h5 { font-size: 0.9em; }
h6 { font-size: 0.85em; color: #59636e; }
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
/* Keep a heading with the content that follows it. */
h1, h2, h3, h4, h5, h6 { break-after: avoid; }
/* --- Body elements --- */
p, ul, ol, dl, table, pre, blockquote { margin-top: 0; margin-bottom: 1em; }
a { color: #0969da; text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
ul, ol { padding-left: 2em; }
li + li { margin-top: 0.25em; }
li > ul, li > ol { margin-top: 0.25em; margin-bottom: 0; }
/* --- Code --- */
code, pre, kbd, samp {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
"Liberation Mono", monospace;
font-size: 0.88em;
}
code {
background-color: rgba(129, 139, 152, 0.15);
padding: 0.2em 0.4em;
border-radius: 6px;
}
pre {
background-color: #f6f8fa;
border: 1px solid #d1d9e0;
border-radius: 6px;
padding: 1em;
overflow: auto;
line-height: 1.45;
break-inside: avoid;
}
pre code {
background: transparent;
padding: 0;
border-radius: 0;
font-size: 100%;
white-space: pre;
}
/* --- Blockquotes --- */
blockquote {
margin-left: 0;
padding: 0 1em;
color: #59636e;
border-left: 0.25em solid #d1d9e0;
}
blockquote > :last-child { margin-bottom: 0; }
/* --- Tables --- */
table {
border-collapse: collapse;
width: 100%;
display: block;
overflow: auto;
break-inside: avoid;
}
th, td {
border: 1px solid #d1d9e0;
padding: 0.5em 0.85em;
text-align: left;
}
th { background-color: #f6f8fa; font-weight: 600; }
tr:nth-child(2n) td { background-color: #f6f8fa; }
/* --- Rules & images --- */
hr {
height: 1px;
border: 0;
background-color: #d1d9e0;
margin: 1.8em 0;
}
img { max-width: 100%; box-sizing: border-box; }
/* pandoc wraps the --metadata title in a header; keep it unobtrusive. */
header#title-block-header h1.title { margin-bottom: 0.8em; }