Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Would a streaming guidance for CommonMark be useful?

Дата публикации: 18-08-2026 07:20:16


Markdown often arrives live in chat apps, terminals, and other interfaces. Many UIs keep rewriting a growing rendered document; as output gets longer, that can mean more work and memory. A streaming parser can keep a small input window, emit safe output, and discard old text.
I have found little guidance for live Markdown generators and renderers: which features should they avoid, and which need buffering or lookahead? Would a short guide help?
I have been trying this in mdflow, a Markdown-to-terminal streaming renderer.

github.com




GitHub - cjccjj/mdflow: Unlike mdcat and Glow (Glamour), which buffer the...
Unlike mdcat and Glow (Glamour), which buffer the entire input before rendering, mdflow streams Markdown to the terminal in real time. It is also very fast and lightweight.






Its parser is a streaming rework of MD4C. MD4C is fully CommonMark-compliant; mdflow is tested against it and documents its streaming limits. The terminal presentation is outside CommonMark’s scope; this is only about parsing.
mdflow emits incrementally, usually a line at a time, while buffering at most two input lines. The remaining limits mostly affect static documents, because live streams rarely use these features:
Reference links cannot fully stream because definitions may appear later.
Multi-line Setext headings and tight/loose lists need a little lookahead or a small compromise.
Most other constructs can be processed as input arrives; GFM is mostly covered too.
The memory benefit may be large. In the current 10 MB mixed-Markdown benchmark, mdflow peaks at 2.3 MB, versus 102.3 MB for mdcat and 972.8 MB for glow. The README has the details.
This is not a proposal to change CommonMark. But with a few small changes requiring definitions before references, limiting multi-line Setext headings, and making tight/loose lists locally decidable, Markdown could be fully streamable.
mdflow and this idea are early experiments. I am not a long-time Markdown implementer and would welcome corrections.
Special thanks to @mity for creating MD4C. Its flat-buffer design made this streaming reconstruction practical.
1 post - 1 participant
Read full topic

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Markdown outline in (neo)vim with fzf06.8601-07-2026
209.8228-07-2026
3All Core Devs - Consensus (ACDC) #183, July 23 2026015.1813-07-2026
4textproc/mdbook-mermaid - 0.17.1044.115-08-2026
5Вайбкодю, потихоньку0502-07-2026
6Daily Hacker News for 2026-07-28011.4229-07-2026
7ERC-8340: Transaction Metadata Encoding034.2115-07-2026
8[Show] swift-topomap: Silicon-aware TUI and eBPF metrics engine011.8727-07-2026
9Я устал писать одноразовые скрипты для бенчмарков LLM и собрал харнесс, который сам считает Pareto-front0727-06-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 9. Тональность: 0. Информативность: 7.47. Источник: talk.commonmark.org.