This is a collection of lychee remap expressions.
The --remap option rewrites URLs into other URLs. It takes a list of space-separated pairs of strings.
The first string is the old URL regex pattern and the second string is the new URL regex pattern.
Click here for more details.
In the following example, any match of example.com is replaced with example.org:
lychee --remap 'example.com example.org' -- https://example.com/sitemap.xml You can use this option multiple times to remap multiple domains and you can use regular expressions.
Remap is a powerful feature. Instead of just replacing domains, you can also use regular expressions to replace parts of the URL.
For more information about the --remap option,
check out the documentation at https://lychee.cli.rs and see #620, #1129, and the example config file.
When testing a deployed website using links from pre-deployed files or a base repository, two key mappings are required:
- File Extension Mapping: Convert pre-deployed file extensions to post-deployed file extensions (e.g., .md to .html).
- URL Mapping: Change the protocol and base domain components of the URL from
file://local/pathtohttps://www.my-deployed-site.com(orhttp://).
lychee --base https://www.my-deployed-site.com --remap '(.*)\.md $1.html' index.md
This can be useful when working with github sites that are generated from markdown.
The lychee documentation itself can be tested in this manner; from the root of the repo cloned from https://github.com/lycheeverse/lycheeverse.github.io, execute:
lychee --base https://lychee.cli.rs --remap '(.*)\.md $1.html' --exclude-path src/content/docs/CONTRIBUTING.md "src/content/docs/**/*.mdx" "src/content/docs/**/*.md"
Note that in this case we have:
- An
.mdfile we exclude because we are intentionally linking to a.mdfile. - Two path arguments because some repo files are
.mdand some are.mdx
Stack Overflow implements Cloudflare bot detection that blocks automated link checkers. Use the Stack Exchange API as a workaround:
lychee --remap 'stackoverflow.com/questions/(\d+)/.* api.stackexchange.com/2.3/questions/$1?site=stackoverflow'Please contribute your own remap expressions here! You can just edit this file and create a pull request.