brookmd 0.23.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ Notable changes to brookmd (formerly `flux-md`). Format based on
4
4
  [Keep a Changelog](https://keepachangelog.com/); this project aims to follow
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## 0.23.2 — 2026-07-22
8
+
9
+ ### Fixed
10
+
11
+ - **Streaming/one-shot parity: non-ASCII whitespace no longer blanks a line.**
12
+ The streaming premature-commit guard tested "previous line non-blank" with
13
+ Unicode-aware trimming, so a line consisting only of form feed (U+000C),
14
+ vertical tab (U+000B), NBSP, or other non-ASCII whitespace was treated as a
15
+ blank line. A paragraph opened by such a line could be committed early and a
16
+ later lazy continuation could never merge back — the streamed output
17
+ permanently diverged from the one-shot parse (nightly parity-fuzz catch,
18
+ input `\x0c\n-- - @`). The guard now uses the CommonMark blank-line
19
+ definition (ASCII space/tab only), matching the one-shot path; regression
20
+ tests pin the artifact and variants across chunk splits.
21
+
22
+ ## 0.23.1 — 2026-07-21
23
+
24
+ ### Changed
25
+
26
+ - Documentation only: the README now covers wire delta mode (the 0.23.0
27
+ headline) — measured numbers, the automatic worker↔client behavior, and the
28
+ raw-boundary opt-in — plus refreshed platform-status notes across the
29
+ repository. No code changes; behavior identical to 0.23.0.
30
+
7
31
  ## 0.23.0 — 2026-07-21
8
32
 
9
33
  ### Added
package/README.md CHANGED
@@ -4,7 +4,7 @@ Zero-dep streaming markdown for the browser. Rust→WASM core, one Web Worker pe
4
4
 
5
5
  Drop in a streaming-aware renderer — **React, Vue, Svelte, Solid, a framework-agnostic `<brook-markdown>` Web Component, or the vanilla DOM mount** — wire each LLM stream to a `BrookClient`, and the markdown renders incrementally off the main thread, block by block, with stable identities so unchanged blocks never re-reconcile.
6
6
 
7
- Parsing runs entirely **off the main thread** — each stream gets its own pooled Web Worker, so many concurrent LLM responses render without contending for the UI thread. On each token the parser re-parses only the **active tail**, not the whole document, and heavy renderers (syntax highlighting, math, mermaid) are **deferred until a block closes**. The result is low retained memory and a main thread that stays responsive while streaming. See [the live demo](https://md.hsingh.app/).
7
+ Parsing runs entirely **off the main thread** — each stream gets its own pooled Web Worker, so many concurrent LLM responses render without contending for the UI thread. On each token the parser re-parses only the **active tail**, not the whole document; patches cross the worker boundary as **verified splices** (not full re-sends, so emitted bytes stay O(n) even for one giant growing block); and heavy renderers (syntax highlighting, math, mermaid) are **deferred until a block closes**. The result is low retained memory and a main thread that stays responsive while streaming. See [the live demo](https://md.hsingh.app/).
8
8
 
9
9
  > **Beyond the browser:** the same Rust core also powers experimental React
10
10
  > Native, Swift (iOS/macOS), Kotlin/Android, Flutter, and C-ABI bindings —
@@ -1044,6 +1044,26 @@ Headline numbers are not durable across machines, but the curve is: chunk size
1044
1044
  shouldn't change the order of magnitude for any shape. If you hit one that does,
1045
1045
  file an issue with the input and chunking — that's the next bench scenario.
1046
1046
 
1047
+ ### Wire delta mode (automatic)
1048
+
1049
+ Parse work was already O(n), but until 0.23.0 the **bytes crossing the
1050
+ worker→main-thread boundary** were not: every append re-emitted the open
1051
+ block's full HTML, O(n²/chunk) total for one block that grows across many
1052
+ chunks (a long streaming list, a big code fence). Since 0.23.0 the parser
1053
+ emits **verified splices** instead — `{keep, append}` deltas against the
1054
+ block's previous emit, established by byte comparison so reconstruction is
1055
+ byte-exact by construction — and the client reassembles full blocks before
1056
+ anything else sees them. Zero API change; `Block.html` is always complete.
1057
+
1058
+ Measured at a 200 KB document in 256-byte chunks, a streaming list's total
1059
+ patch traffic drops from **119.6 MB to 0.78 MB (153× less, 2.8× faster
1060
+ end-to-end)**; an unclosed code fence from **80.1 MB to 0.58 MB (137×, 4.9×
1061
+ faster)**. Fast-committing prose is unchanged. Emitted bytes are now gated
1062
+ linear in CI alongside the parse-work counters. Raw-boundary consumers (the
1063
+ WASM `BrookParser`, native bindings, C ABI) keep byte-identical v1 wire by
1064
+ default and can opt in with `setWireDelta(true)` — see
1065
+ [`WIRE.md` §11](https://github.com/siinghd/brookmd/blob/main/crates/brookmd-core/WIRE.md).
1066
+
1047
1067
  ## Security
1048
1068
 
1049
1069
  brookmd is XSS-safe by default — its HTML output is meant to be injected via
@@ -52,15 +52,24 @@ entirely:
52
52
 
53
53
  ```toml
54
54
  [dependencies]
55
- brookmd-core = { version = "0.20", default-features = false }
55
+ brookmd-core = { version = "0.23", default-features = false }
56
56
  ```
57
57
 
58
58
  ## Wire format
59
59
 
60
60
  Blocks and patches serialize to a stable, language-agnostic JSON wire format —
61
- see [WIRE.md](WIRE.md) (wire contract v1.1.0). Native consumers can produce the
61
+ see [WIRE.md](WIRE.md) (wire contract v1.2.0). Native consumers can produce the
62
62
  same bytes as the WASM/JS boundary via `wire::patch_to_json` / `wire::blocks_to_json`.
63
63
 
64
+ Contract v1.2.0 adds the opt-in **wire delta mode**
65
+ (`StreamParser::set_wire_delta`): active blocks re-emitted across appends
66
+ serialize as verified `html_delta` splices against their previous emit instead
67
+ of full `html`, making total emitted bytes O(n) for a block that grows across
68
+ many appends (WIRE.md §11). Off by default — the default wire stays
69
+ byte-identical to v1.1.0. A consumer that enables it reconstructs
70
+ `prev[..keep] + append` per patch; the npm and React Native packages do this
71
+ transparently.
72
+
64
73
  ## Links
65
74
 
66
75
  - npm package: <https://www.npmjs.com/package/brookmd>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brookmd",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "Zero-dep streaming markdown for the browser. Rust→WASM core, Web Worker per stream, incremental parse with speculative closure.",
5
5
  "type": "module",
6
6
  "sideEffects": ["./dist/worker.js", "./dist/styles.css"],