MDExGFM (MDExGFM v0.1.4)

View Source

MDEx plugin to enable GitHub Flavored Markdown

Usage

Mix.install([
  {:mdex_gfm, "~> 0.1"}
])

markdown = """
# GFM

> [!NOTE]
> GFM is enabled!

- [x] Install `:mdex_gfm`
- [ ] Write your markdown
"""

mdex = MDEx.new(markdown: markdown) |> MDExGFM.attach()

MDEx.to_html!(mdex) |> IO.puts()
"""
<h1>GFM</h1>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title">Note</p>
<p>GFM is enabled!</p>
</div>
<ul>
<li><input type="checkbox" checked="" disabled="" /> Install <code>:mdex_gfm</code></li>
<li><input type="checkbox" disabled="" /> Write your markdown</li>
</ul>
"""

See attach/2 for more info.

Summary

Functions

Attaches the MDExGFM plugin into the MDEx document.

Functions

attach(document, options \\ [])

@spec attach(
  MDEx.Document.t(),
  keyword()
) :: MDEx.Document.t()

Attaches the MDExGFM plugin into the MDEx document.

Note it does not change the syntax highlighting options to use any GitHub theme automatically, but you can set it manually in the syntax_highlight options, for example:

html =
  MDEx.to_html!(mdex,
    document: markdown,
    syntax_highlight: [formatter: {:html_inline, theme: "github_light"}]
  )