# `Toddy.Iced.Widget.Markdown`
[🔗](https://github.com/toddy-ui/toddy-elixir/blob/v0.3.0/lib/toddy/iced/widget/markdown.ex#L1)

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. See `Toddy.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. See `Toddy.Iced.A11y`.

## Events

- Link clicks are forwarded as `MarkdownUrl` messages by the renderer.

# `option`

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

# `t`

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

# `a11y`

```elixir
@spec a11y(markdown :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
```

Sets accessibility annotations.

# `build`

```elixir
@spec build(markdown :: t()) :: Toddy.Iced.ui_node()
```

Converts this markdown struct to a `ui_node()` map via the `Toddy.Iced.Widget` protocol.

# `code_size`

```elixir
@spec code_size(markdown :: t(), code_size :: number()) :: t()
```

Sets the code block text size.

# `code_theme`

```elixir
@spec code_theme(markdown :: t(), code_theme :: String.t()) :: t()
```

Sets the syntax highlighting theme for code blocks.

# `h1_size`

```elixir
@spec h1_size(markdown :: t(), h1_size :: number()) :: t()
```

Sets the heading 1 size.

# `h2_size`

```elixir
@spec h2_size(markdown :: t(), h2_size :: number()) :: t()
```

Sets the heading 2 size.

# `h3_size`

```elixir
@spec h3_size(markdown :: t(), h3_size :: number()) :: t()
```

Sets the heading 3 size.

# `link_color`

```elixir
@spec link_color(markdown :: t(), link_color :: Toddy.Iced.Color.input()) :: t()
```

Sets the link text color.

# `new`

```elixir
@spec new(id :: String.t(), content :: String.t(), opts :: [option()]) :: t()
```

Creates a new markdown struct with the given content and optional keyword opts.

# `spacing`

```elixir
@spec spacing(markdown :: t(), spacing :: number()) :: t()
```

Sets the spacing between markdown elements.

# `text_size`

```elixir
@spec text_size(markdown :: t(), text_size :: number()) :: t()
```

Sets the base text size.

# `width`

```elixir
@spec width(markdown :: t(), width :: Toddy.Iced.Length.t()) :: t()
```

Sets the container width.

# `with_options`

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

Applies keyword options to an existing markdown struct.

---

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