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

Non-link footnotes in markdown are reported as broken links. #1409

Open
jan-ferdinand opened this issue Apr 22, 2024 · 5 comments
Open

Non-link footnotes in markdown are reported as broken links. #1409

jan-ferdinand opened this issue Apr 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@jan-ferdinand
Copy link

jan-ferdinand commented Apr 22, 2024

Consider the following file /tmp/file.md:

Some[^1] text.

[^1]: short

Running lychee . produces the following error

[./file.md]:
✗ [ERR] file:///tmp/short | Failed: Cannot find file

To the best of my knowledge, short is never a link but always a footnote. It would be nice for these presumed false positives to not occur.

@mre mre added the bug Something isn't working label Apr 23, 2024
@mre
Copy link
Member

mre commented Apr 23, 2024

Oh wow, thanks for reporting. Definitely a bug.
If you have the time, you could add a (failing) unit test here: https://github.com/lycheeverse/lychee/blob/master/lychee-lib/src/extract/markdown.rs
You can use your example Markdown document for the test.
The bug is somewhere in

pub(crate) fn extract_markdown(input: &str, include_verbatim: bool) -> Vec<RawUri> {

@jan-ferdinand
Copy link
Author

I've added a test in #1410. Unfortunately, I can't figure out where extraction of markdown links is happening.

@mre
Copy link
Member

mre commented Apr 26, 2024

Thanks. :)

@jan-ferdinand
Copy link
Author

You're more than welcome. 😊 I'd have liked to give resolution a shot, but couldn't identify where to start. It's probably somewhere in the parser? If so, that's probably more than I can chew right now.

@mre
Copy link
Member

mre commented Apr 26, 2024

Feel free to dive in. But yeah, it's in the markdown parser in pulldown_cmark, which is the crate we're using for it.

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