cvkmohan

cvkmohan

Recently came across this great library leandrocp/mdex: A fast 100% CommonMark-compatible GitHub Flavored Markdown parser and formatter for Elixir. by our @leandrocp
I wanted to discuss about the library and realized there is no forum post introducing the library.
So, creating this thread. In the Phoenix LiveView, I just called Mdx.to_html() and voila - live preview is available.
Please explore.

Showing Posts 1 to 10

mayel

mayel

Use it and love it :+1:

leandrocp

leandrocp

The reason I’m not talking much about that library yet is because I’m still working on the API to manipulate AST and consequently allow extending it, think of how Req works but for Markdown. I’m glad it works for you!

leandrocp

leandrocp

Yep it’s in the pipeline. As soon as I solve AST manipulation it will be possible to format to HTML, HEEX, and even call arbitrary Elixir code. For context, https://mdxjs.com is a big inspiration for this library.

dkuku

dkuku

I’m waiting for a elixir formatter plugin that will format my docs. I always have to redeploy to hex due to broken formatting :slight_smile:

cvkmohan

cvkmohan OP

BTW @leandrocp, how do we extend the library? am-kantox/md: Stream-aware markdown parser with custom syntax setting (github.com) and mudasobwa/markright: A customizable markdown parser in Elixir: pure pattern matching. (github.com) look two interesting projects.
One question I have is - if we want to support hashtags (#) or mentions (@) - is it better to go to Javascript libraries like Tiptap, Quill etc. or is there anything we can try using your sort of libraries?
Sorry - if the question is very naive.

leandrocp

leandrocp

@cvkmohan I’ve considered md and others but none of them did the job for my needs. I got excited with md and its extension capabilities but quoting its readme “If one needs to perfectly parse the common markdown, Md is probably not the correct choice” so that was a major blocker.

Regarding extending MDEx that’s what I have in mind: RFC - Extension API · Issue #37 · leandrocp/mdex · GitHub - the first part which is parsing the document (AST) and formatting to HTML is half way done (Elixir and Rust), so it’s in progress.

if we want to support hashtags (#) or mentions (@)

I’m not sure I follow your question, both Tiptap and Quill are rich text editors while MDEx is a Markdown parser/formatter. With MDEx you’ll be able to manipulate the document after it was written, either with Tiptap or any other editor. So let’s say for example you want to add a link to every tag in your document, ie: transform #tag_a to [#tag_a](link) you’ll be able to traverse the AST and transform a text node into a link node. See RFC - Extension API · Issue #37 · leandrocp/mdex · GitHub for an example.

Does it make sense?

leandrocp

leandrocp

Hi @dkuku what kind of broken formatting you get publishing to hex? I’ve had an issue or two with earmark but in overall it works fine.

The “formatter” in “A fast 100% CommonMark-compatible GitHub Flavored Markdown parser and formatter.” means converting markdown to HTML and potentially other formats, but I’m assuming you’re talking about a mix format plugin, right? Can you elaborate a bit more?

cvkmohan

cvkmohan OP

Thanks @leandrocp. Yes, you answered even my imaginary question. :slight_smile:

Yes, I am looking at something like transforming text node into a link node. By using it - I intend to avoid using a Rich Text Editor. MDEx looks sufficiently fast - and - a split text box with source on the left - and - parsed results on the right should make Rich Text Editor unnecessary. And once you bring slab/delta-elixir: Simple yet expressive format to describe contents and changes :card_file_box: (github.com) into the mix, may be collaborative editing is possible entirely in the Elixir world!
Thanks for the answer. Will be looking forward to future releases.

mayel

mayel

If you’re looking for a way to parse and transform mentions, hashtags, and links: GitHub - bonfire-networks/linkify: Linkify is a basic package for turning website names into links. · GitHub

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews