Skip to main content

html_to_markdown

Function html_to_markdown 

Source
pub fn html_to_markdown(html: &str) -> String
Expand description

Convert HTML to markdown

Converts common HTML elements (headings, lists, emphasis, code blocks, links, blockquotes) to their Markdown equivalents. Strips script, style, noscript, iframe, and svg elements. Decodes HTML entities.

ยงExamples

use fetchkit::html_to_markdown;

let html = "<h1>Title</h1><p><strong>Bold</strong> text</p>";
let md = html_to_markdown(html);
assert!(md.contains("# Title"));
assert!(md.contains("**Bold**"));