https://github.com/artyom/mdlinks
Markdown cross-document links checker
https://github.com/artyom/mdlinks
github-action go golang linter markdown
Last synced: about 1 month ago
JSON representation
Markdown cross-document links checker
- Host: GitHub
- URL: https://github.com/artyom/mdlinks
- Owner: artyom
- License: mit
- Created: 2022-01-01T18:10:42.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-17T12:03:45.000Z (almost 4 years ago)
- Last Synced: 2025-07-01T05:01:59.471Z (12 months ago)
- Topics: github-action, go, golang, linter, markdown
- Language: Go
- Homepage: https://pkg.go.dev/github.com/artyom/mdlinks
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mdlinks
This repository provides [Go package](https://pkg.go.dev/github.com/artyom/mdlinks), [command-line tool](#command-line-tool), and [a GitHub Action](#github-action)
that can verify cross-document links in a collection of markdown files.
Code scans markdown files for domain-less links and checks if referenced files exist.
For example, if a file “doc1.md” has a link with “../img.png” target,
this tool will check whether the “img.png” file exists in a “doc1.md” file parent directory.
If a link references an existing markdown document and has a fragment part,
this tool checks that such a link points to an existing markdown header,
following similar (but not exactly matching) rules of unique ID generating as GitHub markdown rendering.
For example, use the `#table-of-contents` link fragment to reference the “Table of Contents” header.
Using special symbols or extra formatting in the header will likely produce an ID that differs from what GitHub could have generated.
## Command-line tool
Install it like:
```sh
go install github.com/artyom/mdlinks/cmd/mdlinks@latest
```
## GitHub Action
When using default settings (scan the repository root directory, look for `*.md` files),
you can use this action like this:
```yaml
on:
push:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: artyom/mdlinks@main
```
You can customize what directory to scan and which files to match:
```yaml
- uses: artyom/mdlinks@main
with:
dir: 'docs'
glob: '*.markdown'
```