Browse Source

Use lychee to verify docs links (#1087)

* dev: add lychee to lefthook

* docs: make sure internal links has .md

* ci: add docs lint workflow

---------

Co-authored-by: Sergey Alexandrovich <DarthSim@users.noreply.github.com>
Vladimir Dementyev 2 years ago
parent
commit
4a60556787
6 changed files with 65 additions and 35 deletions
  1. 26 0
      .github/workflows/docs-lint.yml
  2. 27 27
      docs/_sidebar.md
  3. 4 4
      docs/best_format.md
  4. 3 3
      docs/configuration.md
  5. 1 1
      docs/generating_the_url.md
  6. 4 0
      lefthook.yml

+ 26 - 0
.github/workflows/docs-lint.yml

@@ -0,0 +1,26 @@
+name: Lint Docs
+
+on:
+  push:
+    branches:
+    - master
+    paths:
+    - "*.md"
+    - "**/*.md"
+  pull_request:
+    paths:
+    - "*.md"
+    - "**/*.md"
+
+jobs:
+  lychee:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Link Checker
+      id: lychee
+      uses: lycheeverse/lychee-action@v1.5.1
+      env:
+        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
+      with:
+        args: docs README.md CHANGELOG.md --exclude localhost --exclude-path docs/index.html -v

+ 27 - 27
docs/_sidebar.md

@@ -1,33 +1,33 @@
-* [Getting started](GETTING_STARTED)
+* [Getting started](GETTING_STARTED.md)
 * [Pro version<img src="/assets/pro.svg">](https://imgproxy.net/#pro)
-* [Installation](installation)
-* [Configuration](configuration)
+* [Installation](installation.md)
+* [Configuration](configuration.md)
 * Generating the URL
-  * [Generating the URL](generating_the_url)
-  * [Getting the image info<img title="imgproxy Pro feature" src="/assets/pro.svg">](getting_the_image_info)
-  * [Signing the URL](signing_the_url)
-  * [Encrypting the source URL<img src="/assets/pro.svg">](encrypting_the_source_url)
-  * [Presets](presets)
+  * [Generating the URL](generating_the_url.md)
+  * [Getting the image info<img title="imgproxy Pro feature" src="/assets/pro.svg">](getting_the_image_info.md)
+  * [Signing the URL](signing_the_url.md)
+  * [Encrypting the source URL<img src="/assets/pro.svg">](encrypting_the_source_url.md)
+  * [Presets](presets.md)
 * Features
-  * [Watermark](watermark)
-  * [Object detection<img title="imgproxy Pro feature" src="/assets/pro.svg">](object_detection)
-  * [Autoquality<img title="imgproxy Pro feature" src="/assets/pro.svg">](autoquality)
-  * [Best format<img title="imgproxy Pro feature" src="/assets/pro.svg">](best_format)
-  * [Chained pipelines<img title="imgproxy Pro feature" src="/assets/pro.svg">](chained_pipelines)
+  * [Watermark](watermark.md)
+  * [Object detection<img title="imgproxy Pro feature" src="/assets/pro.svg">](object_detection.md)
+  * [Autoquality<img title="imgproxy Pro feature" src="/assets/pro.svg">](autoquality.md)
+  * [Best format<img title="imgproxy Pro feature" src="/assets/pro.svg">](best_format.md)
+  * [Chained pipelines<img title="imgproxy Pro feature" src="/assets/pro.svg">](chained_pipelines.md)
 * Image sources
-  * [Local files](serving_local_files)
-  * [Amazon S3](serving_files_from_s3)
-  * [Google Cloud Storage](serving_files_from_google_cloud_storage)
-  * [Azure Blob Storage](serving_files_from_azure_blob_storage)
-  * [OpenStack Object Storage ("Swift")](serving_files_from_openstack_swift)
+  * [Local files](serving_local_files.md)
+  * [Amazon S3](serving_files_from_s3.md)
+  * [Google Cloud Storage](serving_files_from_google_cloud_storage.md)
+  * [Azure Blob Storage](serving_files_from_azure_blob_storage.md)
+  * [OpenStack Object Storage ("Swift")](serving_files_from_openstack_swift.md)
 * Monitoring
-  * [New Relic](new_relic)
-  * [Prometheus](prometheus)
-  * [Datadog](datadog)
-  * [OpenTelemetry](open_telemetry)
-  * [Amazon CloudWatch](cloud_watch)
+  * [New Relic](new_relic.md)
+  * [Prometheus](prometheus.md)
+  * [Datadog](datadog.md)
+  * [OpenTelemetry](open_telemetry.md)
+  * [Amazon CloudWatch](cloud_watch.md)
 * Miscellaneous
-  * [Image formats support](image_formats_support)
-  * [About processing pipeline](about_processing_pipeline)
-  * [Health check](healthcheck)
-  * [Memory usage tweaks](memory_usage_tweaks)
+  * [Image formats support](image_formats_support.md)
+  * [About processing pipeline](about_processing_pipeline.md)
+  * [Health check](healthcheck.md)
+  * [Memory usage tweaks](memory_usage_tweaks.md)

+ 4 - 4
docs/best_format.md

@@ -1,12 +1,12 @@
 # Best format![pro](./assets/pro.svg)
 
-You can use the `best` value for the [format](generating_the_url#format) option or the [extension](generating_the_url#extension) to make imgproxy pick the best format for the resultant image.
+You can use the `best` value for the [format](generating_the_url.md#format) option or the [extension](generating_the_url.md#extension) to make imgproxy pick the best format for the resultant image.
 
 imgproxy measures the complexity of the image to choose when it should use a lossless or near-lossless encoding. Then imgproxy tries to save the image in multiple formats to pick one with the smallest resulting size.
 
-**📝 Note:** imgproxy uses only the formats listed as [preferred](configuration#preferred-formats) when choosing the best format. It may also use AVIF or WebP if [AVIF/WebP support detection](configuration#avifwebp-support-detection) is enabled.
+**📝 Note:** imgproxy uses only the formats listed as [preferred](configuration.md#preferred-formats) when choosing the best format. It may also use AVIF or WebP if [AVIF/WebP support detection](configuration.md#avifwebp-support-detection) is enabled.
 
-**📝 Note:** imgproxy will use AVIF or WebP _only_ if [AVIF/WebP support detection](configuration#avifwebp-support-detection) is enabled.
+**📝 Note:** imgproxy will use AVIF or WebP _only_ if [AVIF/WebP support detection](configuration.md#avifwebp-support-detection) is enabled.
 
 **📝 Note:** imgproxy may change your quality and autoquality settings if the `best` format is used.
 
@@ -15,4 +15,4 @@ imgproxy measures the complexity of the image to choose when it should use a los
 * `IMGPROXY_BEST_FORMAT_COMPLEXITY_THRESHOLD `: the image complexity threshold. imgproxy will use a lossless or near-lossless encoding for images with low complexity. Default: `5.5`
 * `IMGPROXY_BEST_FORMAT_MAX_RESOLUTION`: when greater than `0` and the image's resolution (in megapixels) is larger than the provided value, imgproxy won't try all the applicable formats and will just pick one that seems the best for the image
 * `IMGPROXY_BEST_FORMAT_BY_DEFAULT`: when `true` and the resulting image format is not specified explicitly, imgproxy will use the `best` format instead of the source image format
-* `IMGPROXY_BEST_FORMAT_ALLOW_SKIPS`: when `true` and the `best` format is used, imgproxy will skip processing of SVG and formats [listed to skip processing](configuration#skip-processing)
+* `IMGPROXY_BEST_FORMAT_ALLOW_SKIPS`: when `true` and the `best` format is used, imgproxy will skip processing of SVG and formats [listed to skip processing](configuration.md#skip-processing)

+ 3 - 3
docs/configuration.md

@@ -234,14 +234,14 @@ You can configure imgproxy to skip processing of some formats:
 
 ## Best format
 
-You can use the `best` value for the [format](generating_the_url#format) option or the [extension](generating_the_url#extension) to make imgproxy pick the best format for the resultant image.
+You can use the `best` value for the [format](generating_the_url.md#format) option or the [extension](generating_the_url.md#extension) to make imgproxy pick the best format for the resultant image.
 
 * `IMGPROXY_BEST_FORMAT_COMPLEXITY_THRESHOLD `: ![pro](./assets/pro.svg) the image complexity threshold. imgproxy will use a lossless or near-lossless encoding for images with low complexity. Default: `5.5`
 * `IMGPROXY_BEST_FORMAT_MAX_RESOLUTION`: ![pro](./assets/pro.svg) when greater than `0` and the image's resolution (in megapixels) is larger than the provided value, imgproxy won't try all the applicable formats and will just pick one that seems the best for the image
 * `IMGPROXY_BEST_FORMAT_BY_DEFAULT`: ![pro](./assets/pro.svg) when `true` and the resulting image format is not specified explicitly, imgproxy will use the `best` format instead of the source image format
-* `IMGPROXY_BEST_FORMAT_ALLOW_SKIPS`: ![pro](./assets/pro.svg) when `true` and the `best` format is used, imgproxy will skip processing of SVG and formats [listed to skip processing](configuration#skip-processing)
+* `IMGPROXY_BEST_FORMAT_ALLOW_SKIPS`: ![pro](./assets/pro.svg) when `true` and the `best` format is used, imgproxy will skip processing of SVG and formats [listed to skip processing](configuration.md#skip-processing)
 
-Check out the [Best format](best_format) guide to learn more.
+Check out the [Best format](best_format.md) guide to learn more.
 
 ## Client Hints support
 

+ 1 - 1
docs/generating_the_url.md

@@ -892,7 +892,7 @@ The extension can be omitted. In this case, imgproxy will use the source image f
 
 ### Best format![pro](./assets/pro.svg)
 
-You can use the `best` value for the [format](generating_the_url#format) option or the [extension](generating_the_url#extension) to make imgproxy pick the best format for the resultant image. Check out the [Best format](best_format) guide to learn more.
+You can use the `best` value for the [format](generating_the_url.md#format) option or the [extension](generating_the_url.md#extension) to make imgproxy pick the best format for the resultant image. Check out the [Best format](best_format.md) guide to learn more.
 
 ## Example
 

+ 4 - 0
lefthook.yml

@@ -9,3 +9,7 @@ pre-push:
       tags: test
     check-docs-versions:
       tags: docs
+  commands:
+    check-links:
+      tags: docs
+      run: command -v lychee && lychee docs README.md CHANGELOG.md --exclude localhost --exclude-path docs/index.html