Skip to main content

Module markdown_preview

Module markdown_preview 

Source
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§

primitives
services
widgets

Structs§

CacheState
Cache state for markdown rendering.
CodeBlockColors
Colors for a code block theme
CollapseState
Collapse state for markdown sections.
ColorMapping
Color mapping for light/dark modes.
ColorPalette
Color palette for mapping named colors to RGB values.
CustomScrollbar
Custom scrollbar widget for markdown navigation.
DisplaySettings
Display settings for markdown rendering.
DoubleClickState
State for tracking double-click detection with deferred single-click handling.
ExpandableEntry
State for a single expandable content entry. State for a single expandable content entry.
ExpandableState
Expandable state for markdown content.
GitStats
Git statistics for display in statusline.
GitStatsState
Git stats state for markdown source files.
MarkdownDoubleClickEvent
Event returned when a line is double-clicked in the markdown widget.
MarkdownElement
A single markdown element that can be rendered to ratatui.
MarkdownState
Unified state for the markdown widget.
MarkdownStyle
Configuration for markdown rendering styles.
MarkdownTheme
Constructor functions for MarkdownTheme. Methods for MarkdownTheme. Markdown theme configuration struct.
MarkdownWidget
A scrollable, interactive markdown widget.
ParsedCache
Cache for parsed markdown (doesn’t depend on width).
RenderCache
Cache for rendered markdown lines (depends on width).
RenderOptions
Render options for markdown elements
ScrollState
Scroll state for markdown rendering.
ScrollbarConfig
Configuration for scrollbar appearance.
SelectionPos
Position in the rendered text (visual coordinates). Position in the rendered text (visual coordinates).
SelectionState
Selection state for markdown widget.
SourceState
Source state for markdown content management.
SyntaxHighlighter
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§

CheckboxState
Element enums and segment types. Checkbox state for task lists. Checkbox state for task lists.
CodeBlockBorderKind
Kind of code block border.
CodeBlockTheme
Code block color theme
ColumnAlignment
Column alignment for table cells. Represents the alignment of a table column.
ElementKind
Represents the kind of markdown element.
MarkdownEvent
Events emitted by the markdown widget. Events that can be emitted by the markdown widget.
MarkdownSource
Represents the source of markdown content.
MarkdownWidgetMode
Mode enum for the markdown widget statusline. Mode for the markdown widget statusline.
SyntaxThemeVariant
Theme variant for syntax highlighting. Theme variant for syntax highlighting.
TableBorderKind
Kind of table border.
TextSegment
Text segment types for markdown styling.
ThemeVariant
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.