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

@ -60,7 +60,8 @@
"watch": "yarn lerna run --parallel watch", "watch": "yarn lerna run --parallel watch",
"clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn rimraf test-website && yarn rimraf test-website-in-workspace && yarn lerna exec --ignore docusaurus yarn rimraf lib", "clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn rimraf test-website && yarn rimraf test-website-in-workspace && yarn lerna exec --ignore docusaurus yarn rimraf lib",
"test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl", "test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl",
"lock:update": "npx --yes yarn-deduplicate" "lock:update": "npx --yes yarn-deduplicate",
"update-translations": "yarn workspace @docusaurus/theme-translations update"
}, },
"dependencies": { "dependencies": {
"unified": "^10.1.2" "unified": "^10.1.2"

View file

@ -19,13 +19,6 @@ export default function getSwizzleConfig(): SwizzleConfig {
}, },
description: 'The folder containing all admonition icons', description: 'The folder containing all admonition icons',
}, },
'Admonition/Icon/Caution': {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The admonition caution icon',
},
'Admonition/Icon/Danger': { 'Admonition/Icon/Danger': {
actions: { actions: {
eject: 'safe', eject: 'safe',
@ -54,6 +47,13 @@ export default function getSwizzleConfig(): SwizzleConfig {
}, },
description: 'The admonition tip icon', description: 'The admonition tip icon',
}, },
'Admonition/Icon/Warning': {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The admonition warning icon',
},
'Admonition/Layout': { 'Admonition/Layout': {
actions: { actions: {
eject: 'safe', eject: 'safe',
@ -110,6 +110,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
description: description:
'The component responsible for rendering a :::tip admonition type', 'The component responsible for rendering a :::tip admonition type',
}, },
'Admonition/Type/Warning': {
actions: {
eject: 'safe',
wrap: 'safe',
},
description:
'The component responsible for rendering a :::warning admonition type',
},
'Admonition/Types': { 'Admonition/Types': {
actions: { actions: {
eject: 'safe', eject: 'safe',

View file

@ -74,6 +74,8 @@ declare module '@theme/Admonition/Type/Tip' {
export default function AdmonitionTypeTip(props: Props): JSX.Element; export default function AdmonitionTypeTip(props: Props): JSX.Element;
} }
// TODO remove before v4: Caution replaced by Warning
// see https://github.com/facebook/docusaurus/issues/7558
declare module '@theme/Admonition/Type/Caution' { declare module '@theme/Admonition/Type/Caution' {
import type {Props as AdmonitionProps} from '@theme/Admonition'; import type {Props as AdmonitionProps} from '@theme/Admonition';
@ -81,6 +83,13 @@ declare module '@theme/Admonition/Type/Caution' {
export default function AdmonitionTypeCaution(props: Props): JSX.Element; export default function AdmonitionTypeCaution(props: Props): JSX.Element;
} }
declare module '@theme/Admonition/Type/Warning' {
import type {Props as AdmonitionProps} from '@theme/Admonition';
export interface Props extends AdmonitionProps {}
export default function AdmonitionTypeWarning(props: Props): JSX.Element;
}
declare module '@theme/Admonition/Type/Danger' { declare module '@theme/Admonition/Type/Danger' {
import type {Props as AdmonitionProps} from '@theme/Admonition'; import type {Props as AdmonitionProps} from '@theme/Admonition';
@ -128,12 +137,12 @@ declare module '@theme/Admonition/Icon/Tip' {
export default function AdmonitionIconTip(props: Props): JSX.Element; export default function AdmonitionIconTip(props: Props): JSX.Element;
} }
declare module '@theme/Admonition/Icon/Caution' { declare module '@theme/Admonition/Icon/Warning' {
import type {ComponentProps} from 'react'; import type {ComponentProps} from 'react';
export interface Props extends ComponentProps<'svg'> {} export interface Props extends ComponentProps<'svg'> {}
export default function AdmonitionIconCaution(props: Props): JSX.Element; export default function AdmonitionIconWarning(props: Props): JSX.Element;
} }
declare module '@theme/Admonition/Icon/Danger' { declare module '@theme/Admonition/Icon/Danger' {

View file

@ -6,7 +6,7 @@
*/ */
import React from 'react'; import React from 'react';
import type {Props} from '@theme/Admonition/Icon/Caution'; import type {Props} from '@theme/Admonition/Icon/Warning';
export default function AdmonitionIconCaution(props: Props): JSX.Element { export default function AdmonitionIconCaution(props: Props): JSX.Element {
return ( return (

View file

@ -10,12 +10,12 @@ import clsx from 'clsx';
import Translate from '@docusaurus/Translate'; import Translate from '@docusaurus/Translate';
import type {Props} from '@theme/Admonition/Type/Caution'; import type {Props} from '@theme/Admonition/Type/Caution';
import AdmonitionLayout from '@theme/Admonition/Layout'; import AdmonitionLayout from '@theme/Admonition/Layout';
import IconCaution from '@theme/Admonition/Icon/Caution'; import IconWarning from '@theme/Admonition/Icon/Warning';
const infimaClassName = 'alert alert--warning'; const infimaClassName = 'alert alert--warning';
const defaultProps = { const defaultProps = {
icon: <IconCaution />, icon: <IconWarning />,
title: ( title: (
<Translate <Translate
id="theme.admonition.caution" id="theme.admonition.caution"
@ -25,6 +25,8 @@ const defaultProps = {
), ),
}; };
// TODO remove before v4: Caution replaced by Warning
// see https://github.com/facebook/docusaurus/issues/7558
export default function AdmonitionTypeCaution(props: Props): JSX.Element { export default function AdmonitionTypeCaution(props: Props): JSX.Element {
return ( return (
<AdmonitionLayout <AdmonitionLayout

View file

@ -0,0 +1,37 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import clsx from 'clsx';
import Translate from '@docusaurus/Translate';
import type {Props} from '@theme/Admonition/Type/Warning';
import AdmonitionLayout from '@theme/Admonition/Layout';
import IconWarning from '@theme/Admonition/Icon/Warning';
const infimaClassName = 'alert alert--warning';
const defaultProps = {
icon: <IconWarning />,
title: (
<Translate
id="theme.admonition.warning"
description="The default label used for the Warning admonition (:::warning)">
warning
</Translate>
),
};
export default function AdmonitionTypeWarning(props: Props): JSX.Element {
return (
<AdmonitionLayout
{...defaultProps}
{...props}
className={clsx(infimaClassName, props.className)}>
{props.children}
</AdmonitionLayout>
);
}

View file

@ -9,15 +9,16 @@ import React from 'react';
import AdmonitionTypeNote from '@theme/Admonition/Type/Note'; import AdmonitionTypeNote from '@theme/Admonition/Type/Note';
import AdmonitionTypeTip from '@theme/Admonition/Type/Tip'; import AdmonitionTypeTip from '@theme/Admonition/Type/Tip';
import AdmonitionTypeInfo from '@theme/Admonition/Type/Info'; import AdmonitionTypeInfo from '@theme/Admonition/Type/Info';
import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution'; import AdmonitionTypeWarning from '@theme/Admonition/Type/Warning';
import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger'; import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger';
import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
import type AdmonitionTypes from '@theme/Admonition/Types'; import type AdmonitionTypes from '@theme/Admonition/Types';
const admonitionTypes: typeof AdmonitionTypes = { const admonitionTypes: typeof AdmonitionTypes = {
note: AdmonitionTypeNote, note: AdmonitionTypeNote,
tip: AdmonitionTypeTip, tip: AdmonitionTypeTip,
info: AdmonitionTypeInfo, info: AdmonitionTypeInfo,
caution: AdmonitionTypeCaution, warning: AdmonitionTypeWarning,
danger: AdmonitionTypeDanger, danger: AdmonitionTypeDanger,
}; };
@ -28,8 +29,7 @@ const admonitionAliases: typeof AdmonitionTypes = {
secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />, secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />,
important: (props) => <AdmonitionTypeInfo title="important" {...props} />, important: (props) => <AdmonitionTypeInfo title="important" {...props} />,
success: (props) => <AdmonitionTypeTip title="success" {...props} />, success: (props) => <AdmonitionTypeTip title="success" {...props} />,
// TODO bad legacy mapping, warning is usually yellow, not red... caution: AdmonitionTypeCaution,
warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
}; };
export default { export default {

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "معلومات", "theme.admonition.info": "معلومات",
"theme.admonition.note": "ملاحظة", "theme.admonition.note": "ملاحظة",
"theme.admonition.tip": "تلميح", "theme.admonition.tip": "تلميح",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "أرشيف", "theme.blog.archive.description": "أرشيف",
"theme.blog.archive.title": "أرشيف", "theme.blog.archive.title": "أرشيف",
"theme.blog.paginator.navAriaLabel": "التنقل في صفحة قائمة المدونة", "theme.blog.paginator.navAriaLabel": "التنقل في صفحة قائمة المدونة",

View file

@ -12,8 +12,9 @@
"theme.CodeBlock.wordWrapToggle": "Toggle word wrap", "theme.CodeBlock.wordWrapToggle": "Toggle word wrap",
"theme.CodeBlock.wordWrapToggle___DESCRIPTION": "The title attribute for toggle word wrapping button of code block lines", "theme.CodeBlock.wordWrapToggle___DESCRIPTION": "The title attribute for toggle word wrapping button of code block lines",
"theme.DocSidebarItem.collapseCategoryAriaLabel": "Collapse sidebar category '{label}'", "theme.DocSidebarItem.collapseCategoryAriaLabel": "Collapse sidebar category '{label}'",
"theme.DocSidebarItem.collapseCategoryAriaLabel___DESCRIPTION": "The ARIA label to collapse the sidebar category",
"theme.DocSidebarItem.expandCategoryAriaLabel": "Expand sidebar category '{label}'", "theme.DocSidebarItem.expandCategoryAriaLabel": "Expand sidebar category '{label}'",
"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel___DESCRIPTION": "The ARIA label to toggle the collapsible sidebar category", "theme.DocSidebarItem.expandCategoryAriaLabel___DESCRIPTION": "The ARIA label to expand the sidebar category",
"theme.ErrorPageContent.title": "This page crashed.", "theme.ErrorPageContent.title": "This page crashed.",
"theme.ErrorPageContent.title___DESCRIPTION": "The title of the fallback page when the page crashed", "theme.ErrorPageContent.title___DESCRIPTION": "The title of the fallback page when the page crashed",
"theme.ErrorPageContent.tryAgain": "Try again", "theme.ErrorPageContent.tryAgain": "Try again",
@ -38,6 +39,8 @@
"theme.admonition.note___DESCRIPTION": "The default label used for the Note admonition (:::note)", "theme.admonition.note___DESCRIPTION": "The default label used for the Note admonition (:::note)",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.tip___DESCRIPTION": "The default label used for the Tip admonition (:::tip)", "theme.admonition.tip___DESCRIPTION": "The default label used for the Tip admonition (:::tip)",
"theme.admonition.warning": "warning",
"theme.admonition.warning___DESCRIPTION": "The default label used for the Warning admonition (:::warning)",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.description___DESCRIPTION": "The page & hero description of the blog archive page", "theme.blog.archive.description___DESCRIPTION": "The page & hero description of the blog archive page",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "ব্লগ তালিকা পেজ নেভিগেশন", "theme.blog.paginator.navAriaLabel": "ব্লগ তালিকা পেজ নেভিগেশন",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "Stránkování článků na blogu", "theme.blog.paginator.navAriaLabel": "Stránkování článků na blogu",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "Blogoversigt navigation", "theme.blog.paginator.navAriaLabel": "Blogoversigt navigation",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archiv", "theme.blog.archive.description": "Archiv",
"theme.blog.archive.title": "Archiv", "theme.blog.archive.title": "Archiv",
"theme.blog.paginator.navAriaLabel": "Navigation der Blog-Listenseite", "theme.blog.paginator.navAriaLabel": "Navigation der Blog-Listenseite",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archivo", "theme.blog.archive.description": "Archivo",
"theme.blog.archive.title": "Archivo", "theme.blog.archive.title": "Archivo",
"theme.blog.paginator.navAriaLabel": "Navegación por la página de la lista de blogs ", "theme.blog.paginator.navAriaLabel": "Navegación por la página de la lista de blogs ",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "آرشیو", "theme.blog.archive.description": "آرشیو",
"theme.blog.archive.title": "آرشیو", "theme.blog.archive.title": "آرشیو",
"theme.blog.paginator.navAriaLabel": "کنترل لیست مطالب وبلاگ", "theme.blog.paginator.navAriaLabel": "کنترل لیست مطالب وبلاگ",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "Nabegasyón para sa pahina na listahan ng blog", "theme.blog.paginator.navAriaLabel": "Nabegasyón para sa pahina na listahan ng blog",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "remarque", "theme.admonition.note": "remarque",
"theme.admonition.tip": "astuce", "theme.admonition.tip": "astuce",
"theme.admonition.warning": "attention",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "Pagination de la liste des articles du blog", "theme.blog.paginator.navAriaLabel": "Pagination de la liste des articles du blog",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "רשימת דפי הבלוג", "theme.blog.paginator.navAriaLabel": "רשימת דפי הבלוג",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "ब्लॉग सूची पेज नेविगेशन", "theme.blog.paginator.navAriaLabel": "ब्लॉग सूची पेज नेविगेशन",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "információ", "theme.admonition.info": "információ",
"theme.admonition.note": "megjegyzés", "theme.admonition.note": "megjegyzés",
"theme.admonition.tip": "tanács", "theme.admonition.tip": "tanács",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archívum", "theme.blog.archive.description": "Archívum",
"theme.blog.archive.title": "Archívum", "theme.blog.archive.title": "Archívum",
"theme.blog.paginator.navAriaLabel": "Bloglista oldalának navigációja", "theme.blog.paginator.navAriaLabel": "Bloglista oldalának navigációja",
@ -67,5 +68,7 @@
"theme.navbar.mobileVersionsDropdown.label": "Verziók", "theme.navbar.mobileVersionsDropdown.label": "Verziók",
"theme.tags.tagsListLabel": "Címkék:", "theme.tags.tagsListLabel": "Címkék:",
"theme.tags.tagsPageLink": "Összes címke megtekintése", "theme.tags.tagsPageLink": "Összes címke megtekintése",
"theme.tags.tagsPageTitle": "Címkék" "theme.tags.tagsPageTitle": "Címkék",
"theme.unlistedContent.message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.",
"theme.unlistedContent.title": "Unlisted page"
} }

View file

@ -24,7 +24,6 @@
"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Törölje ezt a keresést a kedvencekből", "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Törölje ezt a keresést a kedvencekből",
"theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Törölje ezt a keresést az előzményekből", "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Törölje ezt a keresést az előzményekből",
"theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Mentsük el ezt a keresést", "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Mentsük el ezt a keresést",
"theme.SearchPage.saveRecentSearchButtonTitle": "Mentse ezt a keresést",
"theme.SearchPage.algoliaLabel": "Keresés az Algolia segítségével", "theme.SearchPage.algoliaLabel": "Keresés az Algolia segítségével",
"theme.SearchPage.documentsFound.plurals": "Egy dokumentum|{count} dokumentumok", "theme.SearchPage.documentsFound.plurals": "Egy dokumentum|{count} dokumentumok",
"theme.SearchPage.emptyResultsTitle": "Keresés a webhelyen", "theme.SearchPage.emptyResultsTitle": "Keresés a webhelyen",
@ -32,5 +31,6 @@
"theme.SearchPage.fetchingNewResults": "Új keresési eredmények betöltése...", "theme.SearchPage.fetchingNewResults": "Új keresési eredmények betöltése...",
"theme.SearchPage.inputLabel": "Keresés", "theme.SearchPage.inputLabel": "Keresés",
"theme.SearchPage.inputPlaceholder": "Adja meg a keresendő kifejezést", "theme.SearchPage.inputPlaceholder": "Adja meg a keresendő kifejezést",
"theme.SearchPage.noResultsText": "Nincs találat a keresésre" "theme.SearchPage.noResultsText": "Nincs találat a keresésre",
"theme.SearchPage.saveRecentSearchButtonTitle": "Mentse ezt a keresést"
} }

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "informazioni", "theme.admonition.info": "informazioni",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "mancia", "theme.admonition.tip": "mancia",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archivio", "theme.blog.archive.description": "Archivio",
"theme.blog.archive.title": "Archivio", "theme.blog.archive.title": "Archivio",
"theme.blog.paginator.navAriaLabel": "Navigazione nella pagina dei post del blog ", "theme.blog.paginator.navAriaLabel": "Navigazione nella pagina dei post del blog ",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "備考", "theme.admonition.info": "備考",
"theme.admonition.note": "注記", "theme.admonition.note": "注記",
"theme.admonition.tip": "ヒント", "theme.admonition.tip": "ヒント",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "アーカイブ", "theme.blog.archive.description": "アーカイブ",
"theme.blog.archive.title": "アーカイブ", "theme.blog.archive.title": "アーカイブ",
"theme.blog.paginator.navAriaLabel": "ブログ記事一覧のナビゲーション", "theme.blog.paginator.navAriaLabel": "ブログ記事一覧のナビゲーション",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "정보", "theme.admonition.info": "정보",
"theme.admonition.note": "노트", "theme.admonition.note": "노트",
"theme.admonition.tip": "팁", "theme.admonition.tip": "팁",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "게시물 목록", "theme.blog.archive.description": "게시물 목록",
"theme.blog.archive.title": "게시물 목록", "theme.blog.archive.title": "게시물 목록",
"theme.blog.paginator.navAriaLabel": "블로그 게시물 목록 탐색", "theme.blog.paginator.navAriaLabel": "블로그 게시물 목록 탐색",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "merknad", "theme.admonition.note": "merknad",
"theme.admonition.tip": "tips", "theme.admonition.tip": "tips",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arkiv", "theme.blog.archive.description": "Arkiv",
"theme.blog.archive.title": "Arkiv", "theme.blog.archive.title": "Arkiv",
"theme.blog.paginator.navAriaLabel": "Navigering av bloggliste", "theme.blog.paginator.navAriaLabel": "Navigering av bloggliste",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "notitie", "theme.admonition.note": "notitie",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archief", "theme.blog.archive.description": "Archief",
"theme.blog.archive.title": "Archief", "theme.blog.archive.title": "Archief",
"theme.blog.paginator.navAriaLabel": "Paginanavigatie blog", "theme.blog.paginator.navAriaLabel": "Paginanavigatie blog",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "informacja", "theme.admonition.info": "informacja",
"theme.admonition.note": "notatka", "theme.admonition.note": "notatka",
"theme.admonition.tip": "wskazówka", "theme.admonition.tip": "wskazówka",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archiwum", "theme.blog.archive.description": "Archiwum",
"theme.blog.archive.title": "Archiwum", "theme.blog.archive.title": "Archiwum",
"theme.blog.paginator.navAriaLabel": "Nawigacja na stronie listy wpisów na blogu", "theme.blog.paginator.navAriaLabel": "Nawigacja na stronie listy wpisów na blogu",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arquivo", "theme.blog.archive.description": "Arquivo",
"theme.blog.archive.title": "Arquivo", "theme.blog.archive.title": "Arquivo",
"theme.blog.paginator.navAriaLabel": "Navegação da página de listagem do blog", "theme.blog.paginator.navAriaLabel": "Navegação da página de listagem do blog",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive", "theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive", "theme.blog.archive.title": "Archive",
"theme.blog.paginator.navAriaLabel": "Navegação da página de listagem do blog", "theme.blog.paginator.navAriaLabel": "Navegação da página de listagem do blog",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "к сведению", "theme.admonition.info": "к сведению",
"theme.admonition.note": "примечание", "theme.admonition.note": "примечание",
"theme.admonition.tip": "подсказка", "theme.admonition.tip": "подсказка",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архив", "theme.blog.archive.description": "Архив",
"theme.blog.archive.title": "Архив", "theme.blog.archive.title": "Архив",
"theme.blog.paginator.navAriaLabel": "Навигация по странице списка блогов", "theme.blog.paginator.navAriaLabel": "Навигация по странице списка блогов",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "informacija", "theme.admonition.info": "informacija",
"theme.admonition.note": "opomba", "theme.admonition.note": "opomba",
"theme.admonition.tip": "namig", "theme.admonition.tip": "namig",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arhiv", "theme.blog.archive.description": "Arhiv",
"theme.blog.archive.title": "Arhiv", "theme.blog.archive.title": "Arhiv",
"theme.blog.paginator.navAriaLabel": "Navigacija kazala po blogu", "theme.blog.paginator.navAriaLabel": "Navigacija kazala po blogu",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "note", "theme.admonition.note": "note",
"theme.admonition.tip": "tip", "theme.admonition.tip": "tip",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архива", "theme.blog.archive.description": "Архива",
"theme.blog.archive.title": "Архива", "theme.blog.archive.title": "Архива",
"theme.blog.paginator.navAriaLabel": "Навигација за странице блога", "theme.blog.paginator.navAriaLabel": "Навигација за странице блога",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "info", "theme.admonition.info": "info",
"theme.admonition.note": "anteckning", "theme.admonition.note": "anteckning",
"theme.admonition.tip": "tips", "theme.admonition.tip": "tips",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arkiv", "theme.blog.archive.description": "Arkiv",
"theme.blog.archive.title": "Arkiv", "theme.blog.archive.title": "Arkiv",
"theme.blog.paginator.navAriaLabel": "Navigation av Blogglista", "theme.blog.paginator.navAriaLabel": "Navigation av Blogglista",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "bilgi", "theme.admonition.info": "bilgi",
"theme.admonition.note": "not", "theme.admonition.note": "not",
"theme.admonition.tip": "ipucu", "theme.admonition.tip": "ipucu",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arşiv", "theme.blog.archive.description": "Arşiv",
"theme.blog.archive.title": "Arşiv", "theme.blog.archive.title": "Arşiv",
"theme.blog.paginator.navAriaLabel": "Blog gönderi sayfası navigasyonu", "theme.blog.paginator.navAriaLabel": "Blog gönderi sayfası navigasyonu",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "інформація", "theme.admonition.info": "інформація",
"theme.admonition.note": "примітка", "theme.admonition.note": "примітка",
"theme.admonition.tip": "порада", "theme.admonition.tip": "порада",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архів", "theme.blog.archive.description": "Архів",
"theme.blog.archive.title": "Архів", "theme.blog.archive.title": "Архів",
"theme.blog.paginator.navAriaLabel": "Навігація по сторінці списку блогів", "theme.blog.paginator.navAriaLabel": "Навігація по сторінці списку блогів",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "thông tin", "theme.admonition.info": "thông tin",
"theme.admonition.note": "ghi chú", "theme.admonition.note": "ghi chú",
"theme.admonition.tip": "mẹo", "theme.admonition.tip": "mẹo",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Lưu trữ", "theme.blog.archive.description": "Lưu trữ",
"theme.blog.archive.title": "Lưu trữ", "theme.blog.archive.title": "Lưu trữ",
"theme.blog.paginator.navAriaLabel": "Thanh điều hướng của trang danh sách bài viết", "theme.blog.paginator.navAriaLabel": "Thanh điều hướng của trang danh sách bài viết",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "信息", "theme.admonition.info": "信息",
"theme.admonition.note": "备注", "theme.admonition.note": "备注",
"theme.admonition.tip": "提示", "theme.admonition.tip": "提示",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "历史博文", "theme.blog.archive.description": "历史博文",
"theme.blog.archive.title": "历史博文", "theme.blog.archive.title": "历史博文",
"theme.blog.paginator.navAriaLabel": "博文列表分页导航", "theme.blog.paginator.navAriaLabel": "博文列表分页导航",

View file

@ -19,6 +19,7 @@
"theme.admonition.info": "信息", "theme.admonition.info": "信息",
"theme.admonition.note": "備註", "theme.admonition.note": "備註",
"theme.admonition.tip": "提示", "theme.admonition.tip": "提示",
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "歷史文章", "theme.blog.archive.description": "歷史文章",
"theme.blog.archive.title": "歷史文章", "theme.blog.archive.title": "歷史文章",
"theme.blog.paginator.navAriaLabel": "部落格文章列表分頁導覽", "theme.blog.paginator.navAriaLabel": "部落格文章列表分頁導覽",

View file

@ -53,3 +53,63 @@ import InfoIcon from "@theme/Admonition/Icon/Info"
content content
</Admonition> </Admonition>
``` ```
## Official admonitions
Admonitions that are [officially documented](/docs/markdown-features/admonitions)
:::note
note
:::
:::info
info
:::
:::tip
tip
:::
:::warning
warning
:::
:::danger
danger
:::
## Legacy admonitions
:::secondary
secondary
:::
:::important
important
:::
:::success
success
:::
:::caution
caution
:::

View file

@ -271,13 +271,13 @@ Emojis in this text will be replaced with [remark-emoji](https://www.npmjs.com/p
## Admonitions ## Admonitions
:::caution Interpolated `title` with a <button style={{color: "red"}} onClick={() => alert("it works")}>button</button> (old syntax) :::warning Interpolated `title` with a <button style={{color: "red"}} onClick={() => alert("it works")}>button</button> (old syntax)
Admonition body Admonition body
::: :::
:::caution[Interpolated `title` with a <button style={{color: "red"}} onClick={() => alert("it works")}>button</button> (directive label syntax)] :::warning[Interpolated `title` with a <button style={{color: "red"}} onClick={() => alert("it works")}>button</button> (directive label syntax)]
Admonition body Admonition body

View file

@ -22,7 +22,7 @@ Google Tag Manager is a tag management system that allows great flexibility. It
We now have a [`@docusaurus/plugin-google-tag-manager`](/docs/api/plugins/@docusaurus/plugin-google-tag-manager/) package that you can use alongside or as an alternative to the existing [gtag.js plugin](/docs/api/plugins/@docusaurus/plugin-google-gtag/) (refer to [this doc](https://support.google.com/tagmanager/answer/7582054) to understand when to use which solution). We now have a [`@docusaurus/plugin-google-tag-manager`](/docs/api/plugins/@docusaurus/plugin-google-tag-manager/) package that you can use alongside or as an alternative to the existing [gtag.js plugin](/docs/api/plugins/@docusaurus/plugin-google-gtag/) (refer to [this doc](https://support.google.com/tagmanager/answer/7582054) to understand when to use which solution).
:::caution Google is sunsetting Universal Analytics :::warning Google is sunsetting Universal Analytics
[Google will sunset its Universal Analytics](https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/) on **July 1, 2023**, and ask users to migrate to **Google Analytics 4**. [Google will sunset its Universal Analytics](https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/) on **July 1, 2023**, and ask users to migrate to **Google Analytics 4**.

View file

@ -104,7 +104,7 @@ module.exports = {
}; };
``` ```
:::caution Google is sunsetting Universal Analytics :::warning Google is sunsetting Universal Analytics
**[Google will sunset its Universal Analytics](https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/)** on **July 1, 2023**. **[Google will sunset its Universal Analytics](https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/)** on **July 1, 2023**.

View file

@ -32,7 +32,7 @@ A canary release passes all automated tests and is used in production by the Doc
<InsertIfCanaryVersionUnknown> <InsertIfCanaryVersionUnknown>
``` ```
:::caution :::warning
The canary version shown below **may not be up-to-date**. Please go to the [npm page](https://www.npmjs.com/package/@docusaurus/core?activeTab=versions) to find the actual version name. The canary version shown below **may not be up-to-date**. Please go to the [npm page](https://www.npmjs.com/package/@docusaurus/core?activeTab=versions) to find the actual version name.
@ -97,7 +97,7 @@ You can also upgrade the `@docusaurus/*` packages with command line:
npm install --save-exact @docusaurus/core@canary @docusaurus/preset-classic@canary npm install --save-exact @docusaurus/core@canary @docusaurus/preset-classic@canary
``` ```
:::caution :::warning
Make sure to include all the `@docusaurus/*` packages. Make sure to include all the `@docusaurus/*` packages.

View file

@ -121,7 +121,7 @@ The next version passes all our automated tests and is used by the Docusaurus si
::: :::
:::caution :::warning
Breaking changes can happen on the next version: detailed upgrade instructions are available in the changelog and pull requests. Breaking changes can happen on the next version: detailed upgrade instructions are available in the changelog and pull requests.

View file

@ -52,7 +52,7 @@ export default function CodeBlock(props) {
Check the code of `@docusaurus/theme-live-codeblock` for details. Check the code of `@docusaurus/theme-live-codeblock` for details.
:::caution :::warning
Unless you want to publish a re-usable "theme enhancer" (like `@docusaurus/theme-live-codeblock`), you likely don't need `@theme-init`. Unless you want to publish a re-usable "theme enhancer" (like `@docusaurus/theme-live-codeblock`), you likely don't need `@theme-init`.

View file

@ -122,7 +122,7 @@ If you want to render any dynamic content on your screen that relies on the brow
You may need to escape from SSR since static HTML can't display anything useful without knowing the client state. You may need to escape from SSR since static HTML can't display anything useful without knowing the client state.
:::caution :::warning
It is important for the first client-side render to produce the exact same DOM structure as server-side rendering, otherwise, React will correlate virtual DOM with the wrong DOM elements. It is important for the first client-side render to produce the exact same DOM structure as server-side rendering, otherwise, React will correlate virtual DOM with the wrong DOM elements.

View file

@ -652,7 +652,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) ![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. 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. 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. 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. - `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. - 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. 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 # Plugin Method References
:::caution :::warning
This section is a work in progress. Anchor links or even URLs are not guaranteed to be stable. 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. 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. 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. 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. 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. 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})`) 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. 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. 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. 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. 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**. The [feed feature](../../blog.mdx#feed) works by extracting the build output, and is **only active in production**.

View file

@ -19,7 +19,7 @@ If you are still using this plugin with a `UA-*` tracking id, you should create
::: :::
:::caution production only :::warning production only
This plugin is always inactive in development and **only active in production** to avoid polluting the analytics statistics. 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. 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. This plugin is always inactive in development and **only active in production** to avoid polluting the analytics statistics.

View file

@ -36,7 +36,7 @@ import thumbnail from './path/to/img.png';
<Image img={require('./path/to/img.png')} /> <Image img={require('./path/to/img.png')} />
``` ```
:::caution :::warning
This plugin registers a [Webpack loader](https://webpack.js.org/loaders/) that changes the type of imported/require images: This plugin registers a [Webpack loader](https://webpack.js.org/loaders/) that changes the type of imported/require images:

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. 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. 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` - `saveData`: activates for users with `navigator.connection.saveData === true`
- `always`: activates for all users - `always`: activates for all users
:::caution :::warning
Use this carefully: some users may not like to be forced to use the offline mode. 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. 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. 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) - [@docusaurus/theme-classic](./theme-classic.mdx)
- 🚧 other themes are planned - 🚧 other themes are planned
:::caution :::warning
The goal is to have all themes share the exact same features, user-experience and configuration. 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. With `respectPrefersColorScheme: true`, the `defaultMode` is overridden by user system preferences.

View file

@ -374,7 +374,7 @@ website/i18n/[locale]/docusaurus-plugin-content-blog/authors.yml
An author, either declared through front matter or through the authors map, needs to have a name or an avatar, or both. If all authors of a post don't have names, Docusaurus will display their avatars compactly. See [this test post](/tests/blog/2022/01/20/image-only-authors) for the effect. An author, either declared through front matter or through the authors map, needs to have a name or an avatar, or both. If all authors of a post don't have names, Docusaurus will display their avatars compactly. See [this test post](/tests/blog/2022/01/20/image-only-authors) for the effect.
:::caution Feed generation :::warning Feed generation
[RSS feeds](#feed) require the author's email to be set for the author to appear in the feed. [RSS feeds](#feed) require the author's email to be set for the author to appear in the feed.
@ -619,7 +619,7 @@ module.exports = {
}; };
``` ```
:::caution :::warning
Don't forget to delete the existing homepage at `./src/pages/index.js` or else there will be two files mapping to the same route! Don't forget to delete the existing homepage at `./src/pages/index.js` or else there will be two files mapping to the same route!

View file

@ -33,7 +33,7 @@ However, this penalizes all other users with increased site load time because th
The browser list by default is provided through the `package.json` file as a root `browserslist` field. The browser list by default is provided through the `package.json` file as a root `browserslist` field.
:::caution :::warning
On old browsers, the compiled output will use unsupported (too recent) JS syntax, causing React to fail to initialize and end up with a static website with only HTML/CSS and no JS. On old browsers, the compiled output will use unsupported (too recent) JS syntax, causing React to fail to initialize and end up with a static website with only HTML/CSS and no JS.

View file

@ -46,7 +46,7 @@ Builds and serves a preview of your site locally with [Webpack Dev Server](https
| `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). | | `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). |
| `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. | | `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. |
:::important :::info
Please note that some functionality (for example, anchor links) will not work in development. The functionality will work as expected in production. Please note that some functionality (for example, anchor links) will not work in development. The functionality will work as expected in production.
@ -125,7 +125,7 @@ The swizzle CLI is interactive and will guide you through the whole [swizzle pro
| `--typescript` | Swizzle the TypeScript variant component | | `--typescript` | Swizzle the TypeScript variant component |
| `--config` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` | | `--config` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
:::caution :::warning
Unsafe components have a higher risk of breaking changes due to internal refactorings. Unsafe components have a higher risk of breaking changes due to internal refactorings.

View file

@ -177,7 +177,7 @@ If you did not configure these build options, you may still go to "Site settings
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `main`. Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `main`.
:::caution :::warning
Some Docusaurus sites put the `docs` folder outside of `website` (most likely former Docusaurus v1 sites): Some Docusaurus sites put the `docs` folder outside of `website` (most likely former Docusaurus v1 sites):
@ -254,7 +254,7 @@ First, modify your `docusaurus.config.js` and add the following params:
These fields also have their environment variable counterparts which have a higher priority: `ORGANIZATION_NAME`, `PROJECT_NAME`, and `DEPLOYMENT_BRANCH`. These fields also have their environment variable counterparts which have a higher priority: `ORGANIZATION_NAME`, `PROJECT_NAME`, and `DEPLOYMENT_BRANCH`.
:::caution :::warning
GitHub Pages adds a trailing slash to Docusaurus URLs by default. It is recommended to set a `trailingSlash` config (`true` or `false`, not `undefined`). GitHub Pages adds a trailing slash to Docusaurus URLs by default. It is recommended to set a `trailingSlash` config (`true` or `false`, not `undefined`).
@ -336,7 +336,7 @@ cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
</Tabs> </Tabs>
``` ```
:::caution :::warning
Beginning in August 2021, GitHub requires every command-line sign-in to use the **personal access token** instead of the password. When GitHub prompts for your password, enter the PAT instead. See the [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) for more information. Beginning in August 2021, GitHub requires every command-line sign-in to use the **personal access token** instead of the password. When GitHub prompts for your password, enter the PAT instead. See the [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) for more information.

View file

@ -57,7 +57,7 @@ This component doesn't catch build-time errors and only protects against client-
- `fallback`: an optional render callback returning a JSX element. It will receive an object with 2 attributes: `error`, the error that was caught, and `tryAgain`, a function (`() => void`) callback to reset the error in the component and try rendering it again. If not present, `@theme/Error` will be rendered instead. `@theme/Error` is used for the error boundaries wrapping the site, above the layout. - `fallback`: an optional render callback returning a JSX element. It will receive an object with 2 attributes: `error`, the error that was caught, and `tryAgain`, a function (`() => void`) callback to reset the error in the component and try rendering it again. If not present, `@theme/Error` will be rendered instead. `@theme/Error` is used for the error boundaries wrapping the site, above the layout.
:::caution :::warning
The `fallback` prop is a callback, and **not a React functional component**. You can't use React hooks inside this callback. The `fallback` prop is a callback, and **not a React functional component**. You can't use React hooks inside this callback.
@ -411,7 +411,7 @@ The `siteConfig` object only contains **serializable values** (values that are p
Returns `true` when the React app has successfully hydrated in the browser. Returns `true` when the React app has successfully hydrated in the browser.
:::caution :::warning
Use this hook instead of `typeof windows !== 'undefined'` in React rendering logic. Use this hook instead of `typeof windows !== 'undefined'` in React rendering logic.
@ -437,7 +437,7 @@ const MyComponent = () => {
React hook to prepend your site `baseUrl` to a string. React hook to prepend your site `baseUrl` to a string.
:::caution :::warning
**Don't use it for regular links!** **Don't use it for regular links!**
@ -697,7 +697,7 @@ export default function Home() {
A module that exposes a few boolean variables to check the current rendering environment. A module that exposes a few boolean variables to check the current rendering environment.
:::caution :::warning
For React rendering logic, use [`useIsBrowser()`](#useIsBrowser) or [`<BrowserOnly>`](#browseronly) instead. For React rendering logic, use [`useIsBrowser()`](#useIsBrowser) or [`<BrowserOnly>`](#browseronly) instead.

View file

@ -129,7 +129,7 @@ my-website
. .
``` ```
:::caution :::warning
All JavaScript/TypeScript files within the `src/pages/` directory will have corresponding website paths generated for them. If you want to create reusable components into that directory, use the `exclude` option (by default, files prefixed with `_`, test files(`.test.js`), and files in `__tests__` directory are not turned into pages). All JavaScript/TypeScript files within the `src/pages/` directory will have corresponding website paths generated for them. If you want to create reusable components into that directory, use the `exclude` option (by default, files prefixed with `_`, test files(`.test.js`), and files in `__tests__` directory are not turned into pages).

View file

@ -99,7 +99,7 @@ slug: /
This page will be the home page when users visit https://example.com/. This page will be the home page when users visit https://example.com/.
``` ```
:::caution :::warning
If you added `slug: /` to a doc to make it the homepage, you should delete the existing homepage at `./src/pages/index.js`, or else there will be two files mapping to the same route! If you added `slug: /` to a doc to make it the homepage, you should delete the existing homepage at `./src/pages/index.js`, or else there will be two files mapping to the same route!

View file

@ -29,7 +29,7 @@ If you build a cross-platform mobile SDK, you may have 2 documentations:
In this case, you can use a distinct docs plugin instance per mobile SDK documentation. In this case, you can use a distinct docs plugin instance per mobile SDK documentation.
:::caution :::warning
If each documentation instance is very large, you should rather create 2 distinct Docusaurus sites. If each documentation instance is very large, you should rather create 2 distinct Docusaurus sites.
@ -55,7 +55,7 @@ Suppose you have 2 documentations:
In this case, you should use the same plugin twice in your site configuration. In this case, you should use the same plugin twice in your site configuration.
:::caution :::warning
`@docusaurus/preset-classic` already includes a docs plugin instance for you! `@docusaurus/preset-classic` already includes a docs plugin instance for you!

View file

@ -408,7 +408,7 @@ To make it **easier to adopt**, Docusaurus supports **multiple number prefix pat
By default, Docusaurus will **remove the number prefix** from the doc id, title, label, and URL paths. By default, Docusaurus will **remove the number prefix** from the doc id, title, label, and URL paths.
:::caution :::warning
**Prefer using [additional metadata](#autogenerated-sidebar-metadata)**. **Prefer using [additional metadata](#autogenerated-sidebar-metadata)**.

View file

@ -400,7 +400,7 @@ module.exports = {
}; };
``` ```
:::caution :::warning
When a category has `collapsed: true` but `collapsible: false` (either through `sidebars.js` or through plugin configuration), the latter takes precedence and the category is still rendered as expanded. When a category has `collapsed: true` but `collapsible: false` (either through `sidebars.js` or through plugin configuration), the latter takes precedence and the category is still rendered as expanded.

View file

@ -11,7 +11,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; import TabItem from '@theme/TabItem';
``` ```
:::caution :::warning
Think about it before starting to version your documentation - it can become difficult for contributors to help improve it! Think about it before starting to version your documentation - it can become difficult for contributors to help improve it!

View file

@ -34,7 +34,7 @@ Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
::: :::
:::caution :::warning
Some **content** with _Markdown_ `syntax`. Check [this `api`](#). Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
@ -68,7 +68,7 @@ Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
::: :::
:::caution :::warning
Some **content** with _Markdown_ `syntax`. Check [this `api`](#). Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
@ -231,7 +231,7 @@ export default function MyReactPage() {
} }
``` ```
The types that are accepted are the same as above: `note`, `tip`, `danger`, `info`, `caution`. Optionally, you can specify an icon by passing a JSX element or a string, or a title: The types that are accepted are the same as above: `note`, `tip`, `danger`, `info`, `warning`. Optionally, you can specify an icon by passing a JSX element or a string, or a title:
```jsx title="MyReactPage.jsx" ```jsx title="MyReactPage.jsx"
<Admonition type="tip" icon="💡" title="Did you know..."> <Admonition type="tip" icon="💡" title="Did you know...">
@ -282,7 +282,7 @@ module.exports = {
{ {
docs: { docs: {
admonitions: { admonitions: {
keywords: ['note', 'tip', 'info', 'caution', 'danger'], keywords: ['note', 'tip', 'info', 'warning', 'danger'],
extendDefaults: true, extendDefaults: true,
}, },
}, },

View file

@ -80,7 +80,7 @@ Because a Prism theme is just a JS object, you can also write your own theme if
By default, Docusaurus comes with a subset of [commonly used languages](https://github.com/FormidableLabs/prism-react-renderer/blob/master/packages/generate-prism-languages/index.ts#L9-L23). By default, Docusaurus comes with a subset of [commonly used languages](https://github.com/FormidableLabs/prism-react-renderer/blob/master/packages/generate-prism-languages/index.ts#L9-L23).
:::caution :::warning
Some popular languages like Java, C#, or PHP are not enabled by default. Some popular languages like Java, C#, or PHP are not enabled by default.
@ -512,7 +512,7 @@ function Clock(props) {
### Imports {#imports} ### Imports {#imports}
:::caution react-live and imports :::warning react-live and imports
It is not possible to import components directly from the react-live code editor, you have to define available imports upfront. It is not possible to import components directly from the react-live code editor, you have to define available imports upfront.
@ -644,13 +644,13 @@ If you want to embed HTML markup such as anchor links or bold type, you can use
</pre> </pre>
</BrowserWindow> </BrowserWindow>
:::caution MDX is whitespace insensitive :::warning MDX is whitespace insensitive
MDX is in line with JSX behavior: line break characters, even when inside `<pre>`, are turned into spaces. You have to explicitly write the new line character for it to be printed out. MDX is in line with JSX behavior: line break characters, even when inside `<pre>`, are turned into spaces. You have to explicitly write the new line character for it to be printed out.
::: :::
:::caution :::warning
Syntax highlighting only works on plain strings. Docusaurus will not attempt to parse code block content containing JSX children. Syntax highlighting only works on plain strings. Docusaurus will not attempt to parse code block content containing JSX children.

View file

@ -57,7 +57,7 @@ To enable KaTeX, you need to install `remark-math` and `rehype-katex` plugins.
npm install --save remark-math@5 rehype-katex@6 npm install --save remark-math@5 rehype-katex@6
``` ```
:::caution :::warning
Make sure to use `remark-math >= 5` and `rehype-katex >= 6` for Docusaurus v3 (using MDX v2). Make sure to use `remark-math >= 5` and `rehype-katex >= 6` for Docusaurus v3 (using MDX v2).

View file

@ -57,7 +57,7 @@ Next, the `rehype-katex` operates on the Hypertext AST where everything has been
</details> </details>
:::caution :::warning
Many official Remark/Rehype plugins are using ES Modules, a new JavaScript module system, which Docusaurus doesn't support yet. To work around this issue, we recommend to use dynamic `import()` inside an `async` config creation function. Many official Remark/Rehype plugins are using ES Modules, a new JavaScript module system, which Docusaurus doesn't support yet. To work around this issue, we recommend to use dynamic `import()` inside an `async` config creation function.

View file

@ -72,7 +72,7 @@ I can write **Markdown** alongside my _JSX_!
</BrowserWindow> </BrowserWindow>
``` ```
:::caution MDX is JSX :::warning MDX is JSX
Since all doc files are parsed using MDX, anything that looks like HTML is actually JSX. Therefore, if you need to inline-style a component, follow JSX flavor and provide style objects. Since all doc files are parsed using MDX, anything that looks like HTML is actually JSX. Therefore, if you need to inline-style a component, follow JSX flavor and provide style objects.
@ -198,7 +198,7 @@ From MDX v2+ onward (Docusaurus v3+), lower-case tag names are always rendered a
::: :::
:::caution :::warning
This feature is powered by [an `MDXProvider`](https://mdxjs.com/docs/using-mdx/#mdx-provider). If you are importing Markdown in a React page, you have to supply this provider yourself through the `MDXContent` theme component. This feature is powered by [an `MDXProvider`](https://mdxjs.com/docs/using-mdx/#mdx-provider). If you are importing Markdown in a React page, you have to supply this provider yourself through the `MDXContent` theme component.
@ -319,7 +319,7 @@ import PartialExample from './_markdown-partial-example.mdx';
This way, you can reuse content among multiple pages and avoid duplicating materials. This way, you can reuse content among multiple pages and avoid duplicating materials.
:::caution :::warning
Currently, the table of contents does not contain the imported Markdown headings. This is a technical limitation that we are trying to solve ([issue](https://github.com/facebook/docusaurus/issues/3915)). Currently, the table of contents does not contain the imported Markdown headings. This is a technical limitation that we are trying to solve ([issue](https://github.com/facebook/docusaurus/issues/3915)).

View file

@ -53,7 +53,7 @@ Use the **[`write-heading-ids`](../../cli.mdx#docusaurus-write-heading-ids-sited
::: :::
:::caution Avoid colliding IDs :::warning Avoid colliding IDs
Generated heading IDs will be guaranteed to be unique on each page, but if you use custom IDs, make sure each one appears exactly once on each page, or there will be two DOM elements with the same ID, which is invalid HTML semantics, and will lead to one heading being unlinkable. Generated heading IDs will be guaranteed to be unique on each page, but if you use custom IDs, make sure each one appears exactly once on each page, or there will be two DOM elements with the same ID, which is invalid HTML semantics, and will lead to one heading being unlinkable.
@ -174,7 +174,7 @@ The ability to ergonomically insert extra headings or ignore certain headings is
--- ---
:::caution :::warning
Below is just some dummy content to have more table of contents items available on the current page. Below is just some dummy content to have more table of contents items available on the current page.

View file

@ -12,7 +12,7 @@ You can integrate Docusaurus with the **tools and SaaS of your choice**, as long
We document the usage of [Crowdin](https://crowdin.com/), as **one** possible **integration example**. We document the usage of [Crowdin](https://crowdin.com/), as **one** possible **integration example**.
:::caution :::warning
This is **not an endorsement of Crowdin** as the unique choice to translate a Docusaurus site, but it is successfully used by Facebook to translate documentation projects such as [Jest](https://jestjs.io/), [Docusaurus](https://docusaurus.io/), and [ReasonML](https://reasonml.github.io/). This is **not an endorsement of Crowdin** as the unique choice to translate a Docusaurus site, but it is successfully used by Facebook to translate documentation projects such as [Jest](https://jestjs.io/), [Docusaurus](https://docusaurus.io/), and [ReasonML](https://reasonml.github.io/).
@ -166,7 +166,7 @@ You can keep the default value `CROWDIN_PERSONAL_TOKEN`, and set this environmen
::: :::
:::caution :::warning
A Personal Access Tokens grant **read-write access to all your Crowdin projects**. A Personal Access Tokens grant **read-write access to all your Crowdin projects**.
@ -318,7 +318,7 @@ Keep your deploy-previews fast: don't download translations, and use `npm run bu
::: :::
:::caution :::warning
Crowdin does not support well multiple concurrent uploads/downloads: it is preferable to only include translations to your production deployment, and keep deploy previews untranslated. Crowdin does not support well multiple concurrent uploads/downloads: it is preferable to only include translations to your production deployment, and keep deploy previews untranslated.
@ -328,7 +328,7 @@ Crowdin does not support well multiple concurrent uploads/downloads: it is prefe
### MDX {#mdx} ### MDX {#mdx}
:::caution :::warning
Pay special attention to the JSX fragments in MDX documents! Pay special attention to the JSX fragments in MDX documents!
@ -394,7 +394,7 @@ Crowdin provides a `Duplicate Strings` setting.
We recommend using `Hide`, but the ideal setting depends on how much your versions are different. We recommend using `Hide`, but the ideal setting depends on how much your versions are different.
:::caution :::warning
Not using `Hide` leads to a much larger amount of `source strings` in quotas, and will affect the pricing. Not using `Hide` leads to a much larger amount of `source strings` in quotas, and will affect the pricing.
@ -443,7 +443,7 @@ In practice, **it didn't work very reliably** for a few reasons:
Crowdin has an [In-Context localization](https://support.crowdin.com/in-context-localization/) feature. Crowdin has an [In-Context localization](https://support.crowdin.com/in-context-localization/) feature.
:::caution :::warning
Unfortunately, it does not work yet for technical reasons, but we have good hope it can be solved. Unfortunately, it does not work yet for technical reasons, but we have good hope it can be solved.

View file

@ -96,7 +96,7 @@ Please help us complete those **[default translations](https://github.com/facebo
::: :::
:::caution :::warning
Each locale is a **distinct standalone single-page application**: it is not possible to start the Docusaurus sites in all locales at the same time. Each locale is a **distinct standalone single-page application**: it is not possible to start the Docusaurus sites in all locales at the same time.
@ -123,7 +123,7 @@ Locate all text labels in your React code that will be visible to your users, an
Use the one that better fits the context semantically. For example, the `<Translate>` can be used as React children, while for props that expect a string, the callback can be used. Use the one that better fits the context semantically. For example, the `<Translate>` can be used as React children, while for props that expect a string, the callback can be used.
:::caution :::warning
A JSX element is an _object_, not a string. Using it in contexts expecting strings (such as the children of [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)) would [coerce it to a string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString), which returns `"[object Object]"`. While we encourage you to use `<Translate>` as JSX children, only use the element form when it actually works. A JSX element is an _object_, not a string. Using it in contexts expecting strings (such as the children of [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)) would [coerce it to a string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString), which returns `"[object Object]"`. While we encourage you to use `<Translate>` as JSX children, only use the element form when it actually works.
@ -232,7 +232,7 @@ Most documentation websites are generally **static** and don't need advanced i18
The `docusaurus write-translations` command will statically analyze all React code files used in your site, extract calls to these APIs, and aggregate them in the `code.json` file. The translation files will be stored as maps from IDs to translation message objects (including the translated label and the description of the label). In your calls to the translation APIs (`<Translate>` or `translate()`), you need to specify either the default untranslated message or the ID, in order for Docusaurus to correctly correlate each translation entry to the API call. The `docusaurus write-translations` command will statically analyze all React code files used in your site, extract calls to these APIs, and aggregate them in the `code.json` file. The translation files will be stored as maps from IDs to translation message objects (including the translated label and the description of the label). In your calls to the translation APIs (`<Translate>` or `translate()`), you need to specify either the default untranslated message or the ID, in order for Docusaurus to correctly correlate each translation entry to the API call.
:::caution text labels must be static :::warning text labels must be static
The `docusaurus write-translations` command only does **static analysis** of your code. It doesn't actually run your site. Therefore, dynamic messages can't be extracted, as the message is an _expression_, not a _string_: The `docusaurus write-translations` command only does **static analysis** of your code. It doesn't actually run your site. Therefore, dynamic messages can't be extracted, as the message is an _expression_, not a _string_:
@ -428,7 +428,7 @@ cp -r src/pages/**.md i18n/fr/docusaurus-plugin-content-pages
cp -r src/pages/**.mdx i18n/fr/docusaurus-plugin-content-pages cp -r src/pages/**.mdx i18n/fr/docusaurus-plugin-content-pages
``` ```
:::caution :::warning
We only copy `.md` and `.mdx` files, as React pages are translated through JSON translation files already. We only copy `.md` and `.mdx` files, as React pages are translated through JSON translation files already.
@ -503,7 +503,7 @@ On your [static hosting provider](../deployment.mdx):
- configure the appropriate build command, using the `--locale` option - configure the appropriate build command, using the `--locale` option
- configure the (sub)domain of your choice for each deployment - configure the (sub)domain of your choice for each deployment
:::caution :::warning
This strategy is **not possible** with GitHub Pages, as it is only possible to **have a single deployment**. This strategy is **not possible** with GitHub Pages, as it is only possible to **have a single deployment**.

View file

@ -293,7 +293,7 @@ module.exports = {
}; };
``` ```
:::caution :::warning
Your Algolia DocSearch v1 config (found [here](https://github.com/algolia/docsearch-configs/blob/master/configs)) should be updated for Docusaurus v2 ([example](https://github.com/algolia/docsearch-configs/tree/master/configs/docusaurus-2.json)). Your Algolia DocSearch v1 config (found [here](https://github.com/algolia/docsearch-configs/blob/master/configs)) should be updated for Docusaurus v2 ([example](https://github.com/algolia/docsearch-configs/tree/master/configs/docusaurus-2.json)).

View file

@ -70,7 +70,7 @@ This section will help you figure out how to **keep your existing v1 translation
There are **multiple possible strategies** to migrate a Docusaurus v1 site using Crowdin, with different tradeoffs. There are **multiple possible strategies** to migrate a Docusaurus v1 site using Crowdin, with different tradeoffs.
:::caution :::warning
This documentation is a best-effort to help you migrate, please help us improve it if you find a better way! This documentation is a best-effort to help you migrate, please help us improve it if you find a better way!
@ -150,7 +150,7 @@ Crowdin has an "upload translations" feature, but in our experience it does not
If you don't mind modifying your existing Crowdin project and risking to mess things up, it may be possible to use the Crowdin branch system. If you don't mind modifying your existing Crowdin project and risking to mess things up, it may be possible to use the Crowdin branch system.
:::caution :::warning
This workflow has not been tested in practice, please report us how good it is. This workflow has not been tested in practice, please report us how good it is.

View file

@ -131,7 +131,7 @@ Refer to its [official DocSearch documentation](https://docsearch.algolia.com/do
::: :::
:::caution :::warning
The search feature will not work reliably until Algolia crawls your site. The search feature will not work reliably until Algolia crawls your site.

View file

@ -181,7 +181,7 @@ Disallow:
Read more about the robots file in [the Google documentation](https://developers.google.com/search/docs/advanced/robots/intro). Read more about the robots file in [the Google documentation](https://developers.google.com/search/docs/advanced/robots/intro).
:::caution :::warning
**Important**: the `robots.txt` file does **not** prevent HTML pages from being indexed. **Important**: the `robots.txt` file does **not** prevent HTML pages from being indexed.

View file

@ -69,7 +69,7 @@ You write a link like this: [Download this document](/files/note.docx)
Docusaurus changes that to: <a href={require('static/files/note.docx')}>Download this document</a> Docusaurus changes that to: <a href={require('static/files/note.docx')}>Download this document</a>
``` ```
:::caution use Markdown syntax :::warning use Markdown syntax
Docusaurus will only parse links that are in Markdown syntax. If your asset references are using the JSX tag `<a>` / `<img>`, nothing will be done. Docusaurus will only parse links that are in Markdown syntax. If your asset references are using the JSX tag `<a>` / `<img>`, nothing will be done.

View file

@ -215,7 +215,7 @@ The class names will be processed by webpack into a globally unique class name d
## CSS-in-JS {#css-in-js} ## CSS-in-JS {#css-in-js}
:::caution :::warning
CSS-in-JS support is a work in progress, so libs like MUI may have display quirks. [Welcoming PRs](https://github.com/facebook/docusaurus/issues/1640). CSS-in-JS support is a work in progress, so libs like MUI may have display quirks. [Welcoming PRs](https://github.com/facebook/docusaurus/issues/1640).

View file

@ -143,7 +143,7 @@ export default function Footer(props) {
} }
``` ```
:::caution :::warning
Ejecting an [**unsafe**](#what-is-safe-to-swizzle) component can sometimes lead to copying a large amount of internal code, which you now have to maintain yourself. It can make Docusaurus upgrades more difficult, as you will need to migrate your customizations if the props received or internal theme APIs used have changed. Ejecting an [**unsafe**](#what-is-safe-to-swizzle) component can sometimes lead to copying a large amount of internal code, which you now have to maintain yourself. It can make Docusaurus upgrades more difficult, as you will need to migrate your customizations if the props received or internal theme APIs used have changed.

View file

@ -52,7 +52,7 @@ export default function CodeBlock(props) {
Check the code of `@docusaurus/theme-live-codeblock` for details. Check the code of `@docusaurus/theme-live-codeblock` for details.
:::caution :::warning
Unless you want to publish a re-usable "theme enhancer" (like `@docusaurus/theme-live-codeblock`), you likely don't need `@theme-init`. Unless you want to publish a re-usable "theme enhancer" (like `@docusaurus/theme-live-codeblock`), you likely don't need `@theme-init`.

View file

@ -122,7 +122,7 @@ If you want to render any dynamic content on your screen that relies on the brow
You may need to escape from SSR since static HTML can't display anything useful without knowing the client state. You may need to escape from SSR since static HTML can't display anything useful without knowing the client state.
:::caution :::warning
It is important for the first client-side render to produce the exact same DOM structure as server-side rendering, otherwise, React will correlate virtual DOM with the wrong DOM elements. It is important for the first client-side render to produce the exact same DOM structure as server-side rendering, otherwise, React will correlate virtual DOM with the wrong DOM elements.

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) ![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. 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. 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. 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. - `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. - 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. 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 # Plugin Method References
:::caution :::warning
This section is a work in progress. Anchor links or even URLs are not guaranteed to be stable. 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. 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. 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. 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. 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. 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})`) 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. 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. 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. 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. 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**. 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. 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. 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. This plugin is always inactive in development and **only active in production** to avoid polluting the analytics statistics.

Some files were not shown because too many files have changed in this diff Show more