Markdown display, renders parsed markdown content.
The renderer manages an internal markdown::Items cache keyed by node ID.
Props
| Name | Type | Default | Description |
|---|---|---|---|
content | String.t() | atom() | required | Raw markdown text (used to seed the parser cache). |
width | :fill | :shrink | {:fill_portion, pos_integer()} | number() | nil | Container width. |
text_size | number() | nil | Base text size in pixels. |
h1_size | number() | nil | Heading 1 size in pixels. |
h2_size | number() | nil | Heading 2 size in pixels. |
h3_size | number() | nil | Heading 3 size in pixels. |
code_size | number() | nil | Code block text size in pixels. |
spacing | number() | nil | Spacing between markdown elements in pixels. |
link_color | String.t() | nil | Color to override the default link color. |
code_theme | String.t() | atom() | nil | Syntax highlighting theme for code blocks. |
event_rate | integer() | nil | Max events per second for coalescable events. |
a11y | %Plushie.Type.A11y{} | map() | keyword() | %{role: :document} | Accessibility annotations. |
Constructor
Markdown.new(id, content)
Markdown.new(id, content, opts)
Summary
Functions
Accessibility annotations.
Converts this widget struct to a ui_node() map.
Code block text size in pixels.
Syntax highlighting theme for code blocks.
Raw markdown text (used to seed the parser cache).
Max events per second for coalescable events.
Heading 1 size in pixels.
Heading 2 size in pixels.
Heading 3 size in pixels.
Color to override the default link color.
Creates a :markdown widget.
Creates a new widget struct with the given positional args and keyword options.
Spacing between markdown elements in pixels.
Base text size in pixels.
Container width.
Applies keyword options to an existing widget struct.
Types
@type option() :: ((((((((({:width, :fill | :shrink | {:fill_portion, pos_integer()} | number()} | {:text_size, number()}) | {:h1_size, number()}) | {:h2_size, number()}) | {:h3_size, number()}) | {:code_size, number()}) | {:spacing, number()}) | {:link_color, atom() | String.t() | map()}) | {:code_theme, String.t() | atom()}) | {:event_rate, integer()}) | {:a11y, %Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()}
@type t() :: %Plushie.Widget.Markdown{ a11y: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, code_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, code_theme: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, content: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, event_rate: integer() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, h1_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, h2_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, h3_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, id: String.t(), link_color: String.t() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, spacing: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, text_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, width: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil }
Functions
@spec a11y( widget :: t(), value :: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | nil ) :: t()
Accessibility annotations.
Accepts %Plushie.Type.A11y{} | map() | keyword().
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
Converts this widget struct to a ui_node() map.
Code block text size in pixels.
Accepts number().
Syntax highlighting theme for code blocks.
Accepts String.t() | atom().
Raw markdown text (used to seed the parser cache).
Accepts String.t() | atom().
Max events per second for coalescable events.
Accepts integer().
Heading 1 size in pixels.
Accepts number().
Heading 2 size in pixels.
Accepts number().
Heading 3 size in pixels.
Accepts number().
Color to override the default link color.
Accepts String.t().
Creates a :markdown widget.
Shorthand for new/2. Import this macro to use the widget name
directly in view functions:
import Plushie.Widget.Markdown, only: [markdown: 2]
markdown("my-id", prop: value)
Creates a new widget struct with the given positional args and keyword options.
Arguments
id- unique widget identifiercontent- Raw markdown text (used to seed the parser cache).opts- keyword list of optional props
Spacing between markdown elements in pixels.
Accepts number().
Base text size in pixels.
Accepts number().
@spec width( widget :: t(), value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil ) :: t()
Container width.
Accepts :fill | :shrink | {:fill_portion, pos_integer()} | number().
Applies keyword options to an existing widget struct.