pub struct HtmlToMarkdown { /* private fields */ }Expand description
The html-to-markdown converter.
§Example
use htmd::{Element, HtmlToMarkdown};
// One-liner
let md = HtmlToMarkdown::new().convert("<h1>Hello</h1>").unwrap();
assert_eq!("# Hello", md);
// Or use the builder pattern
let converter = HtmlToMarkdown::builder()
.skip_tags(vec!["img"])
.build();
let md = converter.convert("<img src=\"https://example.com\">").unwrap();
// img is ignored
assert_eq!("", md);Implementations§
Source§impl HtmlToMarkdown
impl HtmlToMarkdown
Sourcepub fn builder() -> HtmlToMarkdownBuilder
pub fn builder() -> HtmlToMarkdownBuilder
Create a new HtmlToMarkdownBuilder.
Sourcepub fn tree_to_markdown(&self, tree: &Rc<Node>) -> String
pub fn tree_to_markdown(&self, tree: &Rc<Node>) -> String
Convert a DOM tree to Markdown. For convenience, Node is re-exported;
simply use htmd::Node; to access this type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HtmlToMarkdown
impl !RefUnwindSafe for HtmlToMarkdown
impl Send for HtmlToMarkdown
impl Sync for HtmlToMarkdown
impl Unpin for HtmlToMarkdown
impl UnsafeUnpin for HtmlToMarkdown
impl !UnwindSafe for HtmlToMarkdown
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more