# `Plushie.Widget.Markdown`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/widget/markdown.ex#L1)

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)

# `option`

```elixir
@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()}
```

# `t`

```elixir
@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
}
```

# `a11y`

```elixir
@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()`.

# `build`

```elixir
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
```

Converts this widget struct to a `ui_node()` map.

# `code_size`

```elixir
@spec code_size(widget :: t(), value :: number() | nil) :: t()
```

Code block text size in pixels.

Accepts `number()`.

# `code_theme`

```elixir
@spec code_theme(widget :: t(), value :: (String.t() | atom()) | nil) :: t()
```

Syntax highlighting theme for code blocks.

Accepts `String.t() | atom()`.

# `content`

```elixir
@spec content(widget :: t(), value :: (String.t() | atom()) | nil) :: t()
```

Raw markdown text (used to seed the parser cache).

Accepts `String.t() | atom()`.

# `event_rate`

```elixir
@spec event_rate(widget :: t(), value :: integer() | nil) :: t()
```

Max events per second for coalescable events.

Accepts `integer()`.

# `h1_size`

```elixir
@spec h1_size(widget :: t(), value :: number() | nil) :: t()
```

Heading 1 size in pixels.

Accepts `number()`.

# `h2_size`

```elixir
@spec h2_size(widget :: t(), value :: number() | nil) :: t()
```

Heading 2 size in pixels.

Accepts `number()`.

# `h3_size`

```elixir
@spec h3_size(widget :: t(), value :: number() | nil) :: t()
```

Heading 3 size in pixels.

Accepts `number()`.

# `link_color`

```elixir
@spec link_color(widget :: t(), value :: (atom() | String.t() | map()) | nil) :: t()
```

Color to override the default link color.

Accepts `String.t()`.

# `markdown`
*macro* 

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)

# `new`

Creates a new widget struct with the given positional args and keyword options.

## Arguments

- `id` - unique widget identifier
- `content` - Raw markdown text (used to seed the parser cache).
- `opts` - keyword list of optional props

# `spacing`

```elixir
@spec spacing(widget :: t(), value :: number() | nil) :: t()
```

Spacing between markdown elements in pixels.

Accepts `number()`.

# `text_size`

```elixir
@spec text_size(widget :: t(), value :: number() | nil) :: t()
```

Base text size in pixels.

Accepts `number()`.

# `width`

```elixir
@spec width(
  widget :: t(),
  value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil
) ::
  t()
```

Container width.

Accepts `:fill | :shrink | {:fill_portion, pos_integer()} | number()`.

# `with_options`

```elixir
@spec with_options(widget :: t(), opts :: [option()]) :: t()
```

Applies keyword options to an existing widget struct.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
