@sfdocs-internal/no-absolute-links v0.6.5
No absolute cross references in markdown.
What/why
We shouldn't allow absolute links for cross references in markdown files.
Reason
In order to validate absolute link we need to run server but this is not possible at the time of yarn validate
for now.
Recommendation
Always use relative links from the current markdown. So all internal links should start with either ./
or ../
or just with the name of the markdown if its in the current directory.
More information
This linter works acts as another layer to remark-validate-links.
The main problem with the above linter is that if an absolute link is added in markdown and config.host is blank, it will not validate the link. So, we are adding a check with this linter.
Here is the actual snippet
## from find.js
if (value.charAt(0) === slash) {
if (!config.hostname) { ## As we are sending it as null, absolute links are not getting validated.
return
}
// Create a URL.
value = https + slashes + config.hostname + value
}
How to setup
Install & build
yarn install && yarn build
Pubilsh
yarn publish
Please make sure to push your changes (version number & other changes) to git once publishing is complete.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago