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 links containing link in label are rendered wrong #10333

Open
nsychev opened this issue Oct 24, 2024 · 4 comments
Open

GFM links containing link in label are rendered wrong #10333

nsychev opened this issue Oct 24, 2024 · 4 comments
Labels

Comments

@nsychev
Copy link

nsychev commented Oct 24, 2024

Explain the problem.

Hi! Thanks for your awesome tool.

I'm trying to convert this link using GFM reader:

[https://example.org](https://example.org)

For example, we can use this command:

echo '[https://example.org](https://example.org)' | pandoc -f gfm -t html

I expect output to be the same as in -f markdown:

<p><a href="https://example.org">https://example.org</a></p>

but instead I get this:

<p>[<a
href="https://example.org](https://example.org)">https://example.org](https://example.org)</a></p>

I think pandoc tries to detect links inside square brackets [...] but shouldn't (when I have https://example. it still works fine, but https://example.o is broken).

Pandoc version?

I have pandoc 3.3 locally and reproduced it at https://pandoc.org/try/

@nsychev nsychev added the bug label Oct 24, 2024
@nsychev nsychev changed the title GFM links containing link in label are rendering wrong GFM links containing link in label are rendered wrong Oct 24, 2024
@nsychev
Copy link
Author

nsychev commented Oct 24, 2024

It should be obvious, but the problem is in (enabled by default) extension autolink_bare_uris: if I disable it, everything works fine. But I think it should work even with it being turned on.

@jgm
Copy link
Owner

jgm commented Oct 24, 2024

Yes, agreed. This would need to be changed in jgm/commonmark-hs.
And in fact there is already an issue:
jgm/commonmark-hs#156

@nsychev
Copy link
Author

nsychev commented Oct 24, 2024

Oh, I looked up only over this repository and was surprised that nobody reported it yet.

Should I close this as a duplicate then?

@jgm
Copy link
Owner

jgm commented Oct 24, 2024

I'll keep this open as a reminder. It would be good to fix this.

jgm added a commit to jgm/commonmark-hs that referenced this issue Oct 25, 2024
This at least improves on #156.

We still get a link within a link, which isn't right, but at
least the link goes to the right place.

Cf. jgm/pandoc#10333.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants