@@ -245,46 +245,21 @@ outdated information.
245245
246246## Commandline usage
247247
248- Recursively check all links in supported files inside the current directory
249-
250248``` sh
249+ # recursively check all links in supported files inside the current directory
251250lychee .
252- ```
253-
254- You can also specify various types of inputs:
255251
256- ``` sh
257252# check links in specific local file(s):
258- lychee README.md
259- lychee test.html info.txt
253+ lychee README.md test.html info.txt
260254
261255# check links on a website:
262256lychee https://endler.dev
263-
264- # check links in directory but block network requests
265- lychee --offline path/to/directory
266-
267- # check links in a remote file:
268- lychee https://raw.githubusercontent.com/lycheeverse/lychee/master/README.md
269-
270- # check links in local files via shell glob:
271- lychee ~ /projects/* /README.md
272-
273- # check links in local files (lychee supports advanced globbing and ~ expansion):
274- lychee " ~/projects/big_project/**/README.*"
275-
276- # ignore case when globbing and check result for each link:
277- lychee --glob-ignore-case " ~/projects/**/[r]eadme.*"
278-
279- # check links from epub file (requires atool: https://www.nongnu.org/atool)
280- acat -F zip {file.epub} " *.xhtml" " *.html" | lychee -
281257```
282258
283- lychee parses other file formats as plaintext and extracts links using [ linkify] ( https://github.com/robinst/linkify ) .
284- This generally works well if there are no format or encoding specifics,
285- but in case you need dedicated support for a new file format, please consider creating an issue.
259+ For more examples check out our
260+ [ getting started guide] ( https://lychee.cli.rs/guides/getting-started/ ) .
286261
287- ### Docker Usage
262+ < details >< summary >< b > Docker Usage</ b ></ summary >
288263
289264Here's how to mount a local directory into the container and check some input
290265with lychee.
@@ -310,6 +285,8 @@ docker run --init -it --rm -w /input -v $(pwd):/input lycheeverse/lychee README.
310285docker run --init -it --rm -w /input -v ${PWD}:/input lycheeverse/lychee README.md
311286```
312287
288+ </details >
289+
313290### GitHub Token
314291
315292To avoid getting rate-limited while checking GitHub links, you can optionally
@@ -750,106 +727,28 @@ Options:
750727
7517283 Encountered errors in the config file.
752729
753- ### Ignoring links
730+ ### Ignoring and excluding links
754731
755732You can exclude links from getting checked by specifying regex patterns
756- with ` --exclude ` (e.g. ` --exclude example\.(com|org) ` ).
757-
758- Here are some examples:
759-
760- ``` bash
761- # Exclude LinkedIn URLs (note that we match on the full URL, including the schema to avoid false-positives)
762- lychee --exclude ' ^https://www\.linkedin\.com'
763-
764- # Exclude LinkedIn and Archive.org URLs
765- lychee --exclude ' ^https://www\.linkedin\.com' --exclude ' ^https://web\.archive\.org/web/'
766-
767- # Exclude all links to PDF files
768- lychee --exclude ' \.pdf$' .
769-
770- # Exclude links to specific domains
771- lychee --exclude ' (facebook|twitter|linkedin)\.com' .
772-
773- # Exclude links with certain URL parameters
774- lychee --exclude ' \?utm_source=' .
775-
776- # Exclude all mailto links
777- lychee --exclude ' ^mailto:' .
778- ```
779-
780- For excluding files/directories from being scanned use ` lychee.toml `
781- and ` exclude_path ` .
782-
783- ``` toml
784- exclude_path = [" some/path" , " */dev/*" ]
785- ```
786-
787- If a file named ` .lycheeignore ` exists in the current working directory, its
788- contents are excluded as well. The file allows you to list multiple regular
789- expressions for exclusion (one pattern per line).
790-
791- For more advanced usage and detailed explanations, check out our comprehensive [ guide on excluding links] ( https://lychee.cli.rs/recipes/excluding-links/ ) .
733+ with ` --exclude ` (e.g. ` --exclude example\.(com|org) ` ) or by putting
734+ them into a file called ` .lycheecache ` .
735+ To exclude files and directories from being scanned use ` --exclude-path ` .
736+ For more detailed explanations, check out our comprehensive
737+ [ guide on excluding links] ( https://lychee.cli.rs/recipes/excluding-links/ ) .
792738
793739### Caching
794740
795741If the ` --cache ` flag is set, lychee will cache responses in a file called
796- ` .lycheecache ` in the current directory. If the file exists and the flag is set,
742+ in the current directory. If the file exists and the flag is set,
797743then the cache will be loaded on startup. This can greatly speed up future runs.
798744Note that by default lychee will not store any data on disk.
799745
800746## Library usage
801747
802748You can use lychee as a library for your own projects!
803- Here is a "hello world" example:
804-
805- ``` rust
806- use lychee_lib :: Result ;
807-
808- #[tokio:: main]
809- async fn main () -> Result <()> {
810- let response = lychee_lib :: check (" https://github.com/lycheeverse/lychee" ). await ? ;
811- println! (" {response}" );
812- Ok (())
813- }
814- ```
815-
816- This is equivalent to the following snippet, in which we build our own client:
817-
818- ``` rust
819- use lychee_lib :: {ClientBuilder , Result , Status };
820-
821- #[tokio:: main]
822- async fn main () -> Result <()> {
823- let client = ClientBuilder :: default (). client ()? ;
824- let response = client . check (" https://github.com/lycheeverse/lychee" ). await ? ;
825- assert! (response . status (). is_success ());
826- Ok (())
827- }
828- ```
829-
830- The client builder is very customizable:
831-
832- ``` rust, ignore
833- let client = lychee_lib::ClientBuilder::builder()
834- .includes(includes)
835- .excludes(excludes)
836- .max_redirects(cfg.max_redirects)
837- .user_agent(cfg.user_agent)
838- .allow_insecure(cfg.insecure)
839- .custom_headers(headers)
840- .method(method)
841- .timeout(timeout)
842- .github_token(cfg.github_token)
843- .scheme(cfg.scheme)
844- .accepted(accepted)
845- .build()
846- .client()?;
847- ```
848-
849- All options that you set will be used for all link checks.
850- See the [ builder documentation] ( https://docs.rs/lychee-lib/latest/lychee_lib/struct.ClientBuilder.html )
851- for all options. For more information, check out the [ examples] ( examples )
852- directory. The examples can be run with ` cargo run --example <example> ` .
749+ Take a look at the [ library documentation] ( https://docs.rs/lychee-lib/latest/lychee_lib/ ) .
750+ Also check out the [ examples] ( examples ) directory for small practical examples.
751+ These examples can be run with ` cargo run --example <example> ` .
853752
854753## GitHub Action Usage
855754
@@ -897,7 +796,7 @@ We collect a list of common workarounds for various websites in our [troubleshoo
897796
898797# # Users
899798
900- Here is a list of some notable projects who are using lychee.
799+ <details><summary><b> Here is a list of some notable projects who are using lychee.</b></summary>
901800
902801- https://github.com/InnerSourceCommons/InnerSourcePatterns
903802- https://github.com/opensearch-project/OpenSearch
@@ -944,6 +843,8 @@ Here is a list of some notable projects who are using lychee.
944843
945844If you are using lychee for your project, **please add it here**.
946845
846+ </details>
847+
947848# # Credits
948849
949850The first prototype of lychee was built in [episode 10 of Hello
0 commit comments