From 58d07f091da436d2f231dee554c2712cc20b81ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Thu, 11 Jul 2024 16:16:12 +0200 Subject: [PATCH] v3: Add support for consistent documentation using markdownlint (#3064) --- .github/CODE_OF_CONDUCT.md | 4 ++-- .github/SECURITY.md | 2 +- .github/workflows/markdown.yml | 1 + .markdownlint.yml | 2 +- Makefile | 2 +- docs/middleware/earlydata.md | 4 ++-- docs/middleware/idempotency.md | 2 +- docs/middleware/monitor.md | 18 +++++++++--------- docs/middleware/proxy.md | 24 ++++++++++++------------ 9 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 1b56152c7c..0dd0526cc1 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -71,11 +71,11 @@ Community leaders will follow these Community Impact Guidelines in determining t ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, -available at . +available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at -. Translations are available at . +[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). diff --git a/.github/SECURITY.md b/.github/SECURITY.md index a570992536..a5919f86e7 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -77,4 +77,4 @@ for all of it's members. We learn about critical software updates and security threats from these sources 1. GitHub Security Alerts -2. GitHub: & [@githubstatus](https://twitter.com/githubstatus) +2. GitHub: [https://status.github.com/](https://status.github.com/) & [@githubstatus](https://twitter.com/githubstatus) diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 513b75ab9f..21ba3632f9 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -23,3 +23,4 @@ jobs: with: globs: | **/*.md + #vendor diff --git a/.markdownlint.yml b/.markdownlint.yml index bc3d88cfb7..71d7b309d8 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -227,7 +227,7 @@ MD053: # MD054/link-image-style : Link and image style : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md054.md MD054: # Allow autolinks - autolink: true + autolink: false # Allow inline links and images inline: true # Allow full reference links and images diff --git a/Makefile b/Makefile index d4fb8f4eee..2e7f2e1cfc 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ format: ## format: 🎨 Find markdown format issues (Requires markdownlint-cli) .PHONY: markdown format: - markdownlint-cli2 "**/*.md" + markdownlint-cli2 "**/*.md" "#vendor" ## lint: 🚨 Run lint checks .PHONY: lint diff --git a/docs/middleware/earlydata.md b/docs/middleware/earlydata.md index dbf45aa9f3..b0e39b2f2f 100644 --- a/docs/middleware/earlydata.md +++ b/docs/middleware/earlydata.md @@ -11,8 +11,8 @@ Make sure to enable fiber's `EnableTrustedProxyCheck` config option before using Also be aware that enabling support for early data in your reverse proxy (e.g. nginx, as done with a simple `ssl_early_data on;`) makes requests replayable. Refer to the following documents before continuing: -- -- +- [datatracker](https://datatracker.ietf.org/doc/html/rfc8446#section-8) +- [trailofbits](https://blog.trailofbits.com/2019/03/25/what-application-developers-need-to-know-about-tls-early-data-0rtt) By default, this middleware allows early data requests on safe HTTP request methods only and rejects the request otherwise, i.e. aborts the request before executing your handler. This behavior can be controlled by the `AllowEarlyData` config option. Safe HTTP methods — `GET`, `HEAD`, `OPTIONS` and `TRACE` — should not modify a state on the server. diff --git a/docs/middleware/idempotency.md b/docs/middleware/idempotency.md index 6f5c85f738..59d47f8b8b 100644 --- a/docs/middleware/idempotency.md +++ b/docs/middleware/idempotency.md @@ -6,7 +6,7 @@ id: idempotency Idempotency middleware for [Fiber](https://github.com/gofiber/fiber) allows for fault-tolerant APIs where duplicate requests — for example due to networking issues on the client-side — do not erroneously cause the same action performed multiple times on the server-side. -Refer to for a better understanding. +Refer to [datatracker](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-idempotency-key-header-02) for a better understanding. ## Signatures diff --git a/docs/middleware/monitor.md b/docs/middleware/monitor.md index 9c08a6bf02..aa3b1c89ee 100644 --- a/docs/middleware/monitor.md +++ b/docs/middleware/monitor.md @@ -62,15 +62,15 @@ You can also access the API endpoint with ## Config -| Property | Type | Description | Default | -|:-----------|:------------------------|:--------------------------------------------------------------------|:----------------------------------------------------------------------------| -| Title | `string` | Metrics page title | "Fiber Monitor" | -| Refresh | `time.Duration` | Refresh period | 3 seconds | -| APIOnly | `bool` | Whether the service should expose only the monitoring API | false | -| Next | `func(fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` | -| CustomHead | `string` | Custom HTML Code to Head Section(Before End) | empty | -| FontURL | `string` | FontURL for specify font resource path or URL | "" | -| ChartJsURL | `string` | ChartJsURL for specify ChartJS library path or URL | "" | +| Property | Type | Description | Default | +|:-----------|:------------------------|:--------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------| +| Title | `string` | Metrics page title | "Fiber Monitor" | +| Refresh | `time.Duration` | Refresh period | 3 seconds | +| APIOnly | `bool` | Whether the service should expose only the monitoring API | false | +| Next | `func(fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` | +| CustomHead | `string` | Custom HTML Code to Head Section(Before End) | empty | +| FontURL | `string` | FontURL for specify font resource path or URL | "[fonts.googleapis.com](https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap)" | +| ChartJsURL | `string` | ChartJsURL for specify ChartJS library path or URL | "[cdn.jsdelivr.net](https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js)" | ## Default Config diff --git a/docs/middleware/proxy.md b/docs/middleware/proxy.md index 0045e6f07b..8404efe2d8 100644 --- a/docs/middleware/proxy.md +++ b/docs/middleware/proxy.md @@ -155,18 +155,18 @@ app.Use(proxy.Balancer(proxy.Config{ ## Config -| Property | Type | Description | Default | -|:----------------|:-----------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------| -| Next | `func(fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` | -| Servers | `[]string` | Servers defines a list of `://` HTTP servers, which are used in a round-robin manner. i.e.: ", " | (Required) | -| ModifyRequest | `fiber.Handler` | ModifyRequest allows you to alter the request. | `nil` | -| ModifyResponse | `fiber.Handler` | ModifyResponse allows you to alter the response. | `nil` | -| Timeout | `time.Duration` | Timeout is the request timeout used when calling the proxy client. | 1 second | -| ReadBufferSize | `int` | Per-connection buffer size for requests' reading. This also limits the maximum header size. Increase this buffer if your clients send multi-KB RequestURIs and/or multi-KB headers (for example, BIG cookies). | (Not specified) | -| WriteBufferSize | `int` | Per-connection buffer size for responses' writing. | (Not specified) | -| TlsConfig | `*tls.Config` (or `*fasthttp.TLSConfig` in v3) | TLS config for the HTTP client. | `nil` | -| DialDualStack | `bool` | Client will attempt to connect to both IPv4 and IPv6 host addresses if set to true. | `false` | -| Client | `*fasthttp.LBClient` | Client is a custom client when client config is complex. | `nil` | +| Property | Type | Description | Default | +|:----------------|:-----------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------| +| Next | `func(fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` | +| Servers | `[]string` | Servers defines a list of `://` HTTP servers, which are used in a round-robin manner. i.e.: "[https://foobar.com](https://foobar.com), [http://www.foobar.com](http://www.foobar.com)" | (Required) | +| ModifyRequest | `fiber.Handler` | ModifyRequest allows you to alter the request. | `nil` | +| ModifyResponse | `fiber.Handler` | ModifyResponse allows you to alter the response. | `nil` | +| Timeout | `time.Duration` | Timeout is the request timeout used when calling the proxy client. | 1 second | +| ReadBufferSize | `int` | Per-connection buffer size for requests' reading. This also limits the maximum header size. Increase this buffer if your clients send multi-KB RequestURIs and/or multi-KB headers (for example, BIG cookies). | (Not specified) | +| WriteBufferSize | `int` | Per-connection buffer size for responses' writing. | (Not specified) | +| TlsConfig | `*tls.Config` (or `*fasthttp.TLSConfig` in v3) | TLS config for the HTTP client. | `nil` | +| DialDualStack | `bool` | Client will attempt to connect to both IPv4 and IPv6 host addresses if set to true. | `false` | +| Client | `*fasthttp.LBClient` | Client is a custom client when client config is complex. | `nil` | ## Default Config