Skip to main content

Crate umd

Crate umd 

Source
Expand description

Universal Markdown Parser

A post-Markdown superset parser with Bootstrap 5 integration and extensible syntax. This parser aims for reasonable CommonMark compliance (75%+) while providing powerful extensions including Bootstrap styling, semantic HTML, and plugin support.

§Features

  • CommonMark-compliant Markdown parsing
  • Bootstrap 5 integration (Core UI compatible)
  • Extended syntax (definition lists, decorations, semantic HTML)
  • LukiWiki legacy syntax support for backward compatibility
  • HTML sanitization (direct HTML input is forbidden)
  • Safe HTML output generation
  • Plugin system support (output only, execution handled externally)

§Security

All user input is sanitized to prevent XSS attacks. HTML entities are preserved, but raw HTML tags are escaped. Plugin output is the only exception, as plugins are considered trusted code.

§Example

use umd::parse;

let input = "# Hello World\n\nThis is **bold** text.";
let html = parse(input);

§WASM Usage

This library can be compiled to WebAssembly for use in browsers:

import init, { parse_markdown } from './umd.js';

await init();
const html = parse_markdown('# Hello World');

Modules§

extensions
Extended syntax for Universal Markdown
frontmatter
Frontmatter parsing module
parser
Parser module for Universal Markdown
sanitizer
HTML sanitization module

Structs§

ParseResult
Parse result with optional frontmatter and footnotes

Functions§

parse
Parse Universal Markdown and convert to HTML
parse_markdown
WASM-exposed API for parsing Universal Markdown
parse_wiki
Legacy alias for backward compatibility
parse_with_frontmatter
Parse Universal Markdown and return HTML with frontmatter
parse_with_frontmatter_opts
Parse Universal Markdown and return HTML with frontmatter and custom options