
lychee
CLIRust 编写的高速异步链接检查器,扫描网站以及 Markdown、HTML 等文件中的失效链接与邮箱地址,支持 JSON 输出和配置文件,另有官方 GitHub Action,常接在文档 CI 里。
⚡ A fast, async, stream-based link checker written in Rust ⚡
Finds broken hyperlinks and mail addresses in websites
and Markdown, HTML, and other file formats!
Available as command-line utility,
library and
GitHub Action.
Table of Contents
- Development
- Installation
- Features
- Commandline usage
- Supported file formats
- Library usage
- Pre-commit Usage
- Contributing to lychee
- Troubleshooting and Workarounds
- Users
- Credits
- License
Development
After installing Rust use Cargo for building and testing.
For Nix we provide a flake so you can use nix develop and nix build.
Installation
View package manager installation instructions
Arch Linux
pacman -S lychee
OpenSUSE Tumbleweed
zypper in lychee
Ubuntu
snap install lychee
Alpine Linux
# available for Alpine Edge in testing repositories
apk add lychee
macOS
Via Homebrew:
brew install lychee
Via MacPorts:
sudo port install lychee
Docker
docker pull lycheeverse/lychee
Image tags (each also has an -alpine variant, e.g. latest-alpine):
| Tag | Description |
|---|---|
latest | Most recent stable release (recommended) |
X.Y.Z / X.Y | A specific release, e.g. 0.20.0 / 0.20 |
nightly | Bleeding-edge build from the master branch |
master | Alias of nightly |
sha-<sha> | Build for a specific commit |
Nix
nix-shell -p lychee
Or let Nix even check a packaged site with testers.lycheeLinkCheck { site = …; }
FreeBSD
pkg install lychee
Termux
pkg install lychee
Conda
conda install lychee -c conda-forge
Windows
Via scoop:
scoop install lychee
Via WinGet:
winget install --id lycheeverse.lychee
Via Chocolatey:
choco install lychee
GitHub Actions
A GitHub Action that runs lychee is available as lycheeverse/lychee-action. See the lychee-action repository for usage instructions.
Pre-built binaries
We provide binaries for Linux, macOS, and Windows for every release. You can download them from the releases page.
You can also use cargo-binstall
to install these binaries:
cargo binstall lychee
Cargo
Build dependencies
On APT/dpkg-based Linux distros (e.g. Debian, Ubuntu, Linux Mint and Kali Linux)
the following commands will install all required build dependencies, including
the Rust toolchain and cargo:
curl -sSf 'https://sh.rustup.rs' | sh
apt install gcc pkg-config libc6-dev libssl-dev
Compile and install lychee
cargo install lychee
Feature flags
Lychee supports the following feature flags:
email-checkenables checking email addresses using the mailify-lib crate.check_example_domainsallows checking example domains such asexample.com. This feature is useful for testing.
By default, email-check is enabled.
Note that in the past lychee could be configured to use either OpenSSL or Rustls.
It was decided
to fully switch to Rustls and drop OpenSSL support.
Please tell us if this negatively affects you in any way.
Features
This comparison is made on a best-effort basis. Please create a PR to fix outdated information.
See the lychee website for a guide to lychee's features. Also see the command-line flags for the options you can use to customise lychee.
| lychee | awesome_bot | muffet | broken-link-checker | linkinator | linkchecker | markdown-link-check | fink | |
|---|---|---|---|---|---|---|---|---|
| Language | Rust | Ruby | Go | JS | TypeScript | Python | JS | PHP |
| Async/Parallel | ||||||||
| Static binary | ️ | |||||||
| Check Markdown files | ||||||||
| Check HTML files | ||||||||
| Check text files | ||||||||
| Check a website | ||||||||
| File globbing | ||||||||
| User interface | ||||||||
| Progress bar | ||||||||
| Colored output | ||||||||
| Summary | ||||||||
| Quiet mode | ||||||||
| JSON output | ||||||||
| Config file | ||||||||
| Use as library | ||||||||
| Selecting links | ||||||||
| Include patterns | ||||||||
| Exclude patterns | ||||||||
| Filter by scheme | ||||||||
| Skip private domains | ||||||||
| HTTP features | ||||||||
| Custom user agent | ||||||||
| Basic Auth | ||||||||
| Filter status code | ||||||||
| Custom headers | ||||||||
| Custom timeout | ||||||||
HEAD requests | ||||||||
| Handle redirects | ||||||||
| Per-host throttling | ||||||||
| Respect rate limits | ||||||||
| Retry and backoff | ||||||||
| Ignore insecure SSL | ||||||||
| Chunked encodings | ||||||||
| GZIP compression | ||||||||
| Cookies | ||||||||
| URL features | ||||||||
| Relative URLs | ||||||||
| URL anchor fragments | ||||||||
| URL text fragments | ||||||||
| E-mail addresses | ||||||||
| Other | ||||||||
| Recursion | ||||||||
| Amazing lychee logo |
* May need configuration. Click the icon for more information.
Commandline usage
# recursively check all links in supported files inside the current directory
lychee .
# check links in specific local file(s):
lychee README.md test.html info.txt
# check links on a website:
lychee https://endler.dev
For more examples check out our usage guide.
Docker Usage
Here's how to mount a local directory into the container and check some input with lychee.
- The
--initparameter is passed so that lychee can be stopped from the terminal. - We also pass
-itto start an interactive terminal, which is required to show the progress bar. - The
--rmremoves not used anymore container from the host after the run (self-cleanup). - The
-w /inputpoints to/inputas the default workspace - The
-v $(pwd):/inputdoes local volume mounting to the container for lychee access.
By default a Debian-based Docker image is used. If you want to run an Alpine-based image, use the
latest-alpinetag. For example,lycheeverse/lychee:latest-alpine
Linux/macOS shell command
docker run --init -it --rm -w /input -v $(pwd):/input lycheeverse/lychee README.md
Windows PowerShell command
docker run --init -it --rm -w /input -v ${PWD}:/input lycheeverse/lychee README.md
GitHub Token
To avoid getting rate-limited while checking GitHub links, you can optionally
set an environment variable with your GitHub token like so GITHUB_TOKEN=xxxx,
or use the --github-token CLI option. It can also be set in the config file.
Here is an example config file.
The token can be generated on your GitHub account settings page. A personal access token with no extra permissions is enough to be able to check public repo links.
For more scalable organization-wide scenarios you can consider a GitHub App. It has a higher rate limit than personal access tokens but requires additional configuration steps on your GitHub workflow. Please follow the GitHub App Setup example.
Commandline Parameters
Use lychee --help or man lychee to see all available command line parameters.
View full help message
Exit codes
0 Success. The operation was completed successfully as instructed.
1 Missing inputs or any unexpected runtime failures or configuration errors
2 Link check failures. At least one non-excluded link failed the check.
3 Encountered errors in the config file.
Ignoring and excluding links
You can exclude links from getting checked by specifying regex patterns
with --exclude (e.g. --exclude example\.(com|org)) or by putting
them into a file called .lycheeignore.
To exclude files and directories from being scanned use --exclude-path.
For more detailed explanations, check out our comprehensive
guide on excluding links.
Caching
If the --cache flag is set, lychee will cache responses in a file called
.lycheecache in the current directory. If the file exists and the flag is set,
then the cache will be loaded on startup. This can greatly speed up future runs.
Note that by default lychee will not store any data on disk.
This is explained in more detail in our documentation.
Configuration file schema
The generated JSON schema provides configuration key completion, hover documentation, and validation in compatible TOML editors such as Taplo.
Generate a schema matching your installed version of lychee:
lychee --generate config-schema > lychee.schema.json
Then add this directive at the top of lychee.toml. The path is relative to the
config file:
#:schema ./lychee.schema.json
Alternatively, reference the development schema directly:
#:schema https://raw.githubusercontent.com/lycheeverse/lychee/master/docs/schema.json
The schema is generated from the Rust configuration types. After changing them, regenerate it from the repository root:
cargo run --locked --bin lychee -- --generate config-schema > docs/schema.json
Supported file formats
lychee supports HTML and Markdown file formats. For any other file format, lychee falls back to a "plain text" mode. This means that linkify attempts to extract URLs on a best-effort basis.
For non-plaintext files (pdf, epub, docx, etc.) or for files
which don't work well with the fallback extraction method (csv, ipynb, etc.)
you can make use of the --preprocess option.
Take a look at lychee-all for more information.
Library usage
You can use lychee as a library for your own projects!
Take a look at the library documentation.
Also check out the examples directory for small practical examples.
These examples can be run with cargo run --example <example>.
Pre-commit Usage
Lychee can also be used as a pre-commit hook.
# .pre-commit-config.yaml
repos:
- repo: https://github.com/lycheeverse/lychee.git
rev: v0.15.1
hooks:
- id: lychee
# Optionally include additional CLI arguments
args: ["--no-progress", "--exclude", "file://"]
Rather than running on staged-files only, Lychee can be run against an entire repository.
- id: lychee
args: ["--no-progress", "."]
pass_filenames: false
Contributing to lychee
We'd be thankful for any contribution.
We try to keep the issue tracker up-to-date so you can quickly find a task to work on.
Try one of these links to get started:
For more detailed instructions, head over to CONTRIBUTING.md.
Troubleshooting and Workarounds
We collect a list of common workarounds for various websites in our troubleshooting guide.
Users
Here is a list of some notable projects who are using lychee.
- https://github.com/InnerSourceCommons/InnerSourcePatterns
- https://github.com/opensearch-project/OpenSearch
- https://github.com/ramitsurana/awesome-kubernetes
- https://github.com/papers-we-love/papers-we-love
- https://github.com/pingcap/docs
- https://github.com/microsoft/WhatTheHack
- https://github.com/nix-community/awesome-nix
- https://github.com/balena-io/docs
- https://github.com/launchdarkly/LaunchDarkly-Docs
- https://github.com/pawroman/links
- https://github.com/analysis-tools-dev/static-analysis
- https://github.com/analysis-tools-dev/dynamic-analysis
- https://github.com/mre/idiomatic-rust
- https://github.com/bencherdev/bencher
- https://github.com/sindresorhus/execa
- https://github.com/tldr-pages/tldr-maintenance
- https://github.com/git-ecosystem/git-credential-manager
- https://github.com/git/git-scm.com
- https://github.com/OWASP/threat-dragon
- https://github.com/oxc-project/oxc
- https://github.com/hugsy/gef
- https://github.com/mermaid-js/mermaid
- https://github.com/hashicorp/consul
- https://github.com/Unleash/unleash
- https://github.com/fastify/fastify
- https://github.com/nuxt/nuxt
- https://github.com/containerd/containerd
- https://github.com/rolldown/rolldown
- https://github.com/rerun-io/rerun
- https://github.com/0xAX/asm
- https://github.com/mainmatter/100-exercises-to-learn-rust
- https://github.com/GoogleCloudPlatform/generative-ai
- https://github.com/DioxusLabs/dioxus
- https://github.com/ministryofjustice/modernisation-platform
- https://github.com/orhun/binsider
- https://github.com/NVIDIA/aistore
- https://github.com/gradle/gradle
- https://github.com/duobaseio/forui
- https://github.com/FreeBSD-Ask/FreeBSD-Ask
- https://github.com/prosekit/prosekit
- https://github.com/tldr-pages/tldr
- https://gitlab.torproject.org/tpo/web/marble/support
- https://github.com/oxsecurity/megalinter (ships lychee as one of its bundled linters: https://megalinter.io/latest/descriptors/spell_lychee/)
- https://github.com/lycheeverse/lychee (yes, lychee is checked with lychee 🤯)
If you are using lychee for your project, please add it here.
Credits
The first prototype of lychee was built in episode 10 of Hello Rust. Thanks to all GitHub and Patreon sponsors for supporting the development since the beginning. Also, thanks to all the great contributors who have since made this project more mature.
lychee received financial support through the NGI0 Core Fund, established by NLnet with financial support from the European Commission's Next Generation Internet programme. NLnet is supporting the open internet since 1997.
License
lychee is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/license/MIT)
at your option.
🔼 Back to top
相关资源

AutoCorrect
CLI自动纠正中英文(CJK)混排的空格与全半角标点,识别 Markdown、YAML、源码字符串与注释等 28 种以上文件;lint 模式输出 diff 或 JSON,便于接入 CI 检查文案。
huacnlee/autocorrect1.7k
Hugo
CLI用 Go 编写的静态站点生成器,把 Markdown 内容在数秒内构建成文档站、博客或落地页,自带本地预览服务器以及图片、CSS 与 JS 处理管线。
gohugoio/hugo90.1k
Lighthouse
CLIGoogle Chrome 团队官方的网页审计工具,命令行即可对页面跑性能、无障碍、最佳实践与 SEO 评分,输出 HTML / JSON / CSV 报告,便于 agent 循环优化网页。需要 Node 22+ 与 Chrome。
GoogleChrome/lighthouse30.9k
Unlighthouse
CLI调用 Google Lighthouse 自动扫描整个网站(同类页面智能抽样),在本地网页界面里逐页汇总 SEO、性能和无障碍评分;另有 unlighthouse-ci 命令直接生成报告,便于 agent 读取。适合市场人员给官网做 SEO 体检。需要 Node.js 22.18 或更高版本。
harlan-zw/unlighthouse4.9k
miniprogram-ci
CLI微信官方的小程序/小游戏 CI 工具:不打开开发者工具,用命令行或 Node 脚本即可上传、预览代码,构建 npm、上传云函数。需要代码上传密钥并配置 IP 白名单。
wechat-miniprogram/miniprogram-ci-dist0
VitePress
SkillVitePress 静态站点生成器的参考:配置、命令行、文件路由、Markdown 扩展与在 Markdown 中使用 Vue 组件、构建期数据加载、动态路由、默认主题配置与自定义主题、多语言、SSR 兼容,以及部署到 GitHub Pages、Netlify、Vercel 等。基于 VitePress 2 alpha,由 Anthony Fu 从官方文档生成。
antfu/skills6k