MdDecoder

Struct MdDecoder 

Source
pub struct MdDecoder;
Expand description

Markdown decoder.

Implementations§

Source§

impl MdDecoder

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.