fix(theme): make warning a first-class admonition, and deprecate caution admonition (#9308)

This commit is contained in:
Sébastien Lorber 2023-09-15 10:48:21 +02:00 committed by GitHub
parent 58be496da2
commit f5ae537d3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
339 changed files with 666 additions and 515 deletions

View file

@ -569,7 +569,7 @@ module.exports = {
![A sample base URL issue banner. The style is very raw since the stylesheets failed to load. The text says "Your Docusaurus site did not load properly... Current configured baseUrl = / (default value); We suggest trying baseUrl = /build/](/img/baseUrlIssueBanner.png)
:::caution
:::warning
This banner needs to inline CSS / JS in case all asset loading fails due to wrong base URL.

View file

@ -24,7 +24,7 @@ The `template` argument can be one of the following:
The `rootDir` will be used to resolve the absolute path to the site directory. The default is CWD.
:::caution
:::warning
This command should be preferably used in an interactive shell so all features are available.

View file

@ -34,7 +34,7 @@ It exports a single object as default export: `logger`. `logger` has the followi
- `success`: prints a success message.
- The `report` function. It takes a `ReportingSeverity` value (`ignore`, `log`, `warn`, `throw`) and reports a message according to the severity.
:::caution A word on the `error` formatter
:::warning A word on the `error` formatter
Beware that an `error` message, even when it doesn't hang the program, is likely going to cause confusion. When users inspect logs and find an `[ERROR]`, even when the build succeeds, they will assume something is going wrong. Use it sparingly.

View file

@ -1,6 +1,6 @@
# Plugin Method References
:::caution
:::warning
This section is a work in progress. Anchor links or even URLs are not guaranteed to be stable.

View file

@ -33,7 +33,7 @@ module.exports = function (context, options) {
Register an extra command to enhance the CLI of Docusaurus. `cli` is a [commander](https://www.npmjs.com/package/commander/v/5.1.0) object.
:::caution
:::warning
The commander version matters! We use commander v5, and make sure you are referring to the right version documentation for available APIs.

View file

@ -113,7 +113,7 @@ This function permits one to create some global plugin data that can be read fro
This data becomes accessible to your client-side/theme code through the [`useGlobalData`](../../docusaurus-core.mdx#useGlobalData) and [`usePluginData`](../../docusaurus-core.mdx#usePluginData) hooks.
:::caution
:::warning
Global data is... global: its size affects the loading time of all pages of your site, so try to keep it small. Prefer `createData` and page-specific data whenever possible.
@ -157,7 +157,7 @@ export default function friendsPlugin(context, options) {
Modifies the internal webpack config. If the return value is a JavaScript object, it will be merged into the final config using [`webpack-merge`](https://github.com/survivejs/webpack-merge). If it is a function, it will be called and receive `config` as the first argument and an `isServer` flag as the second argument.
:::caution
:::warning
The API of `configureWebpack` will be modified in the future to accept an object (`configureWebpack({config, isServer, utils, content})`)

View file

@ -11,13 +11,13 @@ Docusaurus Plugin to generate **client-side redirects**.
This plugin will write additional HTML pages to your static site that redirect the user to your existing Docusaurus pages with JavaScript.
:::caution production only
:::warning production only
This plugin is always inactive in development and **only active in production** because it works on the build output.
:::
:::caution
:::warning
It is better to use server-side redirects whenever possible.

View file

@ -9,7 +9,7 @@ import APITable from '@site/src/components/APITable';
Provides the [Blog](blog.mdx) feature and is the default blog plugin for Docusaurus.
:::caution some features production only
:::warning some features production only
The [feed feature](../../blog.mdx#feed) works by extracting the build output, and is **only active in production**.

View file

@ -9,7 +9,7 @@ import APITable from '@site/src/components/APITable';
The default [Google Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/) plugin. It is a JavaScript library for measuring how users interact with your website **in the production build**. If you are using Google Analytics 4 you might need to consider using [plugin-google-gtag](./plugin-google-gtag.mdx) instead.
:::caution production only
:::warning production only
This plugin is always inactive in development and **only active in production** to avoid polluting the analytics statistics.

View file

@ -15,7 +15,7 @@ You can use [Google's Tag Assistant](https://tagassistant.google.com/) tool to c
:::
:::caution production only
:::warning production only
This plugin is always inactive in development and **only active in production** to avoid polluting the analytics statistics.

View file

@ -90,7 +90,7 @@ By default, offline mode is enabled when the site is installed as an app. See th
After the site has been precached, the service worker will serve cached responses for later visits. When a new build is deployed along with a new service worker, the new one will begin installing and eventually move to a waiting state. During this waiting state, a reload popup will show and ask the user to reload the page for new content. Until the user either clears the application cache or clicks the `reload` button on the popup, the service worker will continue serving the old content.
:::caution
:::warning
Offline mode / precaching requires downloading all the static assets of the site ahead of time, and can consume unnecessary bandwidth. It may not be a good idea to activate it for all kind of sites.
@ -124,7 +124,7 @@ Strategies used to turn the offline mode on:
- `saveData`: activates for users with `navigator.connection.saveData === true`
- `always`: activates for all users
:::caution
:::warning
Use this carefully: some users may not like to be forced to use the offline mode.

View file

@ -9,7 +9,7 @@ import APITable from '@site/src/components/APITable';
This plugin creates sitemaps for your site so that search engine crawlers can crawl your site more accurately.
:::caution production only
:::warning production only
This plugin is always inactive in development and **only active in production** because it works on the build output.

View file

@ -16,7 +16,7 @@ The main themes implement the user interface for the [docs](../plugins/plugin-co
- [@docusaurus/theme-classic](./theme-classic.mdx)
- 🚧 other themes are planned
:::caution
:::warning
The goal is to have all themes share the exact same features, user-experience and configuration.

View file

@ -51,7 +51,7 @@ module.exports = {
};
```
:::caution
:::warning
With `respectPrefersColorScheme: true`, the `defaultMode` is overridden by user system preferences.