From ba1ab2234173bae14d6120323722ff2ae374a5ee Mon Sep 17 00:00:00 2001 From: Nahor Date: Mon, 4 Mar 2024 14:15:43 -0800 Subject: [PATCH] ci(doc consistency): check that lib.rs and README.md are consistent --- .github/workflows/ci.yml | 5 +++++ README.md | 45 +++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ab9326e..eb62044f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,11 @@ jobs: with: toolchain: stable components: rustfmt + - name: Install cargo-readme + run: cargo install cargo-readme + - name: Check doc consistency + shell: bash + run: diff -q README.md <(cargo readme) || echo "::error title='Inconsistent README.md and lib.rs'::Update lib.rs then use cargo-readme to update README.md" - name: rustfmt run: cargo fmt --all -- --check - name: docs diff --git a/README.md b/README.md index fe69ce26..206fb1c3 100644 --- a/README.md +++ b/README.md @@ -34,26 +34,29 @@ libraries and such might not want. ### Table of Contents -- [About](#about) -- [Features](#features) -- [Installing](#installing) -- [Example](#example) -- [Using](#using) - - [... in libraries](#-in-libraries) - - [... in application code](#-in-application-code) - - [... in `main()`](#-in-main) - - [... diagnostic code URLs](#-diagnostic-code-urls) - - [... snippets](#-snippets) - - [... help text](#-help-text) - - [... severity level](#-severity-level) - - [... multiple related errors](#-multiple-related-errors) - - [... delayed source code](#-delayed-source-code) - - [... handler options](#-handler-options) - - [... dynamic diagnostics](#-dynamic-diagnostics) - - [... syntax highlighting](#-syntax-highlighting) - - [... collection of labels](#-collection-of-labels) -- [Acknowledgements](#acknowledgements) -- [License](#license) +- [`miette`](#miette) + - [About](#about) + - [Features](#features) + - [Installing](#installing) + - [Example](#example) + - [Using](#using) + - [... in libraries](#-in-libraries) + - [... in application code](#-in-application-code) + - [... in `main()`](#-in-main) + - [... diagnostic code URLs](#-diagnostic-code-urls) + - [... snippets](#-snippets) + - [... help text](#-help-text) + - [... severity level](#-severity-level) + - [... multiple related errors](#-multiple-related-errors) + - [... delayed source code](#-delayed-source-code) + - [... Diagnostic-based error sources.](#-diagnostic-based-error-sources) + - [... handler options](#-handler-options) + - [... dynamic diagnostics](#-dynamic-diagnostics) + - [... syntax highlighting](#-syntax-highlighting) + - [... collection of labels](#-collection-of-labels) + - [MSRV](#msrv) + - [Acknowledgements](#acknowledgements) + - [License](#license) ### Features @@ -665,7 +668,7 @@ println!("{:?}", report) -To use the built-in highlighting functionality, you must enable the +To use the bublablablailt-in highlighting functionality, you must enable the `syntect-highlighter` crate feature. When this feature is enabled, `miette` will automatically use the [`syntect`] crate to highlight the `#[source_code]` field of your [`Diagnostic`].