VectorJSON – O(n) streaming parser to handle LLM JSON outputs
Replaces O(n²) token re-parsing with true O(n) streaming; Vercel SDK does 4K re-parses on 50KB payloads.
A streaming-capable markdown parser, written in TypeScript
Incremental AST parsing beats full re-renders for long LLM markdown streams.
Frontend engineers building AI chat interfaces
micromark · marked · remark
I’ve been obsessing over ways to make this more efficient, so I wrote a markdown parser that can parse streaming markdown (semi) incrementally. Instead of re-processing the whole document each time, it only parses what’s new, processing each line only once. Block‑level nodes are buffered until they’re complete (for example, once a paragraph is done and won’t be extended by more text). This also makes parsing the markdown on server possible. The main demo does exactly that. Additionally, animating markdown blocks becomes much simpler and efficient, as a result.
Here’s a demo if you’d like to see it in action: https://markdownparser.vercel.app/experimental
Feel free to type 'Render a table with 10 rows' to see each table row animate in.
I’ve spent a lot of time thinking about this problem, so if you’re working on similar issues, I'd love to chat.
Replaces O(n²) token re-parsing with true O(n) streaming; Vercel SDK does 4K re-parses on 50KB payloads.
Event-stream parsing beats regex for streaming LLM tokens in real time.
Content-hash caching beats git-diff approaches for incremental i18n translation.
Two-phase pipeline eliminates order-dependence before writing any wiki pages.
Differential dataflow in PostgreSQL; one row insertion touches only one row of computation.
Content hashing for incremental AI doc builds saves real API credits.