21 releases

new 0.0.21 Nov 1, 2024
0.0.20 Oct 31, 2024
0.0.15 Sep 23, 2024
0.0.9 Dec 28, 2023

#2273 in Parser implementations

Download history 41/week @ 2024-07-12 13/week @ 2024-07-19 99/week @ 2024-07-26 27/week @ 2024-08-02 10/week @ 2024-08-09 37/week @ 2024-08-16 48/week @ 2024-08-23 18/week @ 2024-08-30 10/week @ 2024-09-06 5/week @ 2024-09-13 992/week @ 2024-09-20 358/week @ 2024-09-27 321/week @ 2024-10-04 65/week @ 2024-10-11 464/week @ 2024-10-18 487/week @ 2024-10-25

1,368 downloads per month
Used in 4 crates (2 directly)

MIT license

125KB
1K SLoC

fast_html2md

A Rust html to markdown crate built for performance.

cargo add fast_html2md

use html2md::parse_html;

let md = parse_html("<p>JAMES</p>", false);
assert_eq!(md, "JAMES")

Ignoring Tags

    let mut tag_factory: HashMap<String, Box<dyn html2md::TagHandlerFactory>> =
        HashMap::new();

    let tag = Box::new(IgnoreTagFactory {});

    tag_factory.insert(String::from("script"), tag.clone());
    tag_factory.insert(String::from("style"), tag.clone());
    tag_factory.insert(String::from("noscript"), tag.clone());
    let html = html2md::parse_html_custom(&html, &tag_factory, false);

Notes

This project is a practical rewrite from the original html2md with major bug fixes and performance improvements.

Dependencies

~8–15MB
~273K SLoC