pub struct MdDecoder;Expand description
Markdown decoder.
Implementations§
Source§impl MdDecoder
impl MdDecoder
Sourcepub fn decode(markdown: &str, template: &Template) -> MdResult<MdDocument>
pub fn decode(markdown: &str, template: &Template) -> MdResult<MdDocument>
Decodes markdown into a Core draft document and its style registry.
The template is used for paragraph/character style index mapping.
Built-in template inheritance (default/gov_proposal) is resolved
automatically.
Sourcepub fn decode_lossless(markdown: &str) -> MdResult<Document>
pub fn decode_lossless(markdown: &str) -> MdResult<Document>
Decodes lossless markdown output back into a Core draft document.
This parses the lossless HTML-like body produced by
crate::MdEncoder::encode_lossless, preserving paragraph/run shape IDs
and control/table structures.
Sourcepub fn decode_with_default(markdown: &str) -> MdResult<MdDocument>
pub fn decode_with_default(markdown: &str) -> MdResult<MdDocument>
Decodes markdown using the built-in default template.
This is a convenience wrapper around Self::decode that uses
builtin_default()
so callers don’t need to construct a template manually.
Sourcepub fn decode_file(
path: impl AsRef<Path>,
template: &Template,
) -> MdResult<MdDocument>
pub fn decode_file( path: impl AsRef<Path>, template: &Template, ) -> MdResult<MdDocument>
Reads a markdown file and decodes it into a Core draft document with styles.
Files larger than 50 MB are rejected with MdError::FileTooLarge.
Sourcepub fn decode_file_with_default(path: impl AsRef<Path>) -> MdResult<MdDocument>
pub fn decode_file_with_default(path: impl AsRef<Path>) -> MdResult<MdDocument>
Reads a markdown file and decodes it using the built-in default template.
Files larger than 50 MB are rejected with MdError::FileTooLarge.
Sourcepub fn decode_lossless_file(path: impl AsRef<Path>) -> MdResult<Document>
pub fn decode_lossless_file(path: impl AsRef<Path>) -> MdResult<Document>
Reads a lossless markdown file and decodes it into a Core draft document.
Files larger than 50 MB are rejected with MdError::FileTooLarge.