Available on crate feature
markdown-preview only.Expand description
Markdown rendering widget for ratatui applications.
Provides a feature-rich markdown viewer with TOC, selection, themes, syntax highlighting, and more.
Modules§
Structs§
- Cache
State - Cache state for markdown rendering.
- Code
Block Colors - Colors for a code block theme
- Collapse
State - Collapse state for markdown sections.
- Color
Mapping - Color mapping for light/dark modes.
- Color
Palette - Color palette for mapping named colors to RGB values.
- Custom
Scrollbar - Custom scrollbar widget for markdown navigation.
- Display
Settings - Display settings for markdown rendering.
- Double
Click State - State for tracking double-click detection with deferred single-click handling.
- Expandable
Entry - State for a single expandable content entry. State for a single expandable content entry.
- Expandable
State - Expandable state for markdown content.
- GitStats
- Git statistics for display in statusline.
- GitStats
State - Git stats state for markdown source files.
- Markdown
Double Click Event - Event returned when a line is double-clicked in the markdown widget.
- Markdown
Element - A single markdown element that can be rendered to ratatui.
- Markdown
State - Unified state for the markdown widget.
- Markdown
Style - Configuration for markdown rendering styles.
- Markdown
Theme - Constructor functions for
MarkdownTheme. Methods forMarkdownTheme. Markdown theme configuration struct. - Markdown
Widget - A scrollable, interactive markdown widget.
- Parsed
Cache - Cache for parsed markdown (doesn’t depend on width).
- Render
Cache - Cache for rendered markdown lines (depends on width).
- Render
Options - Render options for markdown elements
- Scroll
State - Scroll state for markdown rendering.
- Scrollbar
Config - Configuration for scrollbar appearance.
- Selection
Pos - Position in the rendered text (visual coordinates). Position in the rendered text (visual coordinates).
- Selection
State - Selection state for markdown widget.
- Source
State - Source state for markdown content management.
- Syntax
Highlighter - Syntax highlighting for code blocks using syntect.
- Toc
- Table of Contents widget for markdown navigation.
- TocConfig
- Configuration for TOC appearance.
- TocEntry
- Table of Contents entry. A single entry in the Table of Contents.
- TocState
- State for the Table of Contents sidebar.
- VimState
- Vim keybinding state.
Enums§
- Checkbox
State - Element enums and segment types. Checkbox state for task lists. Checkbox state for task lists.
- Code
Block Border Kind - Kind of code block border.
- Code
Block Theme - Code block color theme
- Column
Alignment - Column alignment for table cells. Represents the alignment of a table column.
- Element
Kind - Represents the kind of markdown element.
- Markdown
Event - Events emitted by the markdown widget. Events that can be emitted by the markdown widget.
- Markdown
Source - Represents the source of markdown content.
- Markdown
Widget Mode - Mode enum for the markdown widget statusline. Mode for the markdown widget statusline.
- Syntax
Theme Variant - Theme variant for syntax highlighting. Theme variant for syntax highlighting.
- Table
Border Kind - Kind of table border.
- Text
Segment - Text segment types for markdown styling.
- Theme
Variant - Theme variant selection enum.
Constants§
- BLOCKQUOTE_
MARKER - Blockquote marker (matching render-markdown.nvim).
- BULLET_
MARKERS - Bullet markers that cycle by nesting level (matching render-markdown.nvim).
- CHECKBOX_
CHECKED - CHECKBOX_
TODO - CHECKBOX_
UNCHECKED - Checkbox icons (matching render-markdown.nvim).
- HEADING_
ICONS - Heading icons by level (matching render-markdown.nvim).
- HORIZONTAL_
RULE_ CHAR - Horizontal rule character.
Functions§
- get_
effective_ theme_ variant - Function to resolve the effective theme variant. Get the effective color scheme based on variant and terminal detection.
- handle_
click - Handle click event at the given position.
- handle_
mouse_ event - Handle mouse event for the markdown widget.
- handle_
mouse_ event_ with_ double_ click - Handle mouse event with double-click detection.
- load_
theme_ from_ json - Function to load a markdown theme from JSON. Load a markdown theme from JSON string.
- render_
element - Render a markdown element to ratatui Line with given width.
- render_
element_ with_ options - Render a markdown element with options.
- render_
markdown - Render markdown string to ratatui Text with default styling
- render_
markdown_ to_ elements - Render markdown content to markdown elements.
- render_
markdown_ with_ style - Render markdown string to ratatui Text with custom style configuration
- should_
render_ line - Check if a line should be rendered based on collapse state. Check if a markdown element should be rendered based on collapse state.