Open slusarz opened 3 months ago
Might be easy to just run lychee or one of the tools mentioned here - https://github.com/lycheeverse/lychee?tab=readme-ov-file#features -- most of these are CLIs and integrating directly in vitepress won't make much sense and will slow you down.
Also, ignoreDeadLinks
can't receive the external links because many of these links cannot be extracted by the markdown parser - for example links added via components, html tags, frontmatter, themeConfig, etc.
Appreciate the quick response and the pointer to the lychee project (that looks fantastic for our use-case...)
Understood now that the existing ignoreDeadLinks
is not built for this ask.
More than willing to do a small MR for documentation that would adapt your explanation, if you think that would be helpful (I have to think we are not the only ones who are looking for this functionality).
Is your feature request related to a problem? Please describe.
During build (or CI) process, external links should be checked for validity.
Currently, VP only checks localhost links. Other external links are just added as-is to the page. See https://github.com/vuejs/vitepress/blob/d837e82bc8bde63df737be2a1290a2e70c8a0bf3/src/node/markdown/plugins/link.ts#L39
Describe the solution you'd like
At a minimum, ignoreDeadLinks callback option should be extended to return ALL links seen during parsing. VP admin can then write their own logic to do link checking.
Example:
Even better would be a way to continue to allow VP to handle localhost link checking and provide an option to handle external links separately.
Even even better might be that external link checking is simply built-in to VP, as an option. (E.g., Sphinx has this ability.). Simple example:
Describe alternatives you've considered
No response
Additional context
More than willing to provide an MR to accomplish this, but since there are so many possibilities on how to allow/enable this I would rather wait for developer input to direct towards the best solution.
Validations