Skip to content

feat(parser): opt-in typographic smart punctuation#42

Merged
DemchaAV merged 1 commit into
developfrom
feat/smart-punctuation
Jul 1, 2026
Merged

feat(parser): opt-in typographic smart punctuation#42
DemchaAV merged 1 commit into
developfrom
feat/smart-punctuation

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Stacked on #41#40#39 — merge in order; this is the top of the stack.

Why

Tier 3 typographic polish from the roadmap: print-quality documents want real dashes, ellipses and curly quotes. Opt-in because GitHub does not smart-quote — default output stays byte-identical.

What changed

  • MarkdownComposer.builder().smartPunctuation(true) enables flexmark-ext-typographic on the parser.
  • Mapper handles TypographicSmarts (— – …) and TypographicQuotes (curly marks around mapped children, so "a **bold** word" keeps its bold) by riding the existing HTML-entity decoder; curly-quote/guillemet entities added.
  • Code spans and code blocks stay verbatim (flexmark guarantee, pinned by test).
  • Note: superscript/subscript from the same roadmap line was not built — verified engine-gated (no baseline shift on engine text runs); recorded in the private roadmap.

Verification

./mvnw clean verify javadoc:javadocBUILD SUCCESS, 173 tests, 0 failures. New: replacements on; off-by-default literal; code immunity with the flag on; formatting-inside-quotes.

@DemchaAV DemchaAV force-pushed the feat/smart-punctuation branch from 3f6f625 to bd496ea Compare July 1, 2026 22:29
@DemchaAV DemchaAV changed the base branch from feat/book-toc to develop July 1, 2026 22:42
MarkdownComposer.builder().smartPunctuation(true) enables flexmark-ext-typographic: straight quotes become curly quotes (nested formatting inside the quotes survives via TypographicQuotes flattening in the mapper), -- an en-dash, --- an em-dash, ... an ellipsis. Off by default — GitHub does not smart-quote, so default output is byte-identical — and code spans/blocks stay verbatim. Replacement characters ride the existing HTML-entity decoder; curly-quote and guillemet entities added to NAMED_ENTITIES. Tests: replacements on, literal off-by-default, code immunity, bold-inside-quotes. Suite green (173).
@DemchaAV DemchaAV force-pushed the feat/smart-punctuation branch from bd496ea to b985d6b Compare July 1, 2026 22:52
@DemchaAV

DemchaAV commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

Blind cold review: approve with minor changes — all landed (amended into b985d6b): the false byte-identical CHANGELOG claim is fixed (the entity-decoder default-mode change is now its own honest Changed bullet); apostrophes / «guillemets» / spaced-ellipsis conversions documented in the builder Javadoc + CHANGELOG + README; null-guard on getTypographic* (NPE was reachable via render(Document) with hand-built nodes); +3 tests (apostrophe path, inside-::: replacements, model-level bold-inside-quotes, entity-leak guard). Reviewer had byte-verified all six new entity codepoints and proven the entity table complete for every string the extension can emit. Suite: 178 green.

@DemchaAV DemchaAV merged commit 8a6860e into develop Jul 1, 2026
4 checks passed
@DemchaAV DemchaAV deleted the feat/smart-punctuation branch July 2, 2026 05:26
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