PhoenixKit.Pages.Renderer (phoenix_kit v1.5.2)

View Source

Simple markdown rendering for Pages module.

Converts markdown files to HTML with metadata extraction.

Summary

Functions

Renders a markdown file to HTML.

Renders a markdown file to HTML with metadata extraction.

Converts markdown content to HTML.

Functions

render_file(relative_path)

Renders a markdown file to HTML.

Examples

iex> Renderer.render_file("/test.md")
{:ok, "<h1>Hello World</h1>"}

iex> Renderer.render_file("/missing.md")
{:error, :enoent}

render_file_with_metadata(relative_path)

Renders a markdown file to HTML with metadata extraction.

Returns both the rendered HTML and the parsed metadata.

Examples

iex> Renderer.render_file_with_metadata("/test.md")
{:ok, "<h1>Hello World</h1>", %{status: "published", ...}}

iex> Renderer.render_file_with_metadata("/missing.md")
{:error, :enoent}

render_markdown(content)

Converts markdown content to HTML.

Examples

iex> Renderer.render_markdown("# Hello")
"<h1>Hello</h1>"