Skip to main content

Crate egui_markdown

Crate egui_markdown 

Source
Expand description

A markdown parser and renderer for egui.

Parses CommonMark markdown into a token stream, then renders it as an interactive egui widget with support for text formatting, links, code blocks, tables, images, blockquotes, lists, and more.

§Quick Start

fn show_markdown(ui: &mut egui::Ui) {
    let text = "# Hello\n\nThis is **bold** and *italic*.";
    egui_markdown::MarkdownLabel::new(ui.id().with("md"), text).show(ui);
}

§Feature Flags

  • syntax_highlighting (default) - Syntax-highlighted code blocks via syntect.
  • images - Render images inline using egui_extras image support.
  • svg - SVG image support.

Re-exports§

pub use label::MarkdownLabel;
pub use layout::CodeThemeArg;
pub use link::LinkHandler;
pub use link::LinkStyle;
pub use parser::heal;
pub use parser::parse;
pub use style::MarkdownStyle;
pub use types::Alignment;
pub use types::Markdown;
pub use types::TableData;
pub use types::Token;
pub use types::TokenStyle;
pub use label::cursor_from_pos;
pub use label::glyph_at_index;
pub use label::last_non_whitespace_glyph;
pub use theme::default_code_theme;

Modules§

label
The MarkdownLabel widget. The MarkdownLabel widget for rendering interactive markdown.
layout
Layout job construction from token streams. Layout job construction from parsed markdown token streams.
link
Link handler trait and link styling. Link handler trait and styling for customizing link behavior.
paint
Code block and horizontal rule painting. Code block background and horizontal rule painting.
parser
CommonMark markdown parser. CommonMark markdown parser with streaming-friendly healing.
style
Customizable visual styling for markdown rendering. Customizable visual styling for all markdown elements.
table
Table rendering. Table rendering for markdown tables.
theme
Syntax highlighting theme utilities. Syntax highlighting theme utilities.
types
Parsed markdown token types. Parsed markdown token types and data structures.