Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_https://example.com/a_ not parsed correctly #317

Open
nschloe opened this issue Dec 9, 2023 · 3 comments
Open

_https://example.com/a_ not parsed correctly #317

nschloe opened this issue Dec 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@nschloe
Copy link

nschloe commented Dec 9, 2023

Describe the bug

MWE:

from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode

md = MarkdownIt("gfm-like")

# okay:
tokens = md.parse("_https://example.com_")
print(SyntaxTreeNode(tokens).pretty())

# bug:
tokens = md.parse("_https://example.com/a_")
print(SyntaxTreeNode(tokens).pretty())

Output:

<root>
  <paragraph>
    <inline>
      <em>
        <link href='https://example.com'>
          <text>
<root>
  <paragraph>
    <inline>
      <text>
      <link href='https://example.com/a_'>
        <text>

Note how the underscore is incorrectly included in the last link.

Reproduce the bug

See above.

List your environment

No response

@chrisjsewell
Copy link
Member

See #316 (comment)

@tsutsu3
Copy link
Contributor

tsutsu3 commented Dec 23, 2023

@tsutsu3
Copy link
Contributor

tsutsu3 commented Dec 23, 2023

linkify-it-py works the same as linkify-it as specified. This is not a bug.

The solution is to enclose it in <>.
For example, _<https://example.com>_, _<https://example.com/a>_.

See markdown-it demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants