Skip to content

md2any 0.3.0 — math rendering overhaul, rendering robustness, docs & crate polish#1

Merged
JavaPerformance merged 6 commits into
mainfrom
feat/math-rendering-0.3.0
Jun 14, 2026
Merged

md2any 0.3.0 — math rendering overhaul, rendering robustness, docs & crate polish#1
JavaPerformance merged 6 commits into
mainfrom
feat/math-rendering-0.3.0

Conversation

@JavaPerformance

Copy link
Copy Markdown
Owner

Summary

A math-rendering and robustness release, bumping to 0.3.0.

Math engine

  • Font-aware glyph metrics via a GlyphMetrics provider — the layout measures advances against the face that will actually render them (embedded PDF font, or bundled DejaVu for SVG/PNG), so equations stay aligned under --pdf-font.
  • Real math bold (\mathbf, \boldsymbol, \bm, \pmb, \mathbfit); fixes the \boldsymbol literal-leak.
  • Accents (\bar, \hat, \vec, \tilde, \dot, \ddot) drawn as centred geometry instead of mis-placed zero-advance combining marks (e.g. \bar{d} → "đ").
  • Recognise \dfrac/\tfrac/\cfrac and \mid/\vert/\Vert (were leaking source).

PDF font embedding

  • Emit CIDFontType0 + FontFile3 for CFF/OpenType faces (e.g. STIX Two Math) instead of mislabelling them TrueType, which strict readers rejected.

Rendering fixes (from a full torture sweep)

  • Long titles (all layouts) and section dividers auto-shrink to fit; wrapped content headings push the body down instead of overprinting.
  • GFM table column alignment (:---:, ---:) honoured in PDF/SVG/PNG/HTML.
  • Inline <svg> rasterised instead of dropped.
  • Tabs in code expand to tab stops (no more notdef boxes).
  • Nested blockquotes keep every level; long unbreakable tokens hard-break.
  • {width=N%}>100 clamps; ::: fence columns handle leading/duplicate dividers; task-list items show only their checkbox; display-math pagination weights equations by aspect ratio.

Docs & crate

  • README gallery (content/code/table montage + a "Native math" section with the equation montage and the full Standard Model Lagrangian); honest RTL/CJK/Office-alignment limitations.
  • CHANGELOG [0.3.0]; cargo doc warning-free.
  • Published crate trimmed 8.9 MB → 4.9 MB; cargo publish --dry-run build-verifies the package.

Tests

80 tests pass (incl. new regressions for metrics, bold, accents, CFF detection, table alignment, tabs, inline SVG, nested quotes, width clamp, fence columns, math pagination). cargo fmt clean, 0 clippy errors.

Known limitations (documented)

RTL has no full bidi reordering; CJK/emoji need --cjk for PDF; Office/ODF outputs don't carry table alignment yet.

web-flow added 6 commits June 14, 2026 14:27
Math engine:
- Font-aware glyph metrics via a GlyphMetrics provider: the layout measures
  advances against the face that will render them (embedded PDF font, or
  bundled DejaVu for SVG/PNG), so equations stay aligned under --pdf-font.
- Real math bold (\mathbf, \boldsymbol, \bm, \pmb, \mathbfit); fixes the
  \boldsymbol literal-leak.
- Accents (\bar, \hat, \vec, \tilde, \dot, \ddot) drawn as centred geometry
  instead of zero-advance combining marks (which mis-placed per font, e.g.
  \bar{d} -> "đ").
- Recognise \dfrac/\tfrac/\cfrac and \mid/\vert/\Vert (were leaking source).

PDF font embedding:
- Emit CIDFontType0 + FontFile3 for CFF/OpenType faces (e.g. STIX Two Math)
  instead of mislabelling them as TrueType.

Rendering fixes:
- GFM table column alignment (:---:, ---:) honoured in PDF/SVG/PNG/HTML.
- Title slides (all layouts) and section dividers auto-shrink to fit; wrapped
  content headings push the body/underline down instead of overprinting.
- Inline <svg> rasterised as an image instead of being dropped.
- Tabs in code expand to 4-column tab stops (no more notdef boxes).
- {width=N%} clamps instead of leaking literal attribute text.
- ::: columns handle leading/trailing/duplicate dividers (fence form).
- Task-list items show only their checkbox, not a bullet too.
- Display-math pagination weights equation images by aspect ratio so a
  one-line equation no longer splits onto a near-empty continuation slide.
- Add examples/famous-equations.md — a wall of famous equations (Euler,
  E=mc^2, Lorentz, Schrodinger, Dirac, field equations, Bayes, Boltzmann,
  Basel), set for STIX via --pdf-font.
- Consolidate the Standard Model Lagrangian onto a single -a4.md source,
  dropping the older markup/selectable/plain variants.
…o 0.3.0

- CHANGELOG: new [0.3.0] section (Added / Fixed / Known limitations).
- README: correct the RTL/CJK claim (no full bidi; CJK needs --cjk), add
  task lists, table alignment, inline SVG, math bold/accents, and
  font-aware/OTF math metrics to the feature table.
- docs/torture-test-findings.md: tracked findings from the rendering sweep
  with per-item status.
- Bump version 0.2.0 -> 0.3.0.
- Nested blockquotes (`>`/`>>`/`>>>`) keep every level: the quote accumulator
  now resets only on the outermost quote instead of on every nested open,
  which had dropped all but the deepest level.
- Long unbreakable tokens (URLs, hashes, CamelCase) hard-break to fit the line
  instead of overflowing the slide edge: PDF (wrap_text_simple / wrap_runs) and
  SVG (wrap_text) break over-long tokens into character chunks; HTML adds
  `overflow-wrap: anywhere`.
- Add docs/img/{slides,equations,lagrangian}.png and embed a gallery in the
  README: a content/code/table montage at the top, a "Native math" section
  with the equation montage (STIX) and the full Standard Model Lagrangian.
- Note the RTL (no full bidi) and Office table-alignment limitations honestly.
- CHANGELOG: add nested-blockquote and long-token-overflow fixes to [0.3.0].
- Update the torture-test findings tracker (M1/M2 done).
- Exclude the binary manual formats (docs/manual, ~1.2 MB — HELP.md already
  carries the text) and orphan pre-rendered sample PNGs from the published
  package: the crate drops from ~8.9 MB to ~5 MB while keeping the embedded
  fonts, README gallery, examples, and licenses.
- Tidy the .gitignore editor-dir list.
@JavaPerformance
JavaPerformance merged commit 0f25d65 into main Jun 14, 2026
5 checks passed
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.

2 participants