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

Markdown footnotes incorrectly recognized as URL references #3663

Open
yihui opened this issue Mar 29, 2023 · 0 comments · May be fixed by #3664
Open

Markdown footnotes incorrectly recognized as URL references #3663

yihui opened this issue Mar 29, 2023 · 0 comments · May be fixed by #3664

Comments

@yihui
Copy link

yihui commented Mar 29, 2023

Information:

  • Prism version: 1.29.0
  • Plugins: none
  • Environment: Browser

Description

Markdown footnotes are incorrectly recognized as URL references, e.g., the text [^1]: This in the example below:

A footnote[^1].

[^1]: This is a footnote and not a URL.

I think the regex here needs to be enhanced:

// [id]: http://example.com "Optional title"
// [id]: http://example.com 'Optional title'
// [id]: http://example.com (Optional title)
// [id]: <http://example.com> "Optional title"
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,

Example

https://prismjs.com/test.html#language=markdown&text=A%20footnote%5B%5E1%5D.%0A%0A%5B%5E1%5D%3A%20This%20is%20a%20footnote%20and%20not%20a%20URL.

yihui added a commit to yihui/prism that referenced this issue Mar 29, 2023
@yihui yihui linked a pull request Mar 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant