Skip to content
CAI
Software that uses CAICheck a score

leandrocp/mdex

71.8

Strong · 3 October 2026

8.4k

lines of production code

Elixir

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

MDEx is an Elixir library that parses Markdown into a manipulatable Abstract Syntax Tree (AST) for programmatic document handling and rendering. It supports converting documents to multiple output formats, including HTML, JSON, XML, and Slack mrkdwn, while integrating with Phoenix LiveView via HEEX sigils. The system features extensible syntax highlighting, code block decoration, and robust sanitization, replacing its previous native Rust implementation with a modular architecture.

Features

Add index and selector-based access to document nodes

Users can now retrieve, modify, and remove specific nodes within a Markdown document using integer indices, node type atoms, structs, or custom functions. This change introduces the \MDEx.Document.Access\ module, which implements \fetch\, \get\_and\_update\, and \pop\ behaviors, supported by a new \MDEx.Document.Traversal\ module for recursive tree traversal and updates.

lib/mdex/document · high confidence

Introduce usage rules and developer tooling configuration

This release adds a \usage-rules.md\ guide to help developers and coding agents choose the correct MDEx API for their needs, such as using the \\~MD\ sigil for static content or \MDEx.to\_html!/2\ for runtime content. It also introduces new configuration files to standardize the development environment: \.coderabbit.yaml\ to skip automated reviews for release PRs, \.credo.exs\ to enforce strict linting and a cyclomatic complexity ceiling of 9, and a \Dockerfile\ for reproducible local debugging. Additionally, the \.formatter.exs\ line length is increased to 150 characters to align with the linter, and the \test.md\ file is removed.

(repo-wide) · high confidence

New documentation guides for code block decorators, HEEx integration, and migration

Added new guides to the documentation: \code\_block\_decorators.md\ explains how to use Lumis syntax highlighting options (like themes and line highlighting) in code blocks; \heex.md\ details integrating MDEx with Phoenix LiveView templates using the \\~MD\[...\]HEEX\ sigil and \to\_heex/2\; \earmark\_to\_mdex.livemd\ provides a migration guide from Earmark to MDEx; and \compilation.md\ covers native dependency setup, including Lumis parser installation and pre-compiled binaries.

guides · high confidence

New example notebooks for MDEx features

Added a comprehensive set of Livebook examples demonstrating MDEx capabilities, including syntax highlighting with Lumis and Syntect, custom and light/dark themes, code block decorators, and custom codefence renderers for Pikchr, SVG charts, and Mermaid diagrams. The examples also cover GitHub Flavored Markdown, Phoenix LiveView HEEx integration, document tree traversal for word highlighting, streaming output, and integration with NimblePublisher.

examples · high confidence

Removals

Removal of native comrak NIF module

The native Rust implementation for Markdown processing (comrak\_nif) has been removed from the codebase. This deletes the Erlang NIF bindings that previously exposed the \to\_html\ and \to\_html\_with\_options\ functions, along with the associated Elixir structs (\MDEx.ExtensionOptions\, \MDEx.ParseOptions\, \MDEx.RenderOptions\, \MDEx.Options\) and the \ListStyleType\ enum, effectively stripping the native rendering capability from this specific location.

_native/comrak\nif · high confidence

Behavioural changes

Configures Lumis as the syntax highlighter for mdex\_native

The application now uses the Lumis library for syntax highlighting within the mdex\_native component, as defined in the new config/config.exs file.

config · high confidence

MDEx restructures core engine with new Document AST and converter modules

The library introduces a unified \%MDEx.Document\ struct as the central representation for Markdown, replacing the previous options and native module structures. This change brings in dedicated converter modules for Quill Delta (\MDEx.DeltaConverter\) and Slack mrkdwn (\MDEx.SlackConverter\), alongside a new \MDEx.ComrakConverter\ for AST translation. The \MDEx.FragmentParser\ is updated to handle streaming and incomplete link completion more robustly, while the \MDEx.Sigil\ module now supports HEEx modifiers for Phoenix LiveView components. The old \MDEx.Native\ and \MDEx.Options\ modules have been removed in favor of this new architecture.

lib/mdex · high confidence

Major API overhaul with AST-based parsing and new output formats

The library has been refactored to introduce \MDEx.Document\ as the core engine, replacing the previous direct conversion functions with a structured AST approach. Users can now parse Markdown into an inspectable \MDEx.Document\ struct (inspired by Floki) and manipulate it programmatically before rendering. This change introduces new \to\\\ functions (HTML, CommonMark, JSON, XML, Slack) and a \use MDEx\ macro that enables the \\~MD\ sigil and LiveView HEEX support. Additionally, the public API now exposes plugin support, custom syntax highlighter engines, and granular options for sanitization and auto-closing, while deprecating the old default option getters in favor of \MDEx.Document\ equivalents.

lib · high confidence

Test coverage

Added comprehensive test coverage for MDEx core components; Expanded test suite for syntax highlighting, sanitization, and document handling.

Dependencies

MDEx v0.14.1: Native engine migration and dependency overhaul

This release upgrades the project to version 0.14.1 and raises the minimum Elixir requirement to 1.15. The native Rust component has been refactored: the local \comrak\_nif\ crate (previously using comrak 0.18 and rustler 0.29) is removed in favor of the external \mdex\_native\ hex package (v0.2.10), which manages its own Rust dependencies (rustler 0.32, rustler\_precompiled 0.8). The Elixir side now depends on \nimble\_options\, \nimble\_parsec\, and \jason\, while dev dependencies like \ex\_doc\ and \earmark\_parser\ are updated to their latest versions.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 67 → 72 (+4.4)
  • Rubric changed (rubric-2026.09.15 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 97 → 97 (+0.2)
  • Architecture 100 → 100 (+0.0)
  • Maturity 59 → 69 (+9.8)
  • Readiness 61 → 63 (+2.1)
  • Security 80 → 82 (+2.5)

Resolved (3)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Outdated: phoenix_live_view

New (1)

  • Repeated repair: lib/mdex/fragment_parser.ex (lib/mdex/fragment_parser.ex)

Changes since last survey

  • 22 commits — 10 feature/other, 12 fixes

By area

  • (root) — 10 commits
  • lib/mdex — 6 commits
  • test/mdex — 4 commits
  • (repo) — 1 commit
  • guides/streaming.md — 1 commit

Notable commits

  • fix: ci: fix CodeRabbit release PR title keyword (#434)
  • fix: fix: default Link and Image title to an empty string (#428)
  • fix: fix: disable sanitization with sanitize: false (#429)
  • fix: fix: don't render partial link URLs while auto-closing (#440)
  • fix: fix: fill in sanitize defaults for partial :sanitize options (#433)
  • fix: fix: handle document root fragments consistently (#432)
  • fix: fix: only append a table delimiter row when the table lacks one (#437)
  • fix: fix: preserve asterisk list markers during auto-close (#445)
  • fix: fix: preserve escaped AST children (#413)
  • fix: fix: prevent partial reference URLs in block quotes (#447)
  • fix: fix: raise validation errors for invalid built-in option values (#423)
  • fix: fix: validate :assigns and :auto_close option values (#427)
  • change: Remove Unreleased section from CHANGELOG (#436)
  • change: chore(deps): bump phoenix_live_view from 1.2.11 to 1.2.12 (#414)
  • change: chore: release v0.14.0 (#387)
  • change: chore: release v0.14.1 (#426)
  • change: docs: Lumis 0.9 parsers from Hex (#415)
  • change: docs: emit plugin HTML as MDEx.Raw in plugin examples (#425)
  • change: docs: expand the plugin authoring guide and document the HTML node trade-off (#431)
  • change: docs: warn against auto-closing each incoming chunk (#446)
  • …and 2 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

leandrocp/mdex was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 3 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit c6c5eda69dfd8786bd6188dea285e0da0f7f0af8 — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-8fe32cd45d00.