# `ExRatatui.Widgets.Markdown`
[🔗](https://github.com/mcass19/ex_ratatui/blob/v0.7.1/lib/ex_ratatui/widgets/markdown.ex#L1)

A markdown rendering widget with syntax highlighting for code blocks.

Uses the `tui-markdown` Rust crate (powered by `pulldown-cmark` + `syntect`)
to parse markdown and render it with styled text spans. Supports headings,
bold, italic, inline code, fenced code blocks with syntax highlighting,
bullet lists, links, and horizontal rules.

Ideal for rendering AI assistant responses in a chat interface.

## Fields

  * `:content` - the markdown text to render
  * `:style` - `%ExRatatui.Style{}` for the widget background
  * `:block` - optional `%ExRatatui.Widgets.Block{}` container
  * `:scroll` - `{vertical, horizontal}` scroll offset (default: `{0, 0}`)
  * `:wrap` - `true` to wrap text at widget boundary (default: `true`)

## Examples

    iex> %ExRatatui.Widgets.Markdown{content: "# Hello\n\nSome **bold** text."}
    %ExRatatui.Widgets.Markdown{
      content: "# Hello\n\nSome **bold** text.",
      style: %ExRatatui.Style{},
      block: nil,
      scroll: {0, 0},
      wrap: true
    }

    iex> alias ExRatatui.Widgets.{Markdown, Block}
    iex> %Markdown{
    ...>   content: "Some text",
    ...>   block: %Block{title: "Response", borders: [:all]}
    ...> }
    %ExRatatui.Widgets.Markdown{
      content: "Some text",
      style: %ExRatatui.Style{},
      block: %ExRatatui.Widgets.Block{title: "Response", borders: [:all]},
      scroll: {0, 0},
      wrap: true
    }

# `t`

```elixir
@type t() :: %ExRatatui.Widgets.Markdown{
  block: ExRatatui.Widgets.Block.t() | nil,
  content: String.t(),
  scroll: {non_neg_integer(), non_neg_integer()},
  style: ExRatatui.Style.t(),
  wrap: boolean()
}
```

---

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