Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions make-pdf/src/print-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,14 @@ function tocRules(enabled: boolean): string {
` padding: 3pt 0;`,
`}`,
`.toc li .toc-title { flex: 0 0 auto; }`,
`.toc li .toc-dots { flex: 1 1 auto; border-bottom: 1px dotted #aaa; margin: 0 6pt; transform: translateY(-4pt); }`,
`.toc li .toc-page { flex: 0 0 auto; color: #666; font-variant-numeric: tabular-nums; }`,
// v1 ships without Paged.js, so target-counter never resolves and
// .toc-page stays empty — leader dots would trail into blank space.
// Hide both until page numbers actually exist; screenCss() already does
// the same for HTML output. Restore these two rules the day Paged.js
// lands and the spans get filled.
`.toc li .toc-dots, .toc li .toc-page { display: none; }`,
`.toc li.level-2 { padding-left: 0.35in; font-size: 11pt; }`,
`.toc li.level-3 { padding-left: 0.7in; font-size: 10.5pt; color: #555; }`,
`.toc li a { color: inherit; text-decoration: none; }`,
].join("\n");
}
Expand Down
4 changes: 3 additions & 1 deletion make-pdf/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ function buildTocBlock(html: string, ids: string[] = []): string {
if (headings.length === 0) return "";

const items = headings.map((h, i) => {
const level = h.level >= 2 ? "level-2" : "level-1";
// H3 gets its own class so sub-sections nest under their H2 instead of
// sitting at the same indent and reading as top-level peers.
const level = h.level >= 3 ? "level-3" : h.level === 2 ? "level-2" : "level-1";
const id = ids[i] ?? `toc-${i}`;
return [
` <li class="${level}">`,
Expand Down