Introduction โ
Incremark is an incremental Markdown parser designed specifically for AI streaming output scenarios.
Problem Background โ
In AI chat scenarios, AI typically outputs Markdown text in a streaming manner. The traditional approach is:
Receive new chunk โ Concatenate to existing text โ Re-parse complete text โ Re-renderThis approach has serious performance issues:
- Repeated parsing: Already parsed content is parsed repeatedly
- High CPU overhead: Parsing time grows O(nยฒ) as text increases
- Page stutters: Poor user experience
Solution โ
Incremark uses an incremental parsing strategy:
Receive new chunk โ Append to buffer โ Detect completed blocks โ Only parse new blocks โ Incremental updateCore Advantages โ
- Completed blocks are never re-parsed - Up to 46x faster for long documents
- Smart boundary detection - Accurately identify when blocks are complete
- Maintain parsing correctness - Handle code blocks, lists and other complex nested structures
Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ @incremark/core โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Parser โ โ Detector โ โ Types โ โ
โ โ Incrementalโ โ Boundary โ โ Type Def โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ@incremark/vueโ โ@incremark/reactโ โ@incremark/devtoolsโ
โ Vue 3 โ โ React 18+ โ โ Dev Tools โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโUse Cases โ
- โ AI chat applications (ChatGPT, Claude, etc.)
- โ Streaming document generation
- โ Real-time Markdown preview
- โ Low-latency rendering scenarios
Online Demo โ
Try Incremark right now:
- ๐ฎ Vue Demo - Vue 3 integration example
- โ๏ธ React Demo - React integration example
Next Steps โ
- Quick Start - Get started in 5 minutes
- Core Concepts - Understand how it works