Skip to content

Custom converter functions are not recognized for heading tags #212

Closed

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

Activity

  1. chrispy-snps commented on Apr 12, 2025

    @chrispy-snps
    Collaborator

    @lilacpixel - thank you for reporting this. It is indeed a bug; I will fix it.

  2. changed the title [-]Custom converter does not work for headings[/-] [+]Custom converter functions are not recognized for heading tags[/+] on Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions