ExAthena.Web.Markdown (ExAthena v0.20.0)

Copy Markdown View Source

Renders the small Markdown subset used by the web chat.

The renderer is safe by construction: it emits only the tags defined in this module and escapes every value that came from the model. Raw HTML is intentionally displayed as text. Links are limited to HTTP(S), mailto:, and same-origin relative destinations.

Summary

Functions

Converts Markdown text to HTML-safe iodata.

Types

render_state()

@type render_state() :: %{
  parts: [iodata()],
  list_kind: nil | :ul | :ol,
  fence: nil | %{language: String.t(), lines: [String.t()]}
}

Functions

render(markdown)

@spec render(String.t() | nil) :: Phoenix.HTML.safe()

Converts Markdown text to HTML-safe iodata.

Supported syntax matches the chat's previous lightweight renderer: headings through level three, ordered and unordered lists, horizontal rules, fenced and inline code, emphasis, and links.