TermUI.Widgets.MarkdownViewer (TermUI v1.0.0)

View Source

A scrollable markdown viewer component for TermUI.

Renders markdown content with syntax highlighting, scrolling support, and interactive code blocks that can be focused and copied.

Usage

MarkdownViewer.new(content: "# Hello\n\nThis is **bold** text.")

Keyboard Navigation

  • / - Scroll up/down by line
  • Page Up / Page Down - Scroll by page
  • Home / End - Jump to top/bottom
  • Tab - Cycle focus through code blocks
  • Enter / c - Copy focused code block

Props

  • :content - Markdown content to display (default: "")
  • :width - Display width (default: 80)
  • :height - Display height (default: 24)
  • :on_copy - Callback called when code block is copied (optional)

Summary

Functions

Creates new MarkdownViewer props.

Sets the markdown content.

Functions

new(opts)

@spec new(keyword()) :: map()

Creates new MarkdownViewer props.

set_content(pid, content)

@spec set_content(pid(), String.t()) :: :ok

Sets the markdown content.