-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to a checker for markdown links #167
Comments
This is a great idea. One thing that we may want to do is providing a git-hook which runs the check before commit or push events, because being Raneto a running service, you |
@stickgrinder I added a drawbacks section and published a working experiment in |
can you please open a draft PR with your work so I can review it with ease? |
Here is my enhanced fork of markdown-link-validator: https://github.com/jenkin/markdown-link-validator/tree/feature/sparkfabrik-enhancements. All fixes merged in #170 come from that enhanced version. |
Using [markdown-link-validator](https://github.com/jenkin/markdown-link-validator/tree/feature/sparkfabrik-enhancements) from github repo.
Using [markdown-link-validator](https://github.com/jenkin/markdown-link-validator/tree/feature/sparkfabrik-enhancements) from github repo. Build the docker image and run validation with `make check`.
All fixes proposed in #172 come from enhanced version of markdown-link-validator. In #173 it is integrated in playbook |
Using [markdown-link-validator](https://github.com/jenkin/markdown-link-validator/tree/feature/sparkfabrik-enhancements) from github repo. Build the docker image and run validation with `make check`.
See [issues/167#issuecomment-1589456767](#167 (comment)).
* refs #167: add support to link check Using [markdown-link-validator](https://github.com/jenkin/markdown-link-validator/tree/feature/sparkfabrik-enhancements) from github repo. Build the docker image and run validation with `make check`. * refs #167: update link checker * refs #167: add pre-commit hook See [issues/167#issuecomment-1589456767](#167 (comment)).
@jenkin I merged this, will try and do some testing adding stuff to the pages you created, before closing the card. |
Co-authored-by: Alessio Cimarelli <[email protected]>
Problem
Links in markdown (ie.
[anchor](absolute url or relative local path)
) can be broken. Raneto doesn't have a built-in link checker or doesn't support custom plugins.Requirements
A link checker validating both external links (ie.
https://...
) and relative local path (ie.../dir/page.md
) with anchors (ie.../dir/page.md#chapter-1
).Proposed solution
There are many tools available to validate links in html or markdown files, ie. markdown-link-validator. We can integrate it in Makefile.
check: npx --yes markdown-link-validator ./content
So we can check all links running
make check
.Output.
Drawbacks
For markdown-link-validator a valid internal link should have a relative path (no leading
/
) and a.md
extension (see https://github.com/webhintio/markdown-link-validator/blob/main/src/lib/mdfile.ts#L178).Alternatives
markdown-link-validator
, no built-in support for directory recursive (see docs), it compiles markdown to html using markdown-link-extractor and extracts links from it using html-link-extractorThe text was updated successfully, but these errors were encountered: