You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
ignoreDeadLinks: [
(url) => {
if (external_URL) {
// Do link checking, i.e. with 'link-check' npm package
} elseif (localhost_URL) {
// Handle localhost checking.
}
}
],
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:
import 'linkCheck' from 'link-check'
// ...
linkCheck(url_to_check, function (err, result) {
if (err) {
throw new Error('Invalid Link: ' + err)
}
});
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.
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
vitepress/src/node/markdown/plugins/link.ts
Line 39 in d837e82
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
The text was updated successfully, but these errors were encountered: