Skip to main content

Crate h2md

Crate h2md 

Source
Expand description

§h2md - HTML to Markdown Converter

This library converts HTML to clean Markdown format.

§Features

  • Headings (h1-h6)
  • Paragraphs and line breaks
  • Inline formatting (bold, italic, strikethrough, code)
  • Links and images
  • Ordered and unordered lists (with nesting)
  • Blockquotes
  • Code blocks with language detection
  • Tables
  • Horizontal rules

§Example

use h2md::convert;

let html = b"<h1>Hello</h1><p>World</p>";
let mut out = Vec::new();
convert(html, &mut out)?;
let result = String::from_utf8(out).unwrap();
assert!(result.contains("# Hello"));
assert!(result.contains("World"));

Enums§

Error
The error type for HTML-to-Markdown conversion.

Functions§

convert
Convert HTML to Markdown, writing directly to any Write target.