Skip to main content

ConversionOptions

Struct ConversionOptions 

Source
pub struct ConversionOptions {
Show 32 fields pub heading_style: HeadingStyle, pub list_indent_type: ListIndentType, pub list_indent_width: usize, pub bullets: String, pub strong_em_symbol: char, pub escape_asterisks: bool, pub escape_underscores: bool, pub escape_misc: bool, pub escape_ascii: bool, pub code_language: String, pub autolinks: bool, pub default_title: bool, pub br_in_tables: bool, pub hocr_spatial_tables: bool, pub highlight_style: HighlightStyle, pub extract_metadata: bool, pub whitespace_mode: WhitespaceMode, pub strip_newlines: bool, pub wrap: bool, pub wrap_width: usize, pub convert_as_inline: bool, pub sub_symbol: String, pub sup_symbol: String, pub newline_style: NewlineStyle, pub code_block_style: CodeBlockStyle, pub keep_inline_images_in: Vec<String>, pub preprocessing: PreprocessingOptions, pub encoding: String, pub debug: bool, pub strip_tags: Vec<String>, pub preserve_tags: Vec<String>, pub skip_images: bool,
}
Expand description

Main conversion options for HTML to Markdown conversion.

Fields§

§heading_style: HeadingStyle

Heading style (Underlined, Atx, AtxClosed)

§list_indent_type: ListIndentType

List indentation type (Spaces or Tabs)

§list_indent_width: usize

List indentation width in spaces (applied if using spaces indentation)

§bullets: String

Bullet characters for unordered lists (e.g., “-”, “*”, “+”)

§strong_em_symbol: char

Symbol for strong/emphasis emphasis rendering (* or _)

§escape_asterisks: bool

Escape asterisks (*) in text to prevent accidental formatting

§escape_underscores: bool

Escape underscores (_) in text to prevent accidental formatting

§escape_misc: bool

Escape miscellaneous markdown characters (\ & < ` [ > ~ # = + | -)

§escape_ascii: bool

Escape all ASCII punctuation characters (for CommonMark spec compliance tests)

§code_language: String

Default code language for fenced code blocks when not specified

§autolinks: bool

Use autolinks syntax for bare URLs (http://example.com)

§default_title: bool

Add default title element to HTML if none exists before conversion

§br_in_tables: bool

Use HTML
elements in tables instead of spaces for line breaks

§hocr_spatial_tables: bool

Enable spatial table reconstruction in hOCR documents (via spatial positioning analysis)

§highlight_style: HighlightStyle

Highlight style for elements (DoubleEqual, Html, Bold, None)

§extract_metadata: bool

Extract metadata from HTML (title, description, images, links, etc.)

§whitespace_mode: WhitespaceMode

Whitespace handling mode (Normalized collapses multiple spaces, Strict preserves)

§strip_newlines: bool

Strip newline characters from HTML before processing

§wrap: bool

Enable automatic text wrapping at wrap_width

§wrap_width: usize

Text wrapping width in characters (default 80)

§convert_as_inline: bool

Treat block-level elements as inline during conversion

§sub_symbol: String

Custom symbol for subscript content (e.g., “~”)

§sup_symbol: String

Custom symbol for superscript content (e.g., “^”)

§newline_style: NewlineStyle

Newline style in markdown output (Spaces adds two spaces, Backslash adds )

§code_block_style: CodeBlockStyle

Code block fence style (Indented, Backticks, Tildes)

§keep_inline_images_in: Vec<String>

HTML elements where images should remain as markdown links (not converted to alt text)

§preprocessing: PreprocessingOptions

HTML preprocessing options (remove nav, forms, etc.)

§encoding: String

Source document encoding (informational, typically “utf-8”)

§debug: bool

Enable debug mode with diagnostic warnings on conversion issues

§strip_tags: Vec<String>

HTML tags to strip (extract text content, no markdown conversion)

§preserve_tags: Vec<String>

HTML tags to preserve as-is in output (keep original HTML, useful for complex tables)

§skip_images: bool

Skip all images during conversion. When enabled, all <img> elements are completely omitted from output. Useful for text-only extraction or filtering out visual content.

Implementations§

Source§

impl ConversionOptions

Source

pub fn apply_update(&mut self, update: ConversionOptionsUpdate)

Apply a partial update to these conversion options.

Any specified fields in the update will override the current values. Unspecified fields (None) are left unchanged.

§Arguments
  • update - Partial options update with fields to override
Source

pub fn from_update(update: ConversionOptionsUpdate) -> Self

Create new conversion options from a partial update.

Creates a new ConversionOptions struct with defaults, then applies the update. Fields not specified in the update keep their default values.

§Arguments
  • update - Partial options update with fields to set
§Returns

New ConversionOptions with specified updates applied to defaults

Trait Implementations§

Source§

impl Clone for ConversionOptions

Source§

fn clone(&self) -> ConversionOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConversionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConversionOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ConversionOptions

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<ConversionOptionsUpdate> for ConversionOptions

Source§

fn from(update: ConversionOptionsUpdate) -> Self

Converts to this type from the input type.
Source§

impl Serialize for ConversionOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,