diff --git a/CHANGELOG.md b/CHANGELOG.md index bb3245d49f70..22ab4e6fa124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,115 @@ # Docusaurus 2 Changelog +## 2.0.0-beta.21 (2022-05-27) + +#### :boom: Breaking Change + +- `docusaurus-plugin-pwa` + - [#7422](https://github.com/facebook/docusaurus/pull/7422) refactor(pwa): remove reloadPopup option in favor of swizzling ([@Josh-Cena](https://github.com/Josh-Cena)) +- `create-docusaurus`, `docusaurus-cssnano-preset`, `docusaurus-logger`, `docusaurus-mdx-loader`, `docusaurus-migrate`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-preset-classic`, `docusaurus-remark-plugin-npm2yarn`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`, `docusaurus-utils-common`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`, `lqip-loader` + - [#7501](https://github.com/facebook/docusaurus/pull/7501) chore: require Node 16.14 ([@Josh-Cena](https://github.com/Josh-Cena)) + +#### :rocket: New Feature + +- `docusaurus-plugin-sitemap` + - [#7469](https://github.com/facebook/docusaurus/pull/7469) feat(sitemap): allow customizing the output name ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-utils`, `docusaurus` + - [#7371](https://github.com/facebook/docusaurus/pull/7371) feat(core): support docusaurus.config.cjs as default file name ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus` + - [#7500](https://github.com/facebook/docusaurus/pull/7500) feat: make docusaurus serve automatically open in browser ([@Zamiell](https://github.com/Zamiell)) + - [#7452](https://github.com/facebook/docusaurus/pull/7452) feat: add --no-minify flag to docusaurus start ([@lanegoolsby](https://github.com/lanegoolsby)) +- `docusaurus-theme-classic` + - [#7357](https://github.com/facebook/docusaurus/pull/7357) feat(theme-classic): allow className as option for type: "search" ([@JPeer264](https://github.com/JPeer264)) + +#### :bug: Bug Fix + +- `docusaurus` + - [#7362](https://github.com/facebook/docusaurus/pull/7362) fix: always emit SEO title + og:title meta ([@charleskorn](https://github.com/charleskorn)) + - [#7453](https://github.com/facebook/docusaurus/pull/7453) fix(core): avoid using logger and fs.readJSON in SSR ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7369](https://github.com/facebook/docusaurus/pull/7369) fix(cli): output correct path when swizzling bare-file component in subfolder ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7360](https://github.com/facebook/docusaurus/pull/7360) fix(core): allow githubPort in config validation ([@mhughes2k](https://github.com/mhughes2k)) +- `docusaurus-plugin-google-gtag` + - [#7424](https://github.com/facebook/docusaurus/pull/7424) fix(gtag): send the newly rendered page's title instead of the old one's ([@ori-shalom](https://github.com/ori-shalom)) +- `create-docusaurus`, `docusaurus-utils` + - [#7507](https://github.com/facebook/docusaurus/pull/7507) fix(create-docusaurus): potential security issue with command injection ([@slorber](https://github.com/slorber)) +- `docusaurus-module-type-aliases`, `docusaurus-theme-classic`, `docusaurus` + - [#7492](https://github.com/facebook/docusaurus/pull/7492) fix(core): always treat error boundary fallback as a callback ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-theme-classic` + - [#7438](https://github.com/facebook/docusaurus/pull/7438) fix(theme-classic): allow nested task lists to preserve the indent ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7430](https://github.com/facebook/docusaurus/pull/7430) fix(theme-classic): consistently apply the right active class name for all navbar items ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7411](https://github.com/facebook/docusaurus/pull/7411) fix(theme-classic): autocollapse sidebar categories when navigating with paginator ([@pranabdas](https://github.com/pranabdas)) + - [#7363](https://github.com/facebook/docusaurus/pull/7363) fix(theme-classic): resolve customCss from site dir ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-utils` + - [#7464](https://github.com/facebook/docusaurus/pull/7464) fix(utils): fix Markdown link replacement when link text is same as href ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7458](https://github.com/facebook/docusaurus/pull/7458) fix(utils): avoid replacing Markdown links missing the directly next link ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-mdx-loader` + - [#7392](https://github.com/facebook/docusaurus/pull/7392) fix(mdx-loader): use React.Fragment as fragment factory ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-plugin-content-docs` + - [#7385](https://github.com/facebook/docusaurus/pull/7385) fix(content-docs): restore functionality when a category only has index page ([@Josh-Cena](https://github.com/Josh-Cena)) + +#### :nail_care: Polish + +- `docusaurus-theme-translations` + - [#7493](https://github.com/facebook/docusaurus/pull/7493) chore(theme-translations): complete French translations ([@forresst](https://github.com/forresst)) + - [#7474](https://github.com/facebook/docusaurus/pull/7474) chore(theme-translations): complete zh translations ([@Josh-Cena](https://github.com/Josh-Cena)) + - [#7400](https://github.com/facebook/docusaurus/pull/7400) chore(theme-translations): complete Farsi translations ([@massoudmaboudi](https://github.com/massoudmaboudi)) +- `docusaurus` + - [#7499](https://github.com/facebook/docusaurus/pull/7499) fix: avoid printing period after localhost URL ([@Zamiell](https://github.com/Zamiell)) +- `create-docusaurus` + - [#7374](https://github.com/facebook/docusaurus/pull/7374) refactor(create): clean up logic when prompting for unspecified arguments ([@Josh-Cena](https://github.com/Josh-Cena)) + +#### :memo: Documentation + +- [#7503](https://github.com/facebook/docusaurus/pull/7503) docs: document MDXComponents scope ([@Josh-Cena](https://github.com/Josh-Cena)) +- [#7497](https://github.com/facebook/docusaurus/pull/7497) docs: link every reference of types in API table to the type definition ([@Zamiell](https://github.com/Zamiell)) +- [#7407](https://github.com/facebook/docusaurus/pull/7407) docs: add Azure SWA as deployment option ([@nitya](https://github.com/nitya)) +- [#7390](https://github.com/facebook/docusaurus/pull/7390) fix(website): use react-lite-youtube-embed for lazy YouTube video ([@matkoch](https://github.com/matkoch)) + +#### :wrench: Maintenance + +- `create-docusaurus`, `docusaurus-logger`, `docusaurus-mdx-loader`, `docusaurus-migrate`, `docusaurus-module-type-aliases`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-remark-plugin-npm2yarn`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `lqip-loader`, `stylelint-copyright` + - [#7477](https://github.com/facebook/docusaurus/pull/7477) refactor: fix a lot of errors in type-aware linting ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-theme-classic`, `docusaurus-theme-translations` + - [#7447](https://github.com/facebook/docusaurus/pull/7447) refactor(theme-classic): migrate to tsc for build ([@Josh-Cena](https://github.com/Josh-Cena)) +- `stylelint-copyright` + - [#7441](https://github.com/facebook/docusaurus/pull/7441) refactor(stylelint-copyright): migrate to TS ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-cssnano-preset` + - [#7440](https://github.com/facebook/docusaurus/pull/7440) refactor(cssnano-preset): migrate to TS ([@Josh-Cena](https://github.com/Josh-Cena)) +- `create-docusaurus`, `docusaurus-logger`, `docusaurus-mdx-loader`, `docusaurus-migrate`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-preset-classic`, `docusaurus-remark-plugin-npm2yarn`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`, `docusaurus-utils-common`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`, `lqip-loader` + - [#7437](https://github.com/facebook/docusaurus/pull/7437) refactor: use TS project references instead of running tsc multiple times ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-plugin-pwa` + - [#7421](https://github.com/facebook/docusaurus/pull/7421) refactor(pwa): migrate client modules to TS ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus-theme-classic` + - [#7415](https://github.com/facebook/docusaurus/pull/7415) refactor(theme-classic): always collocate stylesheets with components in one folder ([@Josh-Cena](https://github.com/Josh-Cena)) +- `docusaurus` + - [#7405](https://github.com/facebook/docusaurus/pull/7405) refactor(core): properly code-split NotFound page ([@Josh-Cena](https://github.com/Josh-Cena)) + +#### Committers: 23 + +- Akara ([@Messiahhh](https://github.com/Messiahhh)) +- Benjamin Diolez ([@BenDz](https://github.com/BenDz)) +- Charles Korn ([@charleskorn](https://github.com/charleskorn)) +- Designatory ([@Designatory](https://github.com/Designatory)) +- Forresst ([@forresst](https://github.com/forresst)) +- Ggicci ([@ggicci](https://github.com/ggicci)) +- James ([@Zamiell](https://github.com/Zamiell)) +- Jan Peer Stöcklmair ([@JPeer264](https://github.com/JPeer264)) +- Jeremy ([@jrmyw92](https://github.com/jrmyw92)) +- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena)) +- Junjie ([@junjieweb](https://github.com/junjieweb)) +- Lane Goolsby ([@lanegoolsby](https://github.com/lanegoolsby)) +- Massoud Maboudi ([@massoudmaboudi](https://github.com/massoudmaboudi)) +- Matthias Koch ([@matkoch](https://github.com/matkoch)) +- Michael Hughes ([@mhughes2k](https://github.com/mhughes2k)) +- Ngô Quốc Đạt ([@datlechin](https://github.com/datlechin)) +- Nitya Narasimhan ([@nitya](https://github.com/nitya)) +- Oluwatobi Sofela ([@oluwatobiss](https://github.com/oluwatobiss)) +- Ori Shalom ([@ori-shalom](https://github.com/ori-shalom)) +- Pranab Das ([@pranabdas](https://github.com/pranabdas)) +- Rui Peres ([@RuiAAPeres](https://github.com/RuiAAPeres)) +- Sébastien Lorber ([@slorber](https://github.com/slorber)) +- 凱恩 Kane ([@Gary50613](https://github.com/Gary50613)) + ## 2.0.0-beta.20 (2022-05-05) #### :bug: Bug Fix diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/architecture.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/architecture.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/architecture.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/architecture.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/client.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/client.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/client.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/client.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/index.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/index.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/index.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/index.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/plugins.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/plugins.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/plugins.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/plugins.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/routing.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/routing.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/routing.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/routing.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/advanced/ssg.md b/website/versioned_docs/version-2.0.0-beta.21/advanced/ssg.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/advanced/ssg.md rename to website/versioned_docs/version-2.0.0-beta.21/advanced/ssg.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/docusaurus.config.js.md b/website/versioned_docs/version-2.0.0-beta.21/api/docusaurus.config.js.md similarity index 99% rename from website/versioned_docs/version-2.0.0-beta.19/api/docusaurus.config.js.md rename to website/versioned_docs/version-2.0.0-beta.21/api/docusaurus.config.js.md index 488fd728c38c..9910ddb5220a 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/docusaurus.config.js.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/docusaurus.config.js.md @@ -130,7 +130,7 @@ Example: module.exports = { i18n: { defaultLocale: 'en', - locales: ['en', 'fr'], + locales: ['en', 'fa'], localeConfigs: { en: { label: 'English', @@ -153,7 +153,7 @@ module.exports = { - `locales`: List of locales deployed on your site. Must contain `defaultLocale`. - `localeConfigs`: Individual options for each locale. - `label`: The label displayed for this locale in the locales dropdown. - - `direction`: `ltr` (default) or `rtl` (for [right-to-left languages](https://developer.mozilla.org/en-US/docs/Glossary/rtl) like Arabic, Hebrew, etc.). Used to select the locale's CSS and html meta attribute. + - `direction`: `ltr` (default) or `rtl` (for [right-to-left languages](https://developer.mozilla.org/en-US/docs/Glossary/rtl) like Farsi, Arabic, Hebrew, etc.). Used to select the locale's CSS and html meta attribute. - `htmlLang`: BCP 47 language tag to use in `` and in `` - `calendar`: the [calendar](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar) used to calculate the date era. Note that it doesn't control the actual string displayed: `MM/DD/YYYY` and `DD/MM/YYYY` are both `gregory`. To choose the format (`DD/MM/YYYY` or `MM/DD/YYYY`), set your locale name to `en-GB` or `en-US` (`en` means `en-US`). diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/_category_.yml b/website/versioned_docs/version-2.0.0-beta.21/api/misc/_category_.yml similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/_category_.yml rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/_category_.yml diff --git a/website/versioned_docs/version-2.0.0-beta.21/api/misc/create-docusaurus.md b/website/versioned_docs/version-2.0.0-beta.21/api/misc/create-docusaurus.md new file mode 100644 index 000000000000..e35d3884cd78 --- /dev/null +++ b/website/versioned_docs/version-2.0.0-beta.21/api/misc/create-docusaurus.md @@ -0,0 +1,57 @@ +--- +sidebar_position: 0 +title: '📦 create-docusaurus' +slug: '/api/misc/create-docusaurus' +--- + +A scaffolding utility to help you instantly set up a functional Docusaurus app. + +## Usage {#usage} + +```bash +npx create-docusaurus@latest [name] [template] [rootDir] +``` + +The `name` argument will be used as the site's path as well as the `name` field in the created app's package.json. It can be an absolute path, or a path relative to `rootDir`. + +The `template` argument can be one of the following: + +- `classic`: Uses the classic template (recommended) +- `facebook`: Uses the Facebook/Meta template, which contains some Meta-specific setup +- A git repo URL (beginning with `https://` or `git@`), which can be cloned to the destination +- A local file path relative to CWD, which contains the files to be copied to destination + +The `rootDir` will be used to resolve the absolute path to the site directory. The default is CWD. + +:::caution + +This command should be preferably used in an interactive shell so all features are available. + +::: + +## Options {#options} + +### `-t, --typescript` {#typescript} + +Used when the template argument is a recognized name. Currently, only `classic` provides a TypeScript variant. + +### `-g, --git-strategy` {#git-strategy} + +Used when the template argument is a git repo. It needs to be one of: + +- `deep`: preserves full git history +- `shallow`: clones with `--depth=1` +- `copy`: does a shallow clone, but does not create a git repo +- `custom`: enter your custom git clone command. We will prompt you for it. You can write something like `git clone --depth 10`, and we will append the repository URL and destination directory. + +### `-p, --package-manager` {#package-manager} + +Value should be one of `npm`, `yarn`, or `pnpm`. If it's not explicitly provided, Docusaurus will infer one based on: + +- The lockfile already present in the CWD (e.g. if you are setting up website in an existing project) +- The command used to invoke `create-docusaurus` (e.g. `npm init`, `npx`, `yarn create`, etc.) +- Interactive prompting, in case all heuristics are not present + +### `-s, --skip-install` {#skip-install} + +If provided, Docusaurus will not automatically install dependencies after creating the app. The `--package-manager` option is only useful when you are actually installing dependencies. diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/README.md b/website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/README.md similarity index 98% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/README.md rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/README.md index 3354d63f8029..8519bcfe6ef1 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/README.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/README.md @@ -1,5 +1,5 @@ --- -sidebar_position: 0 +sidebar_position: 1 id: eslint-plugin title: '📦 eslint-plugin' slug: '/api/misc/@docusaurus/eslint-plugin' diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/no-untranslated-text.md b/website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/no-untranslated-text.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/no-untranslated-text.md rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/no-untranslated-text.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/string-literal-i18n-messages.md b/website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/string-literal-i18n-messages.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/eslint-plugin/string-literal-i18n-messages.md rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/eslint-plugin/string-literal-i18n-messages.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/img/logger-demo.png b/website/versioned_docs/version-2.0.0-beta.21/api/misc/logger/demo.png similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/img/logger-demo.png rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/logger/demo.png diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/misc/logger.md b/website/versioned_docs/version-2.0.0-beta.21/api/misc/logger/logger.md similarity index 97% rename from website/versioned_docs/version-2.0.0-beta.19/api/misc/logger.md rename to website/versioned_docs/version-2.0.0-beta.21/api/misc/logger/logger.md index 290bc762c01e..fb291473dd5f 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/misc/logger.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/misc/logger/logger.md @@ -1,7 +1,7 @@ --- -sidebar_position: 1 +sidebar_position: 2 title: '📦 logger' -slug: '/api/plugins/@docusaurus/logger' +slug: '/api/misc/@docusaurus/logger' --- An encapsulated logger for semantically formatting console messages. @@ -64,4 +64,4 @@ An embedded expression is optionally preceded by a flag in the form `[a-z]+=` (a If the expression is an array, it's formatted by `` `\n- ${array.join('\n- ')}\n` `` (note it automatically gets a leading line end). Each member is formatted by itself and the bullet is not formatted. So you would see the above message printed as: -![demo](./img/logger-demo.png) +![demo](./demo.png) diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/README.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/README.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/README.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/README.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/_category_.yml b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/_category_.yml similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/_category_.yml rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/_category_.yml diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/extend-infrastructure.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/extend-infrastructure.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/extend-infrastructure.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/extend-infrastructure.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/i18n-lifecycles.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/i18n-lifecycles.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/i18n-lifecycles.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/i18n-lifecycles.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/lifecycle-apis.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/lifecycle-apis.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/lifecycle-apis.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/lifecycle-apis.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/static-methods.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/static-methods.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugin-methods/static-methods.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugin-methods/static-methods.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/_category_.yml b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/_category_.yml similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/_category_.yml rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/_category_.yml diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/overview.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/overview.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/overview.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/overview.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-client-redirects.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-client-redirects.md similarity index 87% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-client-redirects.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-client-redirects.md index 3b881f58810a..991ea778ad91 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-client-redirects.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-client-redirects.md @@ -41,17 +41,25 @@ Accepted fields: | --- | --- | --- | --- | | `fromExtensions` | `string[]` | `[]` | The extensions to be removed from the route after redirecting. | | `toExtensions` | `string[]` | `[]` | The extensions to be appended to the route after redirecting. | -| `redirects` | `RedirectRule[]` | `[]` | The list of redirect rules. | -| `createRedirects` | `CreateRedirectsFn` | `undefined` | A callback to create a redirect rule. | +| `redirects` | RedirectRule[] | `[]` | The list of redirect rules. | +| `createRedirects` | CreateRedirectsFn | `undefined` | A callback to create a redirect rule. | +### Types {#types} + +#### `RedirectRule` {#RedirectRule} + ```ts type RedirectRule = { to: string; from: string | string[]; }; +``` +#### `CreateRedirectsFn` {#CreateRedirectsFn} + +```ts type CreateRedirectsFn = (path: string) => string[] | string | null | undefined; ``` diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-blog.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-blog.md similarity index 92% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-blog.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-blog.md index 27db9055ecc6..8cdc51d7c668 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-blog.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-blog.md @@ -38,7 +38,7 @@ Accepted fields: | Name | Type | Default | Description | | --- | --- | --- | --- | | `path` | `string` | `'blog'` | Path to the blog content directory on the file system, relative to site dir. | -| `editUrl` | string \| EditUrlFunction | `undefined` | Base URL to edit your site. The final URL is computed by `editUrl + relativePostPath`. Using a function allows more nuanced control for each file. Omitting this variable entirely will disable edit links. | +| `editUrl` | string \| EditUrlFn | `undefined` | Base URL to edit your site. The final URL is computed by `editUrl + relativePostPath`. Using a function allows more nuanced control for each file. Omitting this variable entirely will disable edit links. | | `editLocalizedFiles` | `boolean` | `false` | The edit URL will target the localized file, instead of the original unlocalized file. Ignored when `editUrl` is a function. | | `blogTitle` | `string` | `'Blog'` | Blog page title for better SEO. | | `blogDescription` | `string` | `'Blog'` | Blog page meta description for better SEO. | @@ -61,10 +61,10 @@ Accepted fields: | `beforeDefaultRehypePlugins` | `any[]` | `[]` | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. | | `truncateMarker` | `RegExp` | `//` | Truncate marker marking where the summary ends. | | `showReadingTime` | `boolean` | `true` | Show estimated reading time for the blog post. | -| `readingTime` | `ReadingTimeFunctionOption` | The default reading time | A callback to customize the reading time number displayed. | +| `readingTime` | `ReadingTimeFn` | The default reading time | A callback to customize the reading time number displayed. | | `authorsMapPath` | `string` | `'authors.yml'` | Path to the authors map file, relative to the blog content directory. | | `feedOptions` | _See below_ | `{type: ['rss', 'atom']}` | Blog feed. | -| `feedOptions.type` | FeedType \| FeedType[] \| 'all' \| null | **Required** | Type of feed to be generated. Use `null` to disable generation. | +| `feedOptions.type` | FeedType \| FeedType[] \| 'all' \| null | **Required** | Type of feed to be generated. Use `null` to disable generation. | | `feedOptions.title` | `string` | `siteConfig.title` | Title of the feed. | | `feedOptions.description` | `string` | \`${siteConfig.title} Blog\` | Description of the feed. | | `feedOptions.copyright` | `string` | `undefined` | Copyright message. | @@ -73,6 +73,10 @@ Accepted fields: +### Types {#types} + +#### `EditUrlFn` {#EditUrlFn} + ```ts type EditUrlFunction = (params: { blogDirPath: string; @@ -80,24 +84,32 @@ type EditUrlFunction = (params: { permalink: string; locale: string; }) => string | undefined; +``` + +#### `ReadingTimeFn` {#ReadingTimeFn} +```ts type ReadingTimeOptions = { wordsPerMinute: number; wordBound: (char: string) => boolean; }; -type ReadingTimeFunction = (params: { +type ReadingTimeCalculator = (params: { content: string; frontMatter?: BlogPostFrontMatter & Record; options?: ReadingTimeOptions; }) => number; -type ReadingTimeFunctionOption = (params: { +type ReadingTimeFn = (params: { content: string; frontMatter: BlogPostFrontMatter & Record; - defaultReadingTime: ReadingTimeFunction; + defaultReadingTime: ReadingTimeCalculator; }) => number | undefined; +``` +#### `FeedType` {#FeedType} + +```ts type FeedType = 'rss' | 'atom' | 'json'; ``` diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-docs.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-docs.md similarity index 90% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-docs.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-docs.md index e5971ee2fa59..a44ce3ca1a5a 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-docs.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-docs.md @@ -32,7 +32,7 @@ Accepted fields: | Name | Type | Default | Description | | --- | --- | --- | --- | | `path` | `string` | `'docs'` | Path to the docs content directory on the file system, relative to site directory. | -| `editUrl` | string \| EditUrlFunction | `undefined` | Base URL to edit your site. The final URL is computed by `editUrl + relativeDocPath`. Using a function allows more nuanced control for each file. Omitting this variable entirely will disable edit links. | +| `editUrl` | string \| EditUrlFunction | `undefined` | Base URL to edit your site. The final URL is computed by `editUrl + relativeDocPath`. Using a function allows more nuanced control for each file. Omitting this variable entirely will disable edit links. | | `editLocalizedFiles` | `boolean` | `false` | The edit URL will target the localized file, instead of the original unlocalized file. Ignored when `editUrl` is a function. | | `editCurrentVersion` | `boolean` | `false` | The edit URL will always target the current version doc instead of older versions. Ignored when `editUrl` is a function. | | `routeBasePath` | `string` | `'docs'` | URL route for the docs section of your site. **DO NOT** include a trailing slash. Use `/` for shipping docs without base path. | @@ -42,8 +42,8 @@ Accepted fields: | `sidebarPath` | false \| string | `undefined` | Path to sidebar configuration. Use `false` to disable sidebars, or `undefined` to create a fully autogenerated sidebar. | | `sidebarCollapsible` | `boolean` | `true` | Whether sidebar categories are collapsible by default. See also [Collapsible categories](/docs/sidebar#collapsible-categories) | | `sidebarCollapsed` | `boolean` | `true` | Whether sidebar categories are collapsed by default. See also [Expanded categories by default](/docs/sidebar#expanded-categories-by-default) | -| `sidebarItemsGenerator` | `SidebarGenerator` | _Omitted_ | Function used to replace the sidebar items of type `'autogenerated'` with real sidebar items (docs, categories, links...). See also [Customize the sidebar items generator](/docs/sidebar#customize-the-sidebar-items-generator) | -| `numberPrefixParser` | boolean \| PrefixParser | _Omitted_ | Custom parsing logic to extract number prefixes from file names. Use `false` to disable this behavior and leave the docs untouched, and `true` to use the default parser. See also [Using number prefixes](/docs/sidebar#using-number-prefixes) | +| `sidebarItemsGenerator` | SidebarGenerator | _Omitted_ | Function used to replace the sidebar items of type `'autogenerated'` with real sidebar items (docs, categories, links...). See also [Customize the sidebar items generator](/docs/sidebar#customize-the-sidebar-items-generator) | +| `numberPrefixParser` | boolean \| PrefixParser | _Omitted_ | Custom parsing logic to extract number prefixes from file names. Use `false` to disable this behavior and leave the docs untouched, and `true` to use the default parser. See also [Using number prefixes](/docs/sidebar#using-number-prefixes) | | `docLayoutComponent` | `string` | `'@theme/DocPage'` | Root layout component of each doc page. Provides the version data context, and is not unmounted when switching docs. | | `docItemComponent` | `string` | `'@theme/DocItem'` | Main doc container, with TOC, pagination, etc. | | `docTagsListComponent` | `string` | `'@theme/DocTagsListPage'` | Root component of the tags list page | @@ -60,10 +60,14 @@ Accepted fields: | `includeCurrentVersion` | `boolean` | `true` | Include the current version of your docs. | | `lastVersion` | `string` | First version in `versions.json` | The version navigated to in priority and displayed by default for docs navbar items. | | `onlyIncludeVersions` | `string[]` | All versions available | Only include a subset of all available versions. | -| `versions` | `VersionsConfig` | `{}` | Independent customization of each version's properties. | +| `versions` | VersionsConfig | `{}` | Independent customization of each version's properties. | +### Types {#types} + +#### `EditUrlFunction` {#EditUrlFunction} + ```ts type EditUrlFunction = (params: { version: string; @@ -72,38 +76,34 @@ type EditUrlFunction = (params: { permalink: string; locale: string; }) => string | undefined; +``` +#### `PrefixParser` {#PrefixParser} + +```ts type PrefixParser = (filename: string) => { filename: string; numberPrefix?: number; }; +``` -type CategoryIndexMatcher = (param: { - /** The file name, without extension */ - fileName: string; - /** - * The list of directories, from lowest level to highest. - * If there's no dir name, directories is ['.'] - */ - directories: string[]; - /** The extension, with a leading dot */ - extension: string; -}) => boolean; +#### `SidebarGenerator` {#SidebarGenerator} +```ts type SidebarGenerator = (generatorArgs: { /** The sidebar item with type "autogenerated" to be transformed. */ item: {type: 'autogenerated'; dirName: string}; /** Useful metadata for the version this sidebar belongs to. */ version: {contentPath: string; versionName: string}; /** All the docs of that version (unfiltered). */ - docs: Array<{ + docs: { id: string; title: string; frontMatter: DocFrontMatter & Record; source: string; sourceDirName: string; sidebarPosition?: number | undefined; - }>; + }[]; /** Number prefix parser configured for this plugin. */ numberPrefixParser: PrefixParser; /** The default category index matcher which you can override. */ @@ -118,8 +118,26 @@ type SidebarGenerator = (generatorArgs: { * Docusaurus. */ defaultSidebarItemsGenerator: SidebarGenerator; + // Returns an array of sidebar items — same as what you can declare in + // sidebars.js, except for shorthands. See https://docusaurus.io/docs/sidebar/items }) => Promise; +type CategoryIndexMatcher = (param: { + /** The file name, without extension */ + fileName: string; + /** + * The list of directories, from lowest level to highest. + * If there's no dir name, directories is ['.'] + */ + directories: string[]; + /** The extension, with a leading dot */ + extension: string; +}) => boolean; +``` + +#### `VersionsConfig` {#VersionsConfig} + +```ts type VersionsConfig = { [versionName: string]: { /** diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-pages.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-pages.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-content-pages.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-content-pages.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-debug.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-debug.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-debug.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-debug.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-google-analytics.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-google-analytics.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-google-analytics.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-google-analytics.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-google-gtag.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-google-gtag.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-google-gtag.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-google-gtag.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-ideal-image.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-ideal-image.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-ideal-image.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-ideal-image.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-pwa.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-pwa.md similarity index 91% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-pwa.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-pwa.md index 1a7ab67bbe01..a732e8094d68 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-pwa.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-pwa.md @@ -112,8 +112,8 @@ Turn debug mode on: ### `offlineModeActivationStrategies` {#offlinemodeactivationstrategies} -- Type: `Array<'appInstalled' | 'mobile' | 'saveData'| 'queryString' | 'always'>` -- Default: `['appInstalled','queryString','standalone']` +- Type: `('appInstalled' | 'mobile' | 'saveData'| 'queryString' | 'always')[]` +- Default: `['appInstalled', 'queryString', 'standalone']` Strategies used to turn the offline mode on: @@ -171,30 +171,9 @@ module.exports = { }; ``` -### `reloadPopup` {#reloadpopup} - -- Type: `string | false` -- Default: `'@theme/PwaReloadPopup'` - -Module path to reload popup component. This popup is rendered when a new service worker is waiting to be installed, and we suggest a reload to the user. - -Passing `false` will disable the popup, but this is not recommended: users won't have a way to get up-to-date content. - -A custom component can be used, as long as it accepts `onReload` as a prop. The `onReload` callback should be called when the `reload` button is clicked. This will tell the service worker to install the waiting service worker and reload the page. - -```ts -interface PwaReloadPopupProps { - onReload: () => void; -} -``` - -The default theme includes an implementation for the reload popup and uses [Infima Alerts](https://infima.dev/docs/components/alert). - -![pwa_reload.gif](/img/pwa_reload.gif) - ### `pwaHead` {#pwahead} -- Type: `Array<{ tagName: string } & Record>` +- Type: `({ tagName: string; [attributeName: string]: string })[]` - Default: `[]` Array of objects containing `tagName` and key-value pairs for attributes to inject into the `` tag. Technically you can inject any head tag through this, but it's ideally used for tags to make your site PWA compliant. Here's a list of tag to make your app fully compliant: @@ -312,3 +291,13 @@ import CodeBlock from '@theme/CodeBlock'; {JSON.stringify(require("@site/static/manifest.json"),null,2)} ``` + +## Customizing reload popup {#customizing-reload-popup} + +The `@theme/PwaReloadPopup` component is rendered when a new service worker is waiting to be installed, and we suggest a reload to the user. You can [swizzle](../../swizzling.md) this component and implement your own UI. It will receive an `onReload` callback as props, which should be called when the `reload` button is clicked. This will tell the service worker to install the waiting service worker and reload the page. + +The default theme includes an implementation for the reload popup and uses [Infima Alerts](https://infima.dev/docs/components/alert). + +![pwa_reload.gif](/img/pwa_reload.gif) + +Your component can render `null`, but this is not recommended: users won't have a way to get up-to-date content. diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-sitemap.md b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-sitemap.md similarity index 90% rename from website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-sitemap.md rename to website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-sitemap.md index 0d37d2345151..145b62d9e258 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/plugins/plugin-sitemap.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/plugins/plugin-sitemap.md @@ -40,6 +40,7 @@ Accepted fields: | `changefreq` | `string` | `'weekly'` | See [sitemap docs](https://www.sitemaps.org/protocol.html#xmlTagDefinitions) | | `priority` | `number` | `0.5` | See [sitemap docs](https://www.sitemaps.org/protocol.html#xmlTagDefinitions) | | `ignorePatterns` | `string[]` | `[]` | A list of glob patterns; matching route paths will be filtered from the sitemap. Note that you may need to include the base URL in here. | +| `filename` | `string` | `sitemap.xml` | The path to the created sitemap file, relative to the output directory. Useful if you have two plugin instances outputting two files. | @@ -70,6 +71,7 @@ const config = { changefreq: 'weekly', priority: 0.5, ignorePatterns: ['/tags/**'], + filename: 'sitemap.xml', }; ``` diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/_category_.yml b/website/versioned_docs/version-2.0.0-beta.21/api/themes/_category_.yml similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/_category_.yml rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/_category_.yml diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/overview.md b/website/versioned_docs/version-2.0.0-beta.21/api/themes/overview.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/overview.md rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/overview.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-classic.md b/website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-classic.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-classic.md rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-classic.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-configuration.md b/website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-configuration.md similarity index 99% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-configuration.md rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-configuration.md index 02e3c66db8f5..d1291bbc3cbc 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-configuration.md +++ b/website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-configuration.md @@ -602,6 +602,7 @@ However, with this special navbar item type, you can change the default location | --- | --- | --- | --- | | `type` | `'search'` | **Required** | Sets the type of this item to a search bar. | | `position` | 'left' \| 'right' | `'left'` | The side of the navbar this item should appear on. | +| `className` | `string` | / | Custom CSS class for this navbar item. | diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-live-codeblock.md b/website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-live-codeblock.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-live-codeblock.md rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-live-codeblock.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-search-algolia.md b/website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-search-algolia.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/api/themes/theme-search-algolia.md rename to website/versioned_docs/version-2.0.0-beta.21/api/themes/theme-search-algolia.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example-banner.png b/website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example-banner.png similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example-banner.png rename to website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example-banner.png diff --git a/website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example.docx b/website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example.docx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example.docx rename to website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example.docx diff --git a/website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example.xyz b/website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example.xyz similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/assets/docusaurus-asset-example.xyz rename to website/versioned_docs/version-2.0.0-beta.21/assets/docusaurus-asset-example.xyz diff --git a/website/versioned_docs/version-2.0.0-beta.19/blog.mdx b/website/versioned_docs/version-2.0.0-beta.21/blog.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/blog.mdx rename to website/versioned_docs/version-2.0.0-beta.21/blog.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/browser-support.md b/website/versioned_docs/version-2.0.0-beta.21/browser-support.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/browser-support.md rename to website/versioned_docs/version-2.0.0-beta.21/browser-support.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/cli.md b/website/versioned_docs/version-2.0.0-beta.21/cli.md similarity index 97% rename from website/versioned_docs/version-2.0.0-beta.19/cli.md rename to website/versioned_docs/version-2.0.0-beta.21/cli.md index d1bec4d09ce4..c1b79ddd9d87 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/cli.md +++ b/website/versioned_docs/version-2.0.0-beta.21/cli.md @@ -43,6 +43,7 @@ Builds and serves a preview of your site locally with [Webpack Dev Server](https | `--no-open` | `false` | Do not open automatically the page in the browser. | | `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` | | `--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. | :::important @@ -149,6 +150,7 @@ Serve your built website locally. | `--build` | `false` | Build website before serving | | `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` | | `--host` | `localhost` | Specify a host to use. For example, if you want your server to be accessible externally, you can use `--host 0.0.0.0`. | +| `--no-open` | `false` locally, `true` in CI | Do not open a browser window to the server location. | ### `docusaurus clear [siteDir]` {#docusaurus-clear-sitedir} diff --git a/website/versioned_docs/version-2.0.0-beta.19/configuration.md b/website/versioned_docs/version-2.0.0-beta.21/configuration.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/configuration.md rename to website/versioned_docs/version-2.0.0-beta.21/configuration.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/deployment.mdx b/website/versioned_docs/version-2.0.0-beta.21/deployment.mdx similarity index 97% rename from website/versioned_docs/version-2.0.0-beta.19/deployment.mdx rename to website/versioned_docs/version-2.0.0-beta.21/deployment.mdx index 9674693bce28..23ea588caf49 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/deployment.mdx +++ b/website/versioned_docs/version-2.0.0-beta.21/deployment.mdx @@ -778,3 +778,7 @@ See [docs](https://docs.quantcdn.io/docs/cli/continuous-integration) and [blog]( ## Deploying to Cloudflare Pages {#deploying-to-cloudflare-pages} [Cloudflare Pages](https://pages.cloudflare.com/) is a Jamstack platform for frontend developers to collaborate and deploy websites. Get started within a few minutes by following [this article](https://dev.to/apidev234/deploying-docusaurus-to-cloudflare-pages-565g). + +## Deploying to Azure Static Web Apps {#deploying-to-azure-static-web-apps} + +[Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/overview) is a service that automatically builds and deploys full-stack web apps to Azure directly from the code repository, simplifying the developer experience for CI/CD. Static Web Apps separates the web application's static assets from its dynamic (API) endpoints. Static assets are served from globally-distributed content servers, making it faster for clients to retrieve files using servers nearby. Dynamic APIs are scaled with serverless architectures, using an event-driven functions-based approach that is more cost-effective and scales on demand. Get started in a few minutes by following [this step-by-step guide](https://dev.to/azure/11-share-content-with-docusaurus-azure-static-web-apps-30hc). diff --git a/website/versioned_docs/version-2.0.0-beta.19/docusaurus-core.md b/website/versioned_docs/version-2.0.0-beta.21/docusaurus-core.md similarity index 97% rename from website/versioned_docs/version-2.0.0-beta.19/docusaurus-core.md rename to website/versioned_docs/version-2.0.0-beta.21/docusaurus-core.md index 372c1a001fe9..c43d22c061e0 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/docusaurus-core.md +++ b/website/versioned_docs/version-2.0.0-beta.21/docusaurus-core.md @@ -55,7 +55,13 @@ This component doesn't catch build-time errors and only protects against client- #### Props {#errorboundary-props} -- `fallback`: an optional callback returning a JSX element. It will receive two props: `error`, the error that was caught, and `tryAgain`, a function (`() => void`) callback to reset the error in the component and try rendering it again. +- `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 + +The `fallback` prop is a callback, and **not a React functional component**. You can't use React hooks inside this callback. + +::: ### `` {#head} diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/creating-pages.md b/website/versioned_docs/version-2.0.0-beta.21/guides/creating-pages.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/creating-pages.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/creating-pages.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-create-doc.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-create-doc.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-create-doc.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-create-doc.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-introduction.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-introduction.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-introduction.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-introduction.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-multi-instance.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-multi-instance.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/docs-multi-instance.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/docs-multi-instance.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/autogenerated.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/autogenerated.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/autogenerated.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/autogenerated.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/index.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/index.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/index.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/index.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/items.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/items.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/items.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/items.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/multiple-sidebars.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/multiple-sidebars.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/sidebar/multiple-sidebars.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/sidebar/multiple-sidebars.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/versioning.md b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/versioning.md similarity index 98% rename from website/versioned_docs/version-2.0.0-beta.19/guides/docs/versioning.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/docs/versioning.md index 40eb0a2f23ac..e27512e083a6 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/guides/docs/versioning.md +++ b/website/versioned_docs/version-2.0.0-beta.21/guides/docs/versioning.md @@ -161,7 +161,7 @@ Example: The "current" version is the version name for the `./docs` folder. There are different ways to manage versioning, but two very common patterns are: -- You release v1, and start immediately working on v2 (including its docs). In this case, the **current version** is v2, which is in the `./docs` folder, while the **latest version** is v1, which is the version hosted at `example.com/docs` and is browsed by most of your users. +- You release v1, and start immediately working on v2 (including its docs). In this case, the **current version** is v2, which is in the `./docs` source folder, and can be browsed at `example.com/docs/next`. The **latest version** is v1, which is in the `./versioned_docs/version-1` source folder, and is browsed by most of your users at `example.com/docs`. - You release v1, and will maintain it for some time before thinking about v2. In this case, the **current version** and **latest version** will both be point to v1, since the v2 docs doesn't even exist yet! Docusaurus defaults work great for the first use case. We will label the current version as "next" and you can even choose not to publish it. diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/_markdown-partial-example.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/_markdown-partial-example.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/_markdown-partial-example.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/_markdown-partial-example.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-admonitions.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-admonitions.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-admonitions.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-admonitions.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-assets.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-assets.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-assets.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-assets.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-code-blocks.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-code-blocks.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-code-blocks.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-code-blocks.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-head-metadata.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-head-metadata.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-head-metadata.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-head-metadata.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-intro.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-intro.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-intro.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-intro.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-links.md b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-links.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-links.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-links.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-math-equations.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-math-equations.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-math-equations.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-math-equations.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-plugins.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-plugins.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-plugins.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-plugins.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-react.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-react.mdx similarity index 80% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-react.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-react.mdx index 6422961e3c34..ca1588df16b1 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-react.mdx +++ b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-react.mdx @@ -24,7 +24,11 @@ While Docusaurus parses both `.md` and `.mdx` files using MDX, some of the synta ::: -To define any custom component within an MDX file, you have to export it. +Check out the [MDX docs](https://mdxjs.com/) to see what other fancy stuff you can do with MDX. + +### Exporting components {#exporting-components} + +To define any custom component within an MDX file, you have to export it: only paragraphs that start with `export` will be parsed as components instead of prose. ```jsx export const Highlight = ({children, color}) => ( @@ -133,7 +137,69 @@ import Highlight from '@site/src/components/Highlight'; Docusaurus green ``` -Check out the [MDX docs](https://mdxjs.com/) to see what other fancy stuff you can do with MDX. +:::tip + +If you use the same component across a lot of files, you don't need to import it everywhere—consider adding it to the global scope. [See below](#mdx-component-scope) + +::: + +### MDX component scope {#mdx-component-scope} + +Apart from [importing a component](#importing-components) and [exporting a component](#exporting-components), a third way to use a component in MDX is to **register it to the global scope**, which will make it automatically available in every MDX file, without any import statements. + +For example, given this MDX file: + +```md +- a +- list! + +And some custom markup... +``` + +It will be compiled to a React component containing `ul`, `li`, `p`, and `highlight` tags. Now, you can optionally provide your own implementation for any of these tags in the form of React components. (`highlight` isn't even an intrinsic element: it needs an implementation!) + +In Docusaurus, this MDX component scope is provided by the `@theme/MDXComponents` component. It's not a React component, _per se_, unlike most other exports under the `@theme/` alias: it is a record from tag names like `ul` and `img` to their custom implementations. + +If you [swizzle](../../swizzling.md) this component, you will find all tags that have been re-implemented, and you can further customize our implementation by swizzling the respective sub-component, like `@theme/MDXComponents/Head` (which is used to implement the [``](./markdown-features-head-metadata.mdx) feature). + +If you want to register extra tag names (like the `` tag above), you should consider [wrapping `@theme/MDXComponents`](../../swizzling.md#wrapping), so you don't have to maintain all the existing mappings. Since the swizzle CLI doesn't allow wrapping non-component files yet, you should manually create the wrapper: + +```js title="src/theme/MDXComponents.js" +import React from 'react'; +// Import the original mapper +import MDXComponents from '@theme-original/MDXComponents'; +// highlight-next-line +import Highlight from '@site/src/components/Highlight'; + +export default { + // Re-use the default mapping + ...MDXComponents, + // Map the "highlight" tag to our component! + // `Highlight` will receive all props that were passed to `highlight` in MDX + // highlight-next-line + highlight: Highlight, +}; +``` + +And now, you can freely use `` in every page, without writing the import statement: + +```md +I can conveniently use Docusaurus green everywhere! +``` + +```mdx-code-block + + +I can conveniently use Docusaurus green everywhere! + + +``` + +:::info + +We use lower-case tag names like `highlight` to "pretend" that they are intrinsic elements, but you can use capitalized ones like `Highlight` as well. + +::: ### Markdown and JSX interoperability {#markdown-and-jsx-interoperability} diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-react.module.css b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-react.module.css similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-react.module.css rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-react.module.css diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-tabs-styles.module.css b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-tabs-styles.module.css similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-tabs-styles.module.css rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-tabs-styles.module.css diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-tabs.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-tabs.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-tabs.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-tabs.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-toc.mdx b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-toc.mdx similarity index 99% rename from website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-toc.mdx rename to website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-toc.mdx index 18e2d5d17614..1cc1ed43d27c 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/guides/markdown-features/markdown-features-toc.mdx +++ b/website/versioned_docs/version-2.0.0-beta.21/guides/markdown-features/markdown-features-toc.mdx @@ -83,11 +83,11 @@ import TOCInline from '@theme/TOCInline'; The `toc` global is just a list of heading items: ```ts -declare const toc: Array<{ +declare const toc: { value: string; id: string; level: number; -}>; +}[]; ``` Note that the `toc` global is a flat array, so you can easily cut out unwanted nodes or insert extra nodes, and create a new TOC tree. diff --git a/website/versioned_docs/version-2.0.0-beta.19/guides/whats-next.md b/website/versioned_docs/version-2.0.0-beta.21/guides/whats-next.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/guides/whats-next.md rename to website/versioned_docs/version-2.0.0-beta.21/guides/whats-next.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-crowdin.mdx b/website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-crowdin.mdx similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-crowdin.mdx rename to website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-crowdin.mdx diff --git a/website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-git.md b/website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-git.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-git.md rename to website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-git.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-introduction.md b/website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-introduction.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-introduction.md rename to website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-introduction.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-tutorial.md b/website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-tutorial.md similarity index 100% rename from website/versioned_docs/version-2.0.0-beta.19/i18n/i18n-tutorial.md rename to website/versioned_docs/version-2.0.0-beta.21/i18n/i18n-tutorial.md diff --git a/website/versioned_docs/version-2.0.0-beta.19/installation.md b/website/versioned_docs/version-2.0.0-beta.21/installation.md similarity index 89% rename from website/versioned_docs/version-2.0.0-beta.19/installation.md rename to website/versioned_docs/version-2.0.0-beta.21/installation.md index a759bf8c4363..92576624eec1 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/installation.md +++ b/website/versioned_docs/version-2.0.0-beta.21/installation.md @@ -20,7 +20,7 @@ Use **[docusaurus.new](https://docusaurus.new)** to test Docusaurus immediately ## Requirements {#requirements} -- [Node.js](https://nodejs.org/en/download/) version 14.13 or above (which can be checked by running `node -v`). You can use [nvm](https://github.com/nvm-sh/nvm) for managing multiple Node versions on a single machine installed. +- [Node.js](https://nodejs.org/en/download/) version 16.14 or above (which can be checked by running `node -v`). You can use [nvm](https://github.com/nvm-sh/nvm) for managing multiple Node versions on a single machine installed. - When installing Node.js, you are recommended to check all checkboxes related to dependencies. ## Scaffold project website {#scaffold-project-website} @@ -28,22 +28,12 @@ Use **[docusaurus.new](https://docusaurus.new)** to test Docusaurus immediately The easiest way to install Docusaurus is to use the command line tool that helps you scaffold a skeleton Docusaurus website. You can run this command anywhere in a new empty repository or within an existing repository, it will create a new directory containing the scaffolded files. ```bash -npx create-docusaurus@latest [name] [template] +npx create-docusaurus@latest my-website classic ``` -Example: - -```bash -npx create-docusaurus@latest website classic -``` - -If you do not specify `name` or `template`, it will prompt you for them. - We recommend the `classic` template so that you can get started quickly, and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. -The `template` also accepts a git repo URL or a local file path, with the latter evaluated relative to the current working directory. The repo/folder content will be copied to the site directory. If it's a git repository, you can also specify a cloning strategy. - -You can also use the template's TypeScript variant by passing the `--typescript` flag. +You can also use the template's TypeScript variant by passing the `--typescript` flag. See [TypeScript support](./typescript-support.md) for more information. ```bash npx create-docusaurus@latest my-website classic --typescript @@ -98,14 +88,7 @@ pnpm create docusaurus -Docusaurus makes best efforts to select a package manager to install dependencies for you, based on the command you are using and the project you are in. You can override this behavior by using `--package-manager [npm/yarn/pnpm]`. - -```bash -# Use Yarn to install dependencies even when the command is npx -npx create-docusaurus@latest my-website classic --package-manager yarn -``` - -Run `npx create-docusaurus@latest --help` for more information about all available flags. +Run `npx create-docusaurus@latest --help`, or check out its [API docs](./api/misc/create-docusaurus.md) for more information about all available flags. ## Project structure {#project-structure} diff --git a/website/versioned_docs/version-2.0.0-beta.19/introduction.md b/website/versioned_docs/version-2.0.0-beta.21/introduction.md similarity index 98% rename from website/versioned_docs/version-2.0.0-beta.19/introduction.md rename to website/versioned_docs/version-2.0.0-beta.21/introduction.md index de877f623891..cec5f22c2e08 100644 --- a/website/versioned_docs/version-2.0.0-beta.19/introduction.md +++ b/website/versioned_docs/version-2.0.0-beta.21/introduction.md @@ -50,16 +50,20 @@ Or read the **[5-minute tutorial](https://tutorial.docusaurus.io)** online. In this presentation at [Algolia Community Event](https://www.algolia.com/), [Meta Open Source team](https://opensource.facebook.com/) shared a brief walk-through of Docusaurus. They covered how to get started with the project, enable plugins, and set up functionalities like documentation and blogging. +```mdx-code-block +import LiteYouTubeEmbed from 'react-lite-youtube-embed'; +
-