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

gfm parsing oddity with links in link text #156

Open
TripleCamera opened this issue Aug 21, 2024 · 1 comment
Open

gfm parsing oddity with links in link text #156

TripleCamera opened this issue Aug 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@TripleCamera
Copy link

Explain the problem.

In gfm, links in link text should not be parsed.

Input:

[https://bilibili.com/](https://bilibili.com/)

Actual output:

<p>[<a
href="https://bilibili.com/](https://bilibili.com/)">https://bilibili.com/](https://bilibili.com/)</a></p>

Expected output:

<p><a href="https://bilibili.com/">https://bilibili.com/</a></p>

Try pandoc!

The bug is in the autolink_bare_uris extension:

C:\Users\EricQiu>pandoc -f gfm-autolink_bare_uris
[https://bilibili.com/](https://bilibili.com/)
^Z
<p><a href="https://bilibili.com/">https://bilibili.com/</a></p>

C:\Users\EricQiu>pandoc -f gfm
[https://bilibili.com/](https://bilibili.com/)
^Z
<p>[<a
href="https://bilibili.com/](https://bilibili.com/)">https://bilibili.com/](https://bilibili.com/)</a></p>

Pandoc version?

pandoc 3.3 (the latest version)

@TripleCamera TripleCamera added the bug Something isn't working label Aug 21, 2024
@jgm jgm transferred this issue from jgm/pandoc Aug 22, 2024
@jgm
Copy link
Owner

jgm commented Aug 22, 2024

Test of gfm behavior:

[[hello](url)](there)

[hello](there)

Here the inner link takes precedence. So, with autolink_bare_uris, it's just the same. The inner link (now an automatically created one) takes precedence. It's a bit hard to see how to avoid this with our current modular structure, where the core (which handles regular links) doesn't know about the autolink_bare_uris extension. I suppose we could do something ad hoc, which is probably what GFM does...

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

2 participants