HTMD
An HTML to Markdown converter for Rust, inspired by turndown.js.
Features
- Rich options, same as turndown.js
- Reliable, it passes all test cases of turndown.js
- Minimum dependencies, it uses only html5ever
- Fast, it takes less than 200ms to convert a ~1.4MB Wikipedia page on an i5 7th gen CPU
Usages
Add the dependency
= { = "https://github.com/letmutex/htmd" }
Basic
use HtmlToMarkdown;
Skip tags
use HtmlToMarkdown;
let converter = builder
.skip_tags
.build;
assert_eq!;
Options
use ;
let converter = builder
.options
.build;
assert_eq!;
Custom tag handlers
use HtmlToMarkdown;
let converter = builder
.add_handler
.build;
assert_eq!;
Credits
License
Copyright 2024 letmutex
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.