LegionWeb. Markup
(LegionWeb v0.5.0)
View Source
Turns markdown and source code into safe HTML for the dashboard.
Languages are addressed by their Makeup.Registry name ("elixir",
"lua", ...). Any lexer registered with Makeup works; a language with no
registered lexer degrades to HTML-escaped plaintext rather than raising.
Summary
Functions
Highlights code as language, returning safe HTML for use inside a
<pre class="highlight"> or <code class="highlight">.
Renders markdown to safe HTML, highlighting every fenced code block whose info string names a registered lexer. Other fenced blocks are left as Earmark emitted them.
Functions
@spec highlight(String.t(), String.t() | nil) :: Phoenix.HTML.safe()
Highlights code as language, returning safe HTML for use inside a
<pre class="highlight"> or <code class="highlight">.
Unknown or nil language returns the escaped code with no markup.
@spec markdown(String.t()) :: Phoenix.HTML.safe()
Renders markdown to safe HTML, highlighting every fenced code block whose info string names a registered lexer. Other fenced blocks are left as Earmark emitted them.
Raw HTML blocks in the markdown are escaped and rendered as text, so markdown from an LLM or a user cannot inject markup into the dashboard. Malformed markdown renders best-effort instead of raising.