Skip to content

Custom converter functions are not recognized for heading tags #212

@lilacpixel

Description

@lilacpixel

When creating custom converters with MarkdownConverter for specific tags, all converters for h1-h6 headings are ignored, and headings are processed according to the standard converter options.

<h1>This is a heading</h1>
<p>This is a paragraph</p>
class FixMarkup(MarkdownConverter):
    def convert_h1(self, el, text, parent_tags):
        return 'Heading override'

def md(html, **options):
    return FixMarkup(**options).convert(html)

markdown = md(html, heading_style='ATX')

Expected output:

Heading override

This is a paragraph

Actual output:

# This is a heading

This is a paragraph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions