0.6.5 • Published 3 years ago

@sfdocs-internal/no-absolute-links v0.6.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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.

0.6.5

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.120-beta7

3 years ago

0.5.120-beta6

3 years ago

0.5.120-beta5

3 years ago

0.5.120-beta4

3 years ago

0.5.120-beta3

3 years ago

0.5.120-beta2

3 years ago

0.5.120-beta1

3 years ago