gstack/make-pdf
Jayesh Betala ced81536fe fix(make-pdf): stop content before the first H1 from forcing a blank page 1 (#1904)
`make-pdf` emitted a spurious blank/near-blank first page whenever any content
preceded the first <h1>. Two triggers:

1. YAML frontmatter — marked has no frontmatter awareness, so a leading
   `---\n...\n---` block rendered as a literal paragraph of body text.
2. A leading top-of-file <style> block — invisible, but still produced an
   empty first page.

Root cause: `wrapChaptersByH1()` wraps everything before the first <h1> in a
preamble `.chapter`. That section becomes `:first-of-type`, claiming the
`break-before: auto` exception, so the first *real* chapter inherits
`break-before: page` and starts on page 2. `preamble.trim().length > 0` was
true even when the preamble was only non-rendering markup.

Fix:
- Strip a leading YAML frontmatter block before `marked.parse` (anchored to the
  document start, so a `---` thematic break elsewhere is untouched).
- Don't give a non-rendering preamble (style/script/comment-only) its own
  chapter. Fold the markup into the first real chapter so its styling still
  applies but it no longer forces a page break.

Adds render-unit regression tests for both triggers, the "real text preamble
still gets its own chapter" invariant, and a non-frontmatter `---` thematic
break. All fail on main (2 chapters / leaked frontmatter), pass with the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 13:32:48 +05:30
..
src fix(make-pdf): stop content before the first H1 from forcing a blank page 1 (#1904) 2026-06-08 13:32:48 +05:30
test fix(make-pdf): stop content before the first H1 from forcing a blank page 1 (#1904) 2026-06-08 13:32:48 +05:30
SKILL.md v1.57.2.0 feat: AskUserQuestion prose fallback when the tool fails at runtime (#1908) 2026-06-07 21:38:21 -07:00
SKILL.md.tmpl v1.52.2.0 fix(make-pdf): render emoji instead of tofu (▯) on Linux (#1787) 2026-05-29 18:06:19 -07:00