Expand description
§turndown-cdp
Convert CDP-style DOM nodes to Markdown.
This is a Rust implementation inspired by turndown, providing a similar API for converting DOM trees to Markdown.
§Design
This library accepts a CDP-style DOM Node structure (matching Chrome DevTools Protocol). This design allows:
- Zero parsing overhead: When DOM is already available (e.g., from CDP/chromiumoxide)
- Parser agnostic: Any HTML parser can convert to the Node structure
- Minimal dependencies: No HTML parser bundled
§Example
use turndown_cdp::{TurndownService, Node};
let service = TurndownService::new();
// Create a simple DOM tree
let mut h1 = Node::element("h1");
h1.add_child(Node::text("Hello World"));
let markdown = service.turndown(&h1).unwrap();
assert!(markdown.contains("Hello World"));Re-exports§
Modules§
- node
- CDP-style DOM Node structure for HTML to Markdown conversion.
Structs§
- Turndown
Options - Options for Markdown serialization
- Turndown
Service - The main service for converting DOM nodes to Markdown
Enums§
- Code
Block Style - Code block style options
- Heading
Style - Heading style options
- Link
Reference Style - Reference style for referenced links
- Link
Style - Link style options
- Turndown
Error - Error type for turndown operations