Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reiddraper/freshlinks
Freshlinks checks that the relative links between your markdown pages are correct, and helps keep them that way!
https://github.com/reiddraper/freshlinks
actions linter markdown parser testing url verification
Last synced: 2 months ago
JSON representation
Freshlinks checks that the relative links between your markdown pages are correct, and helps keep them that way!
- Host: GitHub
- URL: https://github.com/reiddraper/freshlinks
- Owner: reiddraper
- License: mit
- Created: 2020-08-04T03:19:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T10:07:08.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T09:20:42.360Z (8 months ago)
- Topics: actions, linter, markdown, parser, testing, url, verification
- Language: TypeScript
- Homepage:
- Size: 2.35 MB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
Freshlinks checks that the relative links between your markdown pages are correct, and helps keep them that way! You can use Freshlinks as a GitHub Action, where it will annotate your PR and tell you exactly where the mistaken link is. Or, you can use it from the command-line, installed with NPM.
## GitHub Action
The Freshlinks GitHub Action can be installed with adding the following workflow file:
### `.github/workflows/freshlinks.yml`
```yml
name: Freshlinks
on: [push]jobs:
freshlinks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2- name: Freshlinks
uses: reiddraper/[email protected]
with:
# Put in a glob pattern to find the
# files you want Freshlinks to scan
glob: "docs/**/*.md"
# An optional bool to enable link
# suggestions: default to `true`
suggestions: true
# An *optional* error message template
# to provide your own error message to users.
# See the rest of the README for details
error-template: |
Oops! You made a mistake with {{ link }}
{{ #suggestion }}
[Clippy] Maybe try {{ suggested_link }}?
{{ /suggestion }}
```### Error template syntax
A custom error message can be provided, which will be used when creating Check Annotations. This is useful if you'd like to tailor the error message to point to documentation for your organization or project.
The syntax uses [mustache](https://mustache.github.io/) templates, which are documented in more detail on the [manual page](https://mustache.github.io/mustache.5.html).Freshlinks supports the following tags:
- `link`: The broken link, as it appeared in the markdown document
- `suggestion`: A mustache "section", to be used like `{{ #suggestion }} ... {{ /suggestion }}
- `suggested_link`: A suggested 'fix' to the link, used inside of a `suggestion` sectionHere's an example:
```mustache
Oops! You made a mistake with {{ link }}
{{ #suggestion }}
[Clippy] Maybe try {{ suggested_link }}?
{{ /suggestion }}
```The line which suggests an alternative will only be rendered if a suggestion was found.
## Command-line or Node project
Freshlinks can be used programmatically as a library, or from the command-line:
```shell
npm install --save-dev freshlinks
```Freshlinks will scan any files provided as arguments, so you'll frequently use it like:
```
$ git ls-files '*.md' | xargs npx freshlinks
```Freshlinks has pretty colorized output:
## [LICENSE](LICENSE)
Freshlinks is released under the MIT License.
## Changelog
View the [changelog](CHANGELOG.md) to follow new releases.