Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Markdown Image link that has title text with escaped quotation is not recognized #305

Open
Labels
bugSomething isn't working
@krisyang1125

Description

Describe the bug

When I have a markdown image like this where the title contains the same escaped quotation mark as the one it's nested in, the parser will fail to parse the node as an markdown image
![panda dancing with cat](https://i.imgur.com/img.jpg 'title\'')

I expected the markdown image link to be recognize as image node type

I use this parser to extract image links from markdown text and host them on my server for security reasons. This false negative is not ideal for my use case.

Let me know if you need any other info. Thanks

Reproduce the bug

text = """![panda dancing with cat](https://i.imgur.com/img.jpg 'title\'')"""
md = MarkdownIt("gfm-like")
syntax_tree = SyntaxTreeNode(md.parse(text))
# Traverse the tree and check if a tree node of image type exists

List your environment

Version of markdown-it-py: 3.0.0
Versions of mdit-py-plugins: 0.3.5
The version of Python you're using: 3.9
Your operating system: Ubuntu 18.04.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /