Expand description
§leptos-md
A simple, signal-free Markdown renderer for Leptos with Tailwind CSS styling.
§Quick Start
ⓘ
use leptos::prelude::*;
use leptos_md::Markdown;
#[component]
fn App() -> impl IntoView {
view! {
<Markdown content="# Hello World\n\nThis is **markdown**!" />
}
}§Features
- Dead simple API -
<Markdown content=md />and you’re done - Beautiful by default - Tailwind prose styling with dark mode support
- GitHub Flavored Markdown - Tables, task lists, strikethrough, footnotes
- Code block themes - Built-in Tailwind themes (GitHub, Monokai, Dark, Light)
- External highlighter ready - Outputs
language-xxxclasses for Prism.js, highlight.js - SSR ready - Works seamlessly with Leptos server-side rendering
§Customization
Use MarkdownOptions for fine-grained control:
ⓘ
use leptos_md::{Markdown, MarkdownOptions, CodeBlockTheme};
let options = MarkdownOptions::new()
.with_gfm(true)
.with_code_theme(CodeBlockTheme::GitHub)
.with_language_classes(true)
.with_new_tab_links(true);
view! {
<Markdown content="# Hello" options=options />
}Structs§
- Markdown
Classes - Tailwind CSS class names for markdown elements
- Markdown
Options - Markdown
Props - Props for the
Markdowncomponent. - Markdown
Renderer
Enums§
Functions§
- Markdown
- Main component for rendering Markdown content with Tailwind CSS styling
- Markdown
Styles - Placeholder component - Tailwind handles all styling
- get_
code_ theme_ classes - Get theme-specific classes for code blocks
- get_
enhanced_ prose_ classes - Enhanced Tailwind prose configuration for better markdown styling
- render_
markdown_ string - Utility function to render markdown string directly to AnyView with Tailwind styling
- render_
markdown_ with_ options - Utility function to render markdown with custom options and Tailwind styling