Expand description
§Glamour
A markdown rendering library for terminal applications.
Glamour transforms markdown into beautifully styled terminal output with:
- Styled headings, lists, and tables
- Code block formatting with optional syntax highlighting
- Link and image handling
- Customizable themes (Dark, Light, ASCII, Pink)
§Role in charmed_rust
Glamour is the Markdown renderer for the ecosystem:
- glow is the CLI reader built directly on glamour.
- demo_showcase uses glamour for in-app documentation pages.
- lipgloss provides the styling primitives that glamour applies.
§Example
use glamour::{render, Renderer, Style};
// Quick render with default dark style
let output = render("# Hello\n\nThis is **bold** text.", Style::Dark).unwrap();
println!("{}", output);
// Custom renderer with word wrap
let renderer = Renderer::new()
.with_style(Style::Light)
.with_word_wrap(80);
let output = renderer.render("# Heading\n\nParagraph text.");§Feature Flags
syntax-highlighting: Enable syntax highlighting for code blocks using syntect. This adds ~2MB to binary size due to embedded syntax definitions for ~60 languages.
§Example with syntax highlighting
[dependencies]
glamour = { version = "0.1", features = ["syntax-highlighting"] }When enabled, code blocks with language annotations (e.g., ```rust)
will be rendered with syntax highlighting using the configured theme.
See docs/SYNTAX_HIGHLIGHTING_RESEARCH.md for implementation details.
Modules§
Structs§
- Ansi
Options - Options for the markdown renderer (Go API:
AnsiOptions). - Style
Block - Block-level style settings.
- Style
Code Block - Code block style settings.
- Style
Config - Complete style configuration for rendering.
- Style
List - List style settings.
- Style
Primitive - Primitive style settings for text elements.
- Style
Table - Table style settings.
- Style
Task - Task item style settings.
- Term
Renderer - Markdown renderer for terminal output (Go API:
TermRenderer).
Enums§
- Style
- Available built-in styles.
Functions§
- ascii_
style - Creates the ASCII style configuration.
- available_
styles - Available style names for configuration.
- dark_
style - Creates the dark style configuration.
- dracula_
style - Creates the Dracula style configuration.
- light_
style - Creates the light style configuration.
- pink_
style - Creates the pink style configuration.
- render
- Render markdown with the specified style.
- render_
with_ environment_ config - Render markdown with the default dark style.
- tokyo_
night_ style - Creates the Tokyo Night style configuration.
Type Aliases§
- Renderer
- Backwards-compatible type alias for
TermRenderer. - Renderer
Options - Backwards-compatible type alias for
AnsiOptions.