Skip to content

Rework PDF export: book typography, theme colors, own markdown renderer#585

Merged
Wavesonics merged 1 commit into
developfrom
claude/gracious-buck-aae118
Jun 11, 2026
Merged

Rework PDF export: book typography, theme colors, own markdown renderer#585
Wavesonics merged 1 commit into
developfrom
claude/gracious-buck-aae118

Conversation

@Wavesonics

Copy link
Copy Markdown
Owner

Summary

Replaces the pdfkmp-markdown module with our own markdown renderer (PdfProseMarkdown.kt) built on the same intellij-markdown engine the EPUB export uses (GFM flavour), giving the PDF export book typography that pdfkmp's markdown module could not express:

  • First-line paragraph indents on every paragraph, with no blank line between consecutive paragraphs — the indent is the separator. Rendered as a run of NBSPs since pdfkmp's layout engine has no indent primitive (swap for a real firstLineIndent if upstream grows one).
  • Roomier line spacing: 1.5x leading on body text, 1.25x on headings, plus dedicated gaps under chapter titles and in-chapter headings.
  • Project theme colors, mirroring the EPUB stylesheet: primary on the title page (with accent rule), contents, chapter headings, h1s, and links; secondary on h2s.

Also fixes for free, by virtue of the spec-compliant parser: backslash-escape handling (the stripBackslashEscapes workaround is gone) and PDF/EPUB now parse markdown with the same engine so the two exports cannot disagree on structure.

Testing

  • 17 new unit tests for the AST walker (PdfProseMarkdownTest), plus the existing export integration tests.
  • PdfProseVisualCheck (env-gated, skipped in CI) renders a sample PDF for eyeballing typography changes; output verified visually.

🤖 Generated with Claude Code

Better formatting now!
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 143 complexity · 0 duplication

Metric Results
Complexity 143
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Wavesonics Wavesonics merged commit 347baf8 into develop Jun 11, 2026
4 checks passed
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.84848% with 149 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.84%. Comparing base (0791954) to head (c058084).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #585      +/-   ##
===========================================
+ Coverage    52.78%   52.84%   +0.05%     
===========================================
  Files          440      441       +1     
  Lines        18491    18803     +312     
  Branches      2679     2794     +115     
===========================================
+ Hits          9761     9936     +175     
- Misses        7954     8041      +87     
- Partials       776      826      +50     
Components Coverage Δ
Client 53.98% <54.84%> (+0.05%) ⬆️
Server 50.70% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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