{"id":16658082,"url":"https://github.com/leandrocp/mdex","last_synced_at":"2026-02-21T17:11:44.353Z","repository":{"id":194088437,"uuid":"690119410","full_name":"leandrocp/mdex","owner":"leandrocp","description":"Fast and Extensible Markdown for Elixir. Compliant with CommonMark spec. Formats to HTML, JSON, and XML. Built on top of comrak, ammonia, and autumnus.","archived":false,"fork":false,"pushed_at":"2026-02-16T00:28:07.000Z","size":4001,"stargazers_count":368,"open_issues_count":6,"forks_count":25,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-18T10:40:33.937Z","etag":null,"topics":["ammonia","commonmark","comrak","elixir","gfm","html","json","markdown","rust","syntax-highlighting","tree-sitter","xml"],"latest_commit_sha":null,"homepage":"https://mdelixir.dev","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leandrocp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"leandrocp"}},"created_at":"2023-09-11T15:08:25.000Z","updated_at":"2026-02-13T17:39:13.000Z","dependencies_parsed_at":"2025-12-10T16:04:10.727Z","dependency_job_id":null,"html_url":"https://github.com/leandrocp/mdex","commit_stats":{"total_commits":172,"total_committers":7,"mean_commits":"24.571428571428573","dds":"0.10465116279069764","last_synced_commit":"c02861a31e2e1fc2d9ed2cd805b3e7c2a9b6a02b"},"previous_names":["leandrocp/mdex"],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/leandrocp/mdex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fmdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fmdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fmdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fmdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandrocp","download_url":"https://codeload.github.com/leandrocp/mdex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fmdex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ammonia","commonmark","comrak","elixir","gfm","html","json","markdown","rust","syntax-highlighting","tree-sitter","xml"],"created_at":"2024-10-12T10:03:08.421Z","updated_at":"2026-02-21T17:11:44.347Z","avatar_url":"https://github.com/leandrocp.png","language":"Elixir","funding_links":["https://github.com/sponsors/leandrocp"],"categories":[],"sub_categories":[],"readme":"# MDEx\n\n\u003c!-- MDOC --\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/leandrocp/mdex/main/assets/images/mdex_logo.png\" width=\"360\" alt=\"MDEx logo\" /\u003e\n  \u003cbr\u003e\n\n  \u003ca href=\"https://hex.pm/packages/mdex\"\u003e\n    \u003cimg alt=\"Hex Version\" src=\"https://img.shields.io/hexpm/v/mdex\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://hexdocs.pm/mdex\"\u003e\n    \u003cimg alt=\"Hex Docs\" src=\"http://img.shields.io/badge/hex.pm-docs-green.svg?style=flat\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg alt=\"MIT\" src=\"https://img.shields.io/hexpm/l/mdex\"\u003e\n  \u003c/a\u003e\n\n  \u003cp align=\"center\"\u003eFast and Extensible Markdown for Elixir.\u003c/p\u003e\n\u003c/div\u003e\n\n## Features\n\n- Fast\n- Compliant with the [CommonMark spec](https://commonmark.org)\n- [Plugins](https://hexdocs.pm/mdex/plugins.html)\n- Formats:\n  - Markdown (CommonMark)\n  - HTML\n  - [Phoenix HEEx](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Rendered.html)\n  - JSON\n  - XML\n  - [Quill Delta](https://quilljs.com/docs/delta/)\n- Floki-like [Document AST](https://hexdocs.pm/mdex/MDEx.Document.html)\n- Req-like [Document pipeline API](https://hexdocs.pm/mdex/MDEx.Document.html)\n- [GitHub Flavored Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)\n- [GitLab Flavored Markdown](https://docs.gitlab.com/user/markdown)\n- Discord Flavored Markdown (Partial)\n- Wiki-style links\n- Phoenix HEEx components and expressions\n- [Streaming](https://hexdocs.pm/mdex/MDEx.Document.html#module-streaming) incomplete fragments\n- [Emoji](https://www.webfx.com/tools/emoji-cheat-sheet) shortcodes\n- Built-in [Syntax Highlighting](https://lumis.sh) for code blocks\n- [Code Block Decorators](https://hexdocs.pm/mdex/code_block_decorators-2.html)\n- HTML sanitization\n- [~MD Sigil](https://hexdocs.pm/mdex/MDEx.Sigil.html) for Markdown, HTML, HEEx, JSON, XML, and Quill Delta\n\n## Plugins\n\n- [mdex_gfm](https://hex.pm/packages/mdex_gfm) - Enable [GitHub Flavored Markdown](https://github.github.com/gfm) (GFM)\n- [mdex_mermaid](https://hex.pm/packages/mdex_mermaid) - Render [Mermaid](https://mermaid.js.org) diagrams in code blocks\n- [mdex_katex](https://hex.pm/packages/mdex_katex) - Render math formulas using [KaTeX](https://katex.org)\n- [mdex_video_embed](https://hex.pm/packages/mdex_video_embed) - Privacy-respecting video embeds from code blocks\n- [mdex_custom_heading_id](https://hex.pm/packages/mdex_custom_heading_id) - Custom heading IDs for markdown headings\n\n## Installation\n\nAdd `:mdex` dependency:\n\n```elixir\ndef deps do\n  [\n    {:mdex, \"~\u003e 0.11\"}\n  ]\nend\n```\n\nOr use [Igniter](https://hexdocs.pm/igniter):\n\n```sh\nmix igniter.install mdex\n```\n\n## Usage\n\n```elixir\niex\u003e MDEx.to_html!(\"# Hello :smile:\", extension: [shortcodes: true])\n\"\u003ch1\u003eHello 😄\u003c/h1\u003e\"\n```\n\n```elixir\niex\u003e MDEx.new(markdown: \"# Hello :smile:\", extension: [shortcodes: true]) |\u003e MDEx.to_html!()\n\"\u003ch1\u003eHello 😄\u003c/h1\u003e\"\n```\n\n```elixir\niex\u003e import MDEx.Sigil\niex\u003e ~MD[# Hello :smile:]HTML\n\"\u003ch1\u003eHello 😄\u003c/h1\u003e\"\n```\n\n```elixir\niex\u003e import MDEx.Sigil\niex\u003e assigns = %{project: \"MDEx\"}\niex\u003e ~MD[# {@project}]HEEX\n%Phoenix.LiveView.Rendered{...}\n```\n\n```elixir\niex\u003e import MDEx.Sigil\niex\u003e ~MD[# Hello :smile:]\n#MDEx.Document(3 nodes)\u003c\n├── 1 [heading] level: 1, setext: false\n│   ├── 2 [text] literal: \"Hello \"\n│   └── 3 [short_code] code: \"smile\", emoji: \"😄\"\n\u003e\n```\n\n```elixir\niex\u003e MDEx.new(streaming: true)\n...\u003e |\u003e MDEx.Document.put_markdown(\"**Install\")\n...\u003e |\u003e MDEx.to_html!()\n\"\u003cp\u003e\u003cstrong\u003eInstall\u003c/strong\u003e\u003c/p\u003e\"\n```\n\n## Examples\n\nLivebook examples are available at [Pages / Examples](https://hexdocs.pm/mdex/gfm.html)\n\n## Foundation\n\nThe library is built on top of:\n\n- [comrak](https://crates.io/crates/comrak) - a fast Rust port of [GitHub's CommonMark parser](https://github.com/github/cmark-gfm)\n- [ammonia](https://crates.io/crates/ammonia) for HTML Sanitization\n- [lumis](https://crates.io/crates/lumis) for Syntax Highlighting\n\n\u003c!-- MDOC --\u003e\n\n## Used By\n\n- [BeaconCMS](https://github.com/BeaconCMS/beacon)\n- [Tableau](https://github.com/elixir-tools/tableau)\n- [Bonfire](https://github.com/bonfire-networks/bonfire-app)\n- [00](https://github.com/technomancy-dev/00)\n- [Plural Console](https://github.com/pluralsh/console)\n- [Exmeralda](https://github.com/bitcrowd/exmeralda)\n- [Algora](https://github.com/algora-io/algora)\n- [Ash AI](https://github.com/ash-project/ash_ai)\n- [Canada Navigator](https://github.com/canada-ca/navigator)\n- [Jido](https://github.com/agentjido)\n- [TermUI](https://github.com/pcharbon70/term_ui)\n- [BeamLens Web](https://github.com/beamlens/beamlens_web)\n- [Conpipe](https://github.com/andyl/conpipe)\n- [ExPress](https://github.com/nocksock/ex_press)\n- [Prosody](https://github.com/halostatue/prosody)\n- [Sagents Live Debugger](https://github.com/sagents-ai/sagents_live_debugger)\n- [Sayfa](https://github.com/furkanural/sayfa)\n- And [more...](https://github.com/search?q=lang%3Aelixir+%3Amdex\u0026type=code)\n\n_Are you using MDEx and want to list your project here? Please send a PR!_\n\n## Sponsors\n\n💜 **Support MDEx Development**\n\nIf you or your company find MDEx useful, please consider sponsoring its development.\n\n➡️ **[GitHub Sponsors](https://github.com/sponsors/leandrocp)**\n\nYour support helps maintain and improve MDEx for the entire Elixir community!\n\n**Current and previous sponsors**\n\n\u003ca href=\"https://dockyard.com\" target=\"_blank\"\u003e\u003cimg src=\"assets/images/dockyard_logo.svg\" width=\"200\" alt=\"DockYard\" /\u003e\u003c/a\u003e\n\n## Motivation\n\nMDEx was born out of the necessity of parsing CommonMark files, to parse hundreds of files quickly, and to be easily extensible by consumers of the library.\n\n- [earmark](https://hex.pm/packages/earmark) is extensible but [can't parse](https://github.com/RobertDober/earmark_parser/issues/126) all kinds of documents and is slow to convert hundreds of markdowns.\n- [md](https://hex.pm/packages/md) is very extensible but the doc says \"If one needs to perfectly parse the common markdown, Md is probably not the correct choice\" and CommonMark was a requirement to parse many existing files.\n- [markdown](https://hex.pm/packages/markdown) is not precompiled and has not received updates in a while.\n- [cmark](https://hex.pm/packages/cmark) is a fast CommonMark parser but it requires compiling the C library, is hard to extend, and was archived on Apr 2024.\n\n## Comparison\n\n|Feature|MDEx|Earmark|md|cmark|\n| --- | --- | --- | --- | --- |\n|Active|✅|✅|✅|❌|\n|Pure Elixir|❌|✅|✅|❌|\n|Extensible|✅|✅|✅|❌|\n|Syntax Highlighting|✅|❌|❌|❌|\n|Code Block Decorators|✅|❌|❌|❌|\n|Streaming (fragments)|✅|❌|❌|❌|\n|Phoenix HEEx components|✅|❌|❌|❌|\n|AST|✅|✅|✅|❌|\n|AST to Markdown|✅|⚠️²|❌|❌|\n|To HTML|✅|✅|✅|✅|\n|To JSON|✅|❌|❌|❌|\n|To XML|✅|❌|❌|✅|\n|To Manpage|❌|❌|❌|✅|\n|To LaTeX|❌|❌|❌|✅|\n|To Quill Delta|✅|❌|❌|❌|\n|Emoji|✅|❌|❌|❌|\n|GFM³|✅|✅|❌|❌|\n|GLFM⁴|✅|❌|❌|❌|\n|Discord⁵|⚠️¹|❌|❌|❌|\n\n1. Partial support\n2. Possible with [earmark_reversal](https://hex.pm/packages/earmark_reversal)\n3. GitHub Flavored Markdown\n4. GitLab Flavored Markdown\n5. Discord Flavored Markdown\n\n## Benchmark\n\nA [benchmark](benchmark.exs) is available to compare existing libs:\n\n```\nName              ips        average  deviation         median         99th %\nmdex          8983.16       0.111 ms     ±6.52%       0.110 ms       0.144 ms\nmd             461.00        2.17 ms     ±2.64%        2.16 ms        2.35 ms\nearmark        110.47        9.05 ms     ±3.17%        9.02 ms       10.01 ms\n\nComparison:\nmdex          8983.16\nmd             461.00 - 19.49x slower +2.06 ms\nearmark        110.47 - 81.32x slower +8.94 ms\n\nMemory usage statistics:\n\nName            average  deviation         median         99th %\nmdex         0.00184 MB     ±0.00%     0.00184 MB     0.00184 MB\nmd              6.45 MB     ±0.00%        6.45 MB        6.45 MB\nearmark         5.09 MB     ±0.00%        5.09 MB        5.09 MB\n\nComparison:\nmdex         0.00184 MB\nmd              6.45 MB - 3506.37x memory usage +6.45 MB\nearmark         5.09 MB - 2770.15x memory usage +5.09 MB\n```\n\nThe most performance gain is using the `~MD` sigil to compile the Markdown instead of parsing it at runtime,\nprefer using it when possible.\n\nTo finish, a friendly reminder that all libs have their own strengths and trade-offs so use the one that better suits your needs.\n\n## Acknowledgements\n\n- [comrak](https://crates.io/crates/comrak) crate for all the heavy work on parsing Markdown and rendering HTML\n- [Floki](https://hex.pm/packages/floki) for the AST\n- [Req](https://hex.pm/packages/req) for the pipeline API\n- Logo based on [markdown-mark](https://github.com/dcurtis/markdown-mark)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrocp%2Fmdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandrocp%2Fmdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrocp%2Fmdex/lists"}