Skip to content

feat: YAML frontmatter support, blank page fix, code alignment, and uv runner#8

Open
Hunter-Leo wants to merge 2 commits intolovstudio:mainfrom
Hunter-Leo:fix/frontmatter-and-pdf-layout
Open

feat: YAML frontmatter support, blank page fix, code alignment, and uv runner#8
Hunter-Leo wants to merge 2 commits intolovstudio:mainfrom
Hunter-Leo:fix/frontmatter-and-pdf-layout

Conversation

@Hunter-Leo
Copy link
Copy Markdown

Summary

  • YAML frontmatter support: All document metadata (title, author, theme, watermark, etc.) can now be embedded directly in the markdown file via a --- ... --- block, making documents self-contained and reproducible with a minimal command (--input only). CLI args always take precedence.
  • Blank page fix: When a cover is present and the markdown has a # H1 heading, all visual elements generated by that heading are stripped to prevent a duplicate/blank title page. The ChapterMark is kept so TOC anchors remain valid.
  • Header title fix: Page header right side now shows the fixed document title instead of _cur_chapter[0], which caused a one-page lag due to reportlab's onPage callback timing.
  • Code block alignment fix: esc_code() now replaces all spaces (not just leading) with  , preserving mid-line alignment in ASCII diagrams and padded columns.
  • H2 spacer reduction: Chapter opener spacer changed from body_h * 0.30 (~74mm) to a fixed 8mm for technical reports.
  • uv runner: SKILL.md and docs updated to recommend uv run --with reportlab as the preferred zero-install invocation.

Test plan

  • Convert a markdown file with frontmatter — verify metadata appears on cover without passing CLI args
  • Convert a markdown file with # H1 + cover — verify no blank page between TOC and first ## chapter
  • Check page headers show document title consistently across all pages
  • Verify code blocks with ASCII diagrams / padded columns render with correct alignment
  • Run with uv run --with reportlab — verify no pip install required

FightingLee97 and others added 2 commits April 17, 2026 13:07
- Parse YAML frontmatter (--- ... ---) from markdown top: title, subtitle,
  author, date, version, theme, watermark, footer-left, copyright, and all
  other CLI params. CLI args take precedence over frontmatter values.
- Strip H1 visual elements (Spacer, Paragraph, decorations) when a cover
  title is provided, keeping ChapterMark for TOC anchor links. Prevents
  duplicate title page and blank page after TOC.
- Replace dynamic _cur_chapter[0] in top-band and full header with fixed
  doc title to avoid reportlab onPage timing offset (chapter name always
  lagged one page behind actual content).
- Fix code block mid-line space collapsing: replace all spaces with  
  in esc_code() to preserve ASCII diagrams and padded column alignment.
- Reduce H2 chapter spacer from 30% page height to 8mm for manual/report
  style documents (avoids large whitespace at top of each chapter page).
- Rewrite Pre-Conversion section into 3-step workflow: inspect MD,
  ask options, write frontmatter directly into the file
- Promote YAML frontmatter as the primary config method over CLI args
- Add uv-first invocation in Quick Start and Dependencies sections
- Add Frontmatter Support section with full key reference table
- Bump version to 1.1.0; replace example title placeholder

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant