Leandro Pereira
banner
leandrocp.bsky.social
Leandro Pereira
@leandrocp.bsky.social
I'm glad it's useful. Enjoy!
October 4, 2025 at 9:43 PM
All the MDEx.Document handling is done in Elixir including buffering and completing markdown chunks (using nimble_parsec). On the Rust side it "only" does parsing and rendering via crates.io/crates/comrak (an amazing project btw).
crates.io: Rust Package Registry
crates.io
October 4, 2025 at 9:39 PM
Exactly, it's not event based. MDEx doesn't care how or how often you push chunks into the Document. So you can keep a Document in a LiveView and keep pushing into it and render when needed. There's an example here github.com/leandrocp/md...
mdex/examples/streaming.exs at main · leandrocp/mdex
Fast and Extensible Markdown for Elixir. Compliant with CommonMark spec. Formats to HTML, JSON, and XML. Built on top of comrak, ammonia, and autumnus. - leandrocp/mdex
github.com
October 4, 2025 at 9:36 PM
It can afford to re-render as many times as needed because it's very efficient, although I'm expecting to gather some feedback and adjust if needed. One of the reasons this is considered experimental yet.
October 4, 2025 at 7:33 PM
This approach is similar to streamdown.ai but using nimble_parsec. A more optimized approach would require rewriting the parser from scratch like github.com/thetarnav/st... is doing but that's not on my plans.
Streamdown
A drop-in replacement for react-markdown, designed for AI-powered streaming.
streamdown.ai
October 4, 2025 at 7:31 PM
Fragments are buffered until a render or parser is requested (when `MDEx.to_html` or `Document.run` or others are called). At this moment the buffer tail is completed if needed (**text -> **text**) then appended to the rest of the document and re-rendered (that's where Rustler is called). 1/n
October 4, 2025 at 7:31 PM
And more detailed in the CHANGELOG at hexdocs.pm/mdex/changel...
Changelog — MDEx v0.9.3
hexdocs.pm
October 4, 2025 at 1:07 PM
4. `MDEx.Pipe` is gone. Now all operations are centralized into `MDEx.Document`. Yes that's a **breaking** change but it's worth it.

Pipelines are as simple as adding steps into the document:
October 4, 2025 at 1:07 PM
3. The Document struct is now displayed in a tree format for better visualization with each node indexed:
October 4, 2025 at 1:07 PM
Here's a short demo of Markdown streaming in MDEx 👀

Note it's still experimental and disabled by default.
October 4, 2025 at 1:07 PM
2. Streaming! Now it does complete and render incomplete chunks of Markdown for you:

hexdocs.pm/mdex/MDEx.Do...
October 4, 2025 at 1:07 PM
Thanks to @jskalc.bsky.social we now support converting Markdown to quilljs.com/docs/delta
October 4, 2025 at 1:07 PM
The difference between `Keyword.get(opts, :foo, :default)` and `opts[:foo] || :default` when opts[:foo] is nil. Not a big deal but easy to miss.
August 5, 2025 at 4:07 PM
Valeu Dhony :)
July 28, 2025 at 3:16 PM
Example highlighting some lines. It does use the `CursorLine` highlight group (the current line in Neovim) to style the line but you can change both class/style(1) to fine-tune it for your needs.

(1) Depends on the formatter.
July 28, 2025 at 1:47 PM
Example overwriting the theme. Use one of the themes available from autumnus.dev
July 28, 2025 at 1:47 PM
But I'd say to avoid it if you can :)
July 15, 2025 at 2:58 PM
Beacon does build and compile modules at runtime github.com/BeaconCMS/be...

Whenever a module is requested and still not available, it will run the compiler. Here's where that happens github.com/BeaconCMS/be...
beacon/lib/beacon/compiler.ex at main · BeaconCMS/beacon
Open-source Content Management System (CMS) built with Phoenix LiveView. Faster render times to boost SEO performance, even for the most content-heavy pages. - BeaconCMS/beacon
github.com
July 15, 2025 at 2:57 PM