Custom rule for markdownlint to validate relative links. https://www.npmjs.com/package/markdownlint-rule-relative-links
Go to file
2023-05-13 16:03:06 +02:00
.github build(deps): update latest 2023-05-13 16:03:06 +02:00
.husky chore: initial commit 2023-01-02 15:23:16 +01:00
.vscode chore: initial commit 2023-01-02 15:23:16 +01:00
src fix: ignore absolute paths /absolute/path 2023-04-02 21:10:47 +02:00
test fix: ignore absolute paths /absolute/path 2023-04-02 21:10:47 +02:00
.commitlintrc.json chore: initial commit 2023-01-02 15:23:16 +01:00
.editorconfig chore: initial commit 2023-01-02 15:23:16 +01:00
.eslintrc.json chore: initial commit 2023-01-02 15:23:16 +01:00
.gitattributes chore: initial commit 2023-01-02 15:23:16 +01:00
.gitignore chore: initial commit 2023-01-02 15:23:16 +01:00
.lintstagedrc.json chore: initial commit 2023-01-02 15:23:16 +01:00
.markdownlint-cli2.jsonc build(deps): update latest 2023-05-13 16:03:06 +02:00
.npmrc chore: initial commit 2023-01-02 15:23:16 +01:00
.prettierrc.json chore: initial commit 2023-01-02 15:23:16 +01:00
.releaserc.json chore: initial commit 2023-01-02 15:23:16 +01:00
.taprc chore: initial commit 2023-01-02 15:23:16 +01:00
CODE_OF_CONDUCT.md build(deps): update latest 2023-05-13 16:03:06 +02:00
CONTRIBUTING.md build(deps): update latest 2023-05-13 16:03:06 +02:00
LICENSE chore: initial commit 2023-01-02 15:23:16 +01:00
package-lock.json build(deps): update latest 2023-05-13 16:03:06 +02:00
package.json build(deps): update latest 2023-05-13 16:03:06 +02:00
README.md build(deps): update latest 2023-05-13 16:03:06 +02:00

markdownlint-rule-relative-links

Custom rule for markdownlint to validate relative links.

Licence MIT Contributor Covenant

Conventional Commits semantic-release npm version

📜 About

markdownlint-rule-relative-links is a markdownlint custom rule to validate relative links.

It ensures that relative links (using file: protocol) are working and not "dead" which means that it exists in the file system of the project that uses markdownlint.

Example

File structure:

├── abc.txt
└── awesome.md

With awesome.md content:

[abc](./abc.txt)

[Dead link](./dead.txt)

Running markdownlint-cli2 with markdownlint-rule-relative-links will output:

awesome.md:3 relative-links Relative links should be valid [Link "./dead.txt" is dead]

Prerequisites

Installation

npm install --save-dev markdownlint-rule-relative-links

Configuration

There are various ways markdownlint can be configured using objects, config files etc. For more information on configuration refer to options.config.

We recommend configuring markdownlint-cli2 over markdownlint-cli for compatibility with the vscode-markdownlint extension.

.markdownlint-cli2.jsonc

{
  "config": {
    "default": true,
    "relative-links": true
  },
  "globs": ["**/*.{md,mdx}"],
  "ignores": ["**/node_modules"],
  "customRules": ["markdownlint-rule-relative-links"]
}

package.json

{
  "scripts": {
    "lint:markdown": "markdownlint-cli2"
  }
}

Usage

npm run lint:markdown

💡 Contributing

Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.

The steps to contribute can be found in the CONTRIBUTING.md file.

📄 License

MIT