Skip to content

HtmlToMarkdownOptions

Base classes

Name Children Inherits
Options
mkconvert._core
Base class for the common option models.

⋔ Inheritance diagram

graph TD
  2983329459["base.HtmlToMarkdownOptions"]
  849523002["_core.Options"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  849523002 --> 2983329459
  3879467795 --> 849523002
  2751680898 --> 3879467795

🛈 DocStrings

Bases: Options

Common HTML -> Markdown options, mapped onto every converter.

Check HtmlToMarkdownConverter.supported_options for what a converter can change.

Source code in src/mkconvert/converters/base.py
class HtmlToMarkdownOptions(Options):
    """Common HTML -> Markdown options, mapped onto every converter.

    Check `HtmlToMarkdownConverter.supported_options` for what a converter can change.
    """

    heading_style: Literal["atx", "setext"] = "atx"
    """`# Heading` (atx) or underlined headings (setext, h1 / h2 only)."""
    bullet_marker: Literal["-", "*"] = "-"
    """Marker for unordered list items."""
    emphasis_marker: Literal["*", "_"] = "*"
    """Marker for `*emphasis*` and `**strong**`."""
    code_block_style: Literal["fenced", "indented"] = "fenced"
    """Fenced or indented code blocks."""
    code_fence: Literal["```", "~~~"] = "```"
    """Fence for fenced code blocks."""
    line_break: Literal["spaces", "backslash"] = "spaces"
    """`<br>` as two trailing spaces or a trailing backslash."""
    link_style: Literal["inline", "reference"] = "inline"
    """`[text](url)` or `[text][1]` with the URLs collected at the end."""
    skip_tags: tuple[str, ...] = ()
    """Tags to drop together with their content, e.g. `("script", "style")`."""

bullet_marker class-attribute instance-attribute

bullet_marker: Literal['-', '*'] = '-'

Marker for unordered list items.

code_block_style class-attribute instance-attribute

code_block_style: Literal['fenced', 'indented'] = 'fenced'

Fenced or indented code blocks.

code_fence class-attribute instance-attribute

code_fence: Literal['```', '~~~'] = '```'

Fence for fenced code blocks.

emphasis_marker class-attribute instance-attribute

emphasis_marker: Literal['*', '_'] = '*'

Marker for *emphasis* and **strong**.

heading_style class-attribute instance-attribute

heading_style: Literal['atx', 'setext'] = 'atx'

# Heading (atx) or underlined headings (setext, h1 / h2 only).

line_break class-attribute instance-attribute

line_break: Literal['spaces', 'backslash'] = 'spaces'

<br> as two trailing spaces or a trailing backslash.

link_style: Literal['inline', 'reference'] = 'inline'

[text](url) or [text][1] with the URLs collected at the end.

skip_tags class-attribute instance-attribute

skip_tags: tuple[str, ...] = ()

Tags to drop together with their content, e.g. ("script", "style").

:fa-brands-github: Show source on GitHub