Skip to content

base

Class info

Classes

Name Children Inherits
Backend
mkconvert._core
Base class for Markdown parsers and HTML-to-Markdown converters.
HtmlToMarkdownConverter
mkconvert.converters.base
Base class for HTML -> Markdown converters.
HtmlToMarkdownOptions
mkconvert.converters.base
Common HTML -> Markdown options, mapped onto every converter.
    Options
    mkconvert._core
    Base class for the common option models.

    🛈 DocStrings

    Common options and base class for HTML -> Markdown converters.

    HtmlToMarkdownConverter

    Bases: Backend[HtmlToMarkdownOptions]

    Base class for HTML -> Markdown converters.

    Source code in src/mkconvert/converters/base.py
    class HtmlToMarkdownConverter(Backend[HtmlToMarkdownOptions]):
        """Base class for HTML -> Markdown converters."""
    
        options_class: ClassVar[type[HtmlToMarkdownOptions]] = HtmlToMarkdownOptions
    

    HtmlToMarkdownOptions

    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").