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

Support MD ref. link style #4

Closed
1 task
jorgeorpinel opened this issue Jun 11, 2021 · 2 comments · Fixed by #6
Closed
1 task

Support MD ref. link style #4

jorgeorpinel opened this issue Jun 11, 2021 · 2 comments · Fixed by #6
Labels
enhancement New feature or request

Comments

@jorgeorpinel
Copy link
Contributor

jorgeorpinel commented Jun 11, 2021

E.g.

[this is a link][link]
or [even shorter]

[link]: /relative/link
[even shorter]:
  http://full.url/link/with/path#and-anchor?why=not
@jorgeorpinel jorgeorpinel transferred this issue from another repository Jun 15, 2021
@jorgeorpinel jorgeorpinel added the enhancement New feature or request label Jun 15, 2021
@jorgeorpinel
Copy link
Contributor Author

Currently for .md(x) files the following regex is used: /\[.*?\]\((?:<((?:\(.*?\)|.)*?)>|((?:\(.*?\)|.)*?))(?: ["'].*?["'])?\)/gm. This targets [link text](/url/or/path) style links.

Instead of complicating the regex to also match ref. links it's probably easier to do another regex match pass for something like /\[.*?\]\:\s*\n?\s*(URL_REGEX_HERE)/gm. That should match [link id]: /url/path style links.

BTW I'd extract the URL_REGEX in both cases for readability.

@jorgeorpinel
Copy link
Contributor Author

Please see https://github.com/iterative/link-check/pull/6/files for an initial proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant