2 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 1adfef61f6 fix(inline): honor backslash escapes, intraword *, and ***bold italic*** (v0.2.2) (#22)
evig's adoption parity check (old react-markdown output vs bip-kit's typed
blocks) found three classes where the inline scanner silently under-parsed
against standard markdown. Fixed here rather than worked around in every
consumer.

The single-pass "find the next matching delimiter" scanner could not express
any of them, so emphasis now runs as CommonMark does it: tokenize the line
into nodes and unresolved delimiter runs, then resolve the runs in a second
pass (process_emphasis — nearest eligible opener, two delimiters for strong,
one for em, rule of three). Escapes, code spans, links and footnote refs are
settled during tokenization, so a `\*` is inert text that can never open
markup and a code span still takes no escapes at all.

- Backslash escapes: the full CommonMark ASCII punctuation set. `\*x\*` is
  literal, `\\` is one backslash, and a backslash before a non-escapable
  character stays a backslash (`C:\path\to`).
- Intraword emphasis: `*` may open and close intraword (`foo*bar*baz`), `_`
  may not — `snake_case_name` and friends stay literal, pinned by test.
- `***x***`, `___x___`, `**_x_**`, `_**x**_` produce nested strong+em instead
  of a literal run of asterisks.

Zero new dependencies; still a hand-rolled scanner over one line. Unmatched
and dangling delimiters stay literal exactly as before.

ONE existing test pinned the old, non-CommonMark behavior and is updated:
"intraword underscores and asterisks are not emphasis" asserted that
`2*3*4 = 24` stayed literal text. Under CommonMark's flanking rules that is
`2<em>3</em>4 = 24`, which is what react-markdown and every other reader
emits, and what the parity check flagged. The underscore half of that
assertion is untouched and now has more cases around it.

Tests 116 -> 126.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 12:48:28 +00:00
CatoandClaude Fable 5 a711d1834e feat: v0.2 — inline model, extended block vocabulary, react reference renderer (#18)
One vocabulary + one reference renderer so every fleet site reads long-form
at the same standard, while typography tokens stay per-site.

Parser (root export, still zero-dep; the v0.1 ten block types unchanged):
- Inline model: parseInline → text/strong/em/code/link/footnoteRef spans;
  every text-bearing block keeps `text` and gains additive `spans`.
- New blocks: h4, hr, figure (caption title), gallery (adjacent images
  merge), callout (GitHub > [!NOTE] syntax, nestable), pullquote (>> with
  — cite), mermaid, chart (tiny declarative spec; malformed specs THROW),
  math ($$), footnote defs, stats fence.
- Headings gain slugified, de-duplicated, umlaut-aware ids (kivvi's scheme).
- parseFrontmatter learns YAML arrays (inline + block lists), still dep-free.
- Helpers: extractToc, readingTime, slugify/createSlugger, parseChartSpec.

Renderer (new bip-kit/react subpath + bip-kit/styles.css):
- ArticleBody: async RSC that pre-awaits shiki/katex, then emits a fully
  synchronous tree (renderToString-safe). Server components for every block;
  client islands: Toc (scroll-spy, hidden under 3 headings), ReadingProgress,
  Lightbox, CopyButton. MermaidBlock on its own bip-kit/react/mermaid subpath
  so the mermaid peer never enters uninterested bundles (components override).
- shiki/katex are optional peers loaded via bundler-invisible dynamic import;
  honest degradation without them (mono <pre>, TeX source with data-math).
- styles.css: complete neutral theme — 70ch measure, real vertical rhythm,
  dark mode via vars only (data-theme wins over prefers-color-scheme),
  mobile-first, print-safe; every color/radius/font is a --bp-* custom
  property (theming contract documented in the README).

CI: ci.yml gains workflow_dispatch (re-arm strand — a GITHUB_TOKEN merge
cannot trigger workflows on its own; threadkit#28 pattern).

96 tests: v0.1 compat goldens (original shapes byte-identical after
stripping additive fields), goldens for every new syntax form and edge case,
renderToString smoke tests for every block type with and without the
optional peers (BIPKIT_DISABLE_PEERS seam), consumer-install pack test now
probing ./react, ./react/mermaid and ./styles.css.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 16:03:53 +00:00