A CLI tool for interactively fixing links in markdown files
- Interactively view list of markdown files in a repository and links between them
- Support for markdown style links
- Basic configuration of link aliases
- Basic linting for links
The project is still in the early stages of development, at the moment it's only possible to install using go get
go install github.com/sftsrv/lynks@latest
Create a lynks.config.json
file from the directory you want to run the command, It should have the following structure:
{
// root folder from which pages should be resolved
"root": "./src/docs",
// if not provided will defult to `relative`
"resolution": {
"strategy": "root", // options are `root | relative`
"keepExtension": false
},
"aliases": {
// aliases resolve relative to the `root`
// the key can be any value that you use within pages for linking
"@api": "./generated/api"
}
}
There are two ways to run the tool:
You can run the tool interactively in order to browser files and fix links in all markdown files within the root
as defined in the lynks.config.json
by simply running lynks
lynks
The tool can also be run as a linter which will make use of the lynks.config.json
and can be run using:
lynks lint
Some things that I still want to do before considering this project complete:
- Add filter to view only broken links
- Add tests for like everything
- Respect resolution strategy when reading files as well
- Flags for more specific behavior like:
- Interactive "fix" mode
- Better control of linting
- Only show files with errors
- Only show links with errors
- Help, informative errors, etc.
- Management of image and mdx links
- Support for index pages
- Imporove overall UX
- Support links with hashes
- Make resolution more strict
- e.g. will not accept relative links if resolution mode is root