Skip to content

mailto: and tel: links are converted to plain text #2644

Description

_CustomMarkdownify.convert_a keeps only http, https and file links, and reduces any other scheme to the link text. Dropping javascript: links makes sense, but e-mail and phone links are common in documents and can't run code.

import io
from markitdown import MarkItDown

html = b'<p>Contact <a href="mailto:team@example.com">the team</a>.</p>'
print(repr(MarkItDown().convert_stream(io.BytesIO(html), file_extension=".html").markdown))

Actual: 'Contact the team.'

Expected: 'Contact [the team](mailto:team@example.com).'

The attached DOCX has the same link as a Word hyperlink and gives the same result. tel: links are dropped the same way.

markitdown-mailto-link.docx

Environment: markitdown 0.1.8 (main 4cc9fa1), Python 3.14.8, Ubuntu 24.04.5 LTS.

Activity

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