Skip to main content

Crate mogwai_md

Crate mogwai_md 

Source
Expand description

§mogwai-md

A markdown rendering widget for mogwai.

mogwai-md parses markdown using pulldown-cmark and lowers the event stream directly into a mogwai view tree. Because it builds real DOM elements (not an HTML string), the same widget works in WASM (mogwai::web::Web) and server-side rendering (mogwai::ssr::Ssr).

§Quickstart

use mogwai::prelude::*;
use mogwai::web::Web;
use mogwai_md::Markdown;

let md = Markdown::<Web>::new("# Hello, world\n\nThis is **mogwai-md**.");
mogwai::web::body().append_child(&md);

See the examples/demo crate for a trunk-servable example.

Re-exports§

pub use pulldown_cmark;

Structs§

Markdown
A read-only markdown rendering widget.

Functions§

append_children
Parse src with opts and append the resulting view tree to parent.
children
Parse src with opts and return the top-level block elements.
default_options
The parser options used by crate::Markdown::new: CommonMark + GFM tables, strikethrough, and task lists.