Markdown display -- renders parsed markdown content.
The renderer manages an internal markdown::Items cache keyed by node ID.
Props
content(string) -- raw markdown text (used to seed the parser cache).width(length) -- container width. SeeToddy.Iced.Length.text_size(number) -- base text size in pixels.h1_size(number) -- heading 1 size in pixels.h2_size(number) -- heading 2 size in pixels.h3_size(number) -- heading 3 size in pixels.code_size(number) -- code block text size in pixels.spacing(number) -- spacing between markdown elements in pixels.link_color(hex color) -- color to override the default link color.code_theme-- syntax highlighting theme for code blocks:"solarized_dark","base16_mocha","base16_ocean"(default),"base16_eighties","inspired_github".a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
- Link clicks are forwarded as
MarkdownUrlmessages by the renderer.
Summary
Functions
Sets accessibility annotations.
Converts this markdown struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the code block text size.
Sets the syntax highlighting theme for code blocks.
Sets the heading 1 size.
Sets the heading 2 size.
Sets the heading 3 size.
Sets the link text color.
Creates a new markdown struct with the given content and optional keyword opts.
Sets the spacing between markdown elements.
Sets the base text size.
Sets the container width.
Applies keyword options to an existing markdown struct.
Types
@type option() :: {:width, Toddy.Iced.Length.t()} | {:text_size, number()} | {:h1_size, number()} | {:h2_size, number()} | {:h3_size, number()} | {:code_size, number()} | {:spacing, number()} | {:link_color, Toddy.Iced.Color.input()} | {:code_theme, String.t()} | {:a11y, Toddy.Iced.A11y.t()}
@type t() :: %Toddy.Iced.Widget.Markdown{ a11y: Toddy.Iced.A11y.t() | nil, code_size: number() | nil, code_theme: String.t() | nil, content: String.t(), h1_size: number() | nil, h2_size: number() | nil, h3_size: number() | nil, id: String.t(), link_color: Toddy.Iced.Color.t() | nil, spacing: number() | nil, text_size: number() | nil, width: Toddy.Iced.Length.t() | nil }
Functions
@spec a11y(markdown :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(markdown :: t()) :: Toddy.Iced.ui_node()
Converts this markdown struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the code block text size.
Sets the syntax highlighting theme for code blocks.
Sets the heading 1 size.
Sets the heading 2 size.
Sets the heading 3 size.
@spec link_color(markdown :: t(), link_color :: Toddy.Iced.Color.input()) :: t()
Sets the link text color.
Creates a new markdown struct with the given content and optional keyword opts.
Sets the spacing between markdown elements.
Sets the base text size.
@spec width(markdown :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the container width.
Applies keyword options to an existing markdown struct.