defmodule Web.Markdown do
  @moduledoc """
  Converts markdown to HTML using MDEx.
  """

  def to_html(markdown) when is_binary(markdown) do
    MDEx.to_html!(markdown,
      extension: [
        strikethrough: true,
        table: true,
        autolink: true,
        tasklist: true,
        footnotes: true
      ],
      features: [syntax_highlight_theme: "catppuccin_latte"]
    )
  end

  def to_html(nil), do: ""
end