🇫🇷 French documentation available here
A tool to check the validity of the http urls in your markdown documents
There are two ways in which you can use this script.
By running it directly from this Github Repositoy. You can run the command :
curl --connect-timeout 10 -fsSL https://raw.githubusercontent.com/Charystag/markdown_links_checker/master/check_links.sh | bash -s -- doc1.md doc2.md ... docN.md
Where doc1..docN are the markdown documents you need to verify
You can also run :
curl --connect-timeout 10 -fsSL https://raw.githubusercontent.com/Charystag/markdown_links_checker/master/check_links.sh | bash -s -- -i ignored doc1.md doc2.md ... docN.md
Where ignored
is a file that contains a list of urls that should be ignored by the script
You can install the script by running:
curl --connect-timeout 10 -fsSL https://raw.githubusercontent.com/Charystag/markdown_links_checker/master/assets/install.sh | bash -s -- $SHELL
You can then use it by running :
markdown-links-checker doc1.md doc2.md ... docN.md
I've basically been generating a lot of content using ChatGPT lately and I asked it a lot of times to put links to documentation as I wanted it to source its affirmations. Some of them were broken and as I continued, I found mindself in need for a quick and easy way to check the validity of the links in a markdown document. That is why I decided to create this small script.
Here is an outline of what the script does :
- It retrieves all the http(s) urls that are formatted as markdown links
- For all these urls, it executes a curl request on this url and checks the response code
- If the response code starts with a 2, the request is considered valid
- Otherwise, the request is considered invalid
- It writes the result on stdout or stderr depending on whether or not the request was successful
For now, the script has difficulties to handle the escaped parenthesis. I hope to fix that in the future but you're
better off ignoring the urls with the -i
option.
Yet to come