Skip to main content

Crate mdka

Crate mdka 

Source
Expand description

HTML to Markdown converter - Lightweight and optimized library.

Usage as CLI tool is in mdka-cli.

Full documentation: https://nabbisen.github.io/mdka-rs/

§Quick start

use mdka::{html_to_markdown, html_to_markdown_with};
use mdka::options::{ConversionMode, ConversionOptions};

// default mode (balanced)
let md = html_to_markdown("<h1>Hello</h1>");
assert!(md.contains("# Hello"));

// convert by specifying the mode
let opts = ConversionOptions::for_mode(ConversionMode::Minimal);
let md = html_to_markdown_with("<h1>Hello</h1>", &opts);
assert!(md.contains("# Hello"));

Re-exports§

pub use options::ConversionMode;
pub use options::ConversionOptions;

Modules§

options
Conversion options and mode definitions

Structs§

FileOutcome
What happened to one file in a bulk conversion.

Enums§

MdkaError

Functions§

html_file_to_markdown
Converts a single HTML file to Markdown (default mode: balanced).
html_file_to_markdown_with
Converts a single HTML file to Markdown with the given ConversionOptions.
html_files_to_markdown
Converts multiple HTML files, writing them to out_dir (default mode). Parallel across CPU cores when the parallel feature is on (the default); sequential otherwise – this function exists either way (RFC 039 §2.4, §3 A4): opting out of parallelism changes only how the work is done, never which functions are available.
html_files_to_markdown_with
Converts multiple HTML files with the given ConversionOptions, writing them to out_dir. Parallel when the parallel feature is on; sequential otherwise – see html_files_to_markdown.
html_to_markdown
Converts an HTML string to a Markdown string (default mode: balanced).
html_to_markdown_many
Converts multiple HTML strings to Markdown (default mode: balanced), each independently.
html_to_markdown_many_with
Converts multiple HTML strings to Markdown with the given ConversionOptions, each independently. It cannot fail, so it returns plain strings, not a result type (RFC 039 §3 A2). Parallel across CPU cores when the parallel feature is on (the default); sequential otherwise – this function exists either way, only how it runs changes (RFC 039 §2.4, §3 A2).
html_to_markdown_with
Converts an HTML string to Markdown with the given ConversionOptions.
version
The crate’s version, as declared in Cargo.toml. Node and Python have long had their own; Rust callers had to reach for CARGO_PKG_VERSION themselves (RFC 039 §2.5, §3 A5).