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

angle brackets in nested lists issue #47

Closed
harmstyler opened this issue Dec 4, 2024 · 4 comments · Fixed by #48
Closed

angle brackets in nested lists issue #47

harmstyler opened this issue Dec 4, 2024 · 4 comments · Fixed by #48
Labels
bug Something isn't working

Comments

@harmstyler
Copy link

Hi,
I have a markdown file with rather strange formatting. The gfm formatter seems to error on it. I reduced it to the broken element in hopes it becomes easier to see. Then angle brackets with a period inside appears to be the cause.

1. foo
   1. foo  <user.name> bar
2. bash
@hukkin
Copy link
Owner

hukkin commented Dec 5, 2024

Thanks for the issue! I can confirm this happens.

Proper fix would be replacing linkify dependency with a markdown-it-py plugin that correctly parses GFM autolink extension (can be created in this repository). Linkify matches way more than what's required by the GFM spec, and does it in a peculiar way too, e.g.

<!-- This is text only, no link -->

\<user.name>

<!-- This is a link surrounded by angle brackets (brackets are text, not part of the link) -->

<user.name>

<!-- This is a link surrounded by angle brackets (brackets are text, not part of the link) -->

\<https://python.org>

<!-- This is a link only, no surrounding text brackets -->

<https://python.org>

It's not normal that escaping a preceding character that's not part of the (link) syntax itself will invalidate the syntax. There's a chance that markdown-it (javascript) may want to change this behavior but not sure.

Anyway, currently links that are matched by linkify, but are not CommonMark autolinks, will cause issues to mdformat-gfm if they are surrounded by angle brackets.

@hukkin
Copy link
Owner

hukkin commented Dec 12, 2024

This is fixed in mdformat-gfm >=0.4.0. Instead of linkify-it-py we now use a GFM compatible linkifier.

@hukkin
Copy link
Owner

hukkin commented Dec 12, 2024

I've yanked the release, as the new autolink parser was finding GFM autolinks inside image and link labels, which must not be allowed.

@hukkin hukkin reopened this Dec 12, 2024
@hukkin
Copy link
Owner

hukkin commented Dec 13, 2024

Version 0.4.1 fixes the issue with link and image labels.

@hukkin hukkin closed this as completed Dec 13, 2024
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

Successfully merging a pull request may close this issue.

2 participants