chore: prepare v2.0.0-beta.22 release (#7741)

This commit is contained in:
Sébastien Lorber 2022-07-08 18:34:05 +02:00 committed by GitHub
parent d3d22d3a72
commit f0f97f29f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
133 changed files with 1434 additions and 740 deletions

View file

@ -1,5 +1,181 @@
# Docusaurus 2 Changelog
## 2.0.0-beta.22 (2022-07-08)
#### :boom: Breaking Change
- `docusaurus-theme-classic`
- [#7740](https://github.com/facebook/docusaurus/pull/7740) refactor(theme): nest theme icons under subfolder @theme/Icon/\* ([@slorber](https://github.com/slorber))
- `docusaurus-plugin-content-blog`, `docusaurus-theme-classic`, `docusaurus-theme-common`
- [#7716](https://github.com/facebook/docusaurus/pull/7716) refactor(theme): split BlogPostItem into smaller theme subcomponents ([@slorber](https://github.com/slorber))
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-search-algolia`
- [#7660](https://github.com/facebook/docusaurus/pull/7660) refactor(theme-common): split package into public/internal API entrypoints ([@slorber](https://github.com/slorber))
- `docusaurus-plugin-content-docs`, `docusaurus-theme-classic`, `docusaurus-theme-common`
- [#7644](https://github.com/facebook/docusaurus/pull/7644) refactor(docs,theme): split DocItem comp, useDoc hook ([@slorber](https://github.com/slorber))
- `docusaurus-logger`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
- [#7642](https://github.com/facebook/docusaurus/pull/7642) refactor: remove "error" reporting level, move reportMessage to logger ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-mdx-loader`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-theme-classic`, `docusaurus-utils-validation`, `docusaurus`
- [#7152](https://github.com/facebook/docusaurus/pull/7152) refactor: handle all admonitions via JSX component ([@lex111](https://github.com/lex111))
#### :rocket: New Feature
- `docusaurus-theme-translations`
- [#7732](https://github.com/facebook/docusaurus/pull/7732) feat(theme-translations): Dutch translation ([@reinvanhaaren](https://github.com/reinvanhaaren))
- [#7715](https://github.com/facebook/docusaurus/pull/7715) feat(theme-translations): Swedish translation ([@johnie](https://github.com/johnie))
- `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`
- [#7666](https://github.com/facebook/docusaurus/pull/7666) feat(algolia-search): allow translating search modal ([@forresst](https://github.com/forresst))
- `create-docusaurus`, `docusaurus-theme-classic`, `docusaurus-theme-common`
- [#7643](https://github.com/facebook/docusaurus/pull/7643) feat(theme-classic): themeConfig navbar/footer logos accept className/style + update Meta Open-Source Logo ([@slorber](https://github.com/slorber))
- `docusaurus-plugin-client-redirects`
- [#7649](https://github.com/facebook/docusaurus/pull/7649) feat(client-redirects): make plugin respect onDuplicateRoutes config ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
- [#7624](https://github.com/facebook/docusaurus/pull/7624) feat: allow customizing localization path of each locale ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus`
- [#7581](https://github.com/facebook/docusaurus/pull/7581) feat(core): allow opting out of HTML minification ([@alexandernst](https://github.com/alexandernst))
- `docusaurus-theme-classic`, `docusaurus-theme-common`
- [#7557](https://github.com/facebook/docusaurus/pull/7557) feat: allow specifying custom target for FooterLogo ([@vannyle](https://github.com/vannyle))
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-translations`
- [#7556](https://github.com/facebook/docusaurus/pull/7556) feat: add admonition type title translations ([@slorber](https://github.com/slorber))
- `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-types`, `docusaurus-utils`, `docusaurus`
- [#7386](https://github.com/facebook/docusaurus/pull/7386) feat(core): allow customizing the i18n directory path ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-theme-live-codeblock`
- [#7514](https://github.com/facebook/docusaurus/pull/7514) feat(live-codeblock): add support for noInline to interactive code blocks ([@jpdriver](https://github.com/jpdriver))
- `docusaurus-plugin-content-docs`
- [#7461](https://github.com/facebook/docusaurus/pull/7461) feat(content-docs): last_update front matter ([@dpang314](https://github.com/dpang314))
#### :bug: Bug Fix
- `docusaurus-theme-classic`
- [#7727](https://github.com/facebook/docusaurus/pull/7727) fix(theme): show blog post edit link even when no tag & not truncated ([@anaclumos](https://github.com/anaclumos))
- [#7659](https://github.com/facebook/docusaurus/pull/7659) fix(theme-classic): expose empty string alt text in navbar logos ([@BenDMyers](https://github.com/BenDMyers))
- [#7595](https://github.com/facebook/docusaurus/pull/7595) fix(content-pages): add article wrapper around MDXContent ([@matkoch](https://github.com/matkoch))
- `docusaurus-theme-translations`
- [#7694](https://github.com/facebook/docusaurus/pull/7694) fix(theme-translations): typo in vi locale ([@saosangmo](https://github.com/saosangmo))
- `docusaurus-plugin-content-docs`
- [#7638](https://github.com/facebook/docusaurus/pull/7638) fix(docs): forward doc frontMatter.sidebar_custom_props to linking sidebar category ([@slorber](https://github.com/slorber))
- [#7634](https://github.com/facebook/docusaurus/pull/7634) fix(content-docs): allow translating doc labels in sidebars.js ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-utils`
- [#7604](https://github.com/facebook/docusaurus/pull/7604) fix(utils): allow any non-boundary characters in Markdown heading ID ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-cssnano-preset`
- [#7593](https://github.com/facebook/docusaurus/pull/7593) fix(cssnano-preset): disable z-index minification ([@dpang314](https://github.com/dpang314))
- `docusaurus-theme-common`
- [#7551](https://github.com/facebook/docusaurus/pull/7551) fix(theme-classic): code block wrap mode should allow wrapping in the middle of a word ([@slorber](https://github.com/slorber))
- [#7485](https://github.com/facebook/docusaurus/pull/7485) fix(theme-classic): inconsistent code block wrapping ([@dpang314](https://github.com/dpang314))
- `docusaurus-mdx-loader`, `docusaurus-module-type-aliases`, `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-theme-classic`, `docusaurus-theme-common`, `docusaurus-types`, `docusaurus-utils-common`, `docusaurus-utils`
- [#7521](https://github.com/facebook/docusaurus/pull/7521) fix: make type-checking work in Yarn PnP ([@Josh-Cena](https://github.com/Josh-Cena))
#### :nail_care: Polish
- `docusaurus-theme-translations`
- [#7696](https://github.com/facebook/docusaurus/pull/7696) fix(theme-translations): improve grammar of zh translation ([@AkagiYui](https://github.com/AkagiYui))
- [#7691](https://github.com/facebook/docusaurus/pull/7691) chore(theme-translations): complete vi translations ([@datlechin](https://github.com/datlechin))
- [#7683](https://github.com/facebook/docusaurus/pull/7683) chore(theme-translations): complete ar translations ([@Altomy](https://github.com/Altomy))
- [#7633](https://github.com/facebook/docusaurus/pull/7633) chore(theme-translations): complete ko translations ([@HyunseungLee-Travis](https://github.com/HyunseungLee-Travis))
- `docusaurus`
- [#7702](https://github.com/facebook/docusaurus/pull/7702) feat(deploy): copy local git config to tmp repo ([@ghostsquad](https://github.com/ghostsquad))
- [#7600](https://github.com/facebook/docusaurus/pull/7600) fix: force refresh on chunk preload error ([@yangshun](https://github.com/yangshun))
- `docusaurus-plugin-content-docs`
- [#7673](https://github.com/facebook/docusaurus/pull/7673) fix(content-docs): format last update date as "Jun 19, 2020" ([@sigwinch28](https://github.com/sigwinch28))
- `docusaurus-theme-common`, `docusaurus-theme-search-algolia`
- [#7671](https://github.com/facebook/docusaurus/pull/7671) refactor(theme-common): rename useDynamicCallback to useEvent ([@slorber](https://github.com/slorber))
- `docusaurus-theme-common`
- [#7648](https://github.com/facebook/docusaurus/pull/7648) fix(theme-common): make useShallowMemoObject key-order-insensitive ([@Josh-Cena](https://github.com/Josh-Cena))
- `create-docusaurus`
- [#7639](https://github.com/facebook/docusaurus/pull/7639) chore(create): update the facebook template with current assets ([@zpao](https://github.com/zpao))
- [#7520](https://github.com/facebook/docusaurus/pull/7520) feat: add engines field to templates' package.json ([@johnnyreilly](https://github.com/johnnyreilly))
- `docusaurus-mdx-loader`, `docusaurus-migrate`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-pwa`, `docusaurus-theme-classic`, `docusaurus`
- [#7579](https://github.com/facebook/docusaurus/pull/7579) refactor(pwa): simplify registerSW code, fix ESLint errors ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`
- [#7545](https://github.com/facebook/docusaurus/pull/7545) feat(analytics): allow query/hash changes to be sent to GA ([@lanegoolsby](https://github.com/lanegoolsby))
#### :memo: Documentation
- Other
- [#7739](https://github.com/facebook/docusaurus/pull/7739) docs: swizzle react-live with eject ([@SheetJSDev](https://github.com/SheetJSDev))
- [#7723](https://github.com/facebook/docusaurus/pull/7723) docs: add GitHub pages deployment troubleshooting guide ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7705](https://github.com/facebook/docusaurus/pull/7705) docs: mention MDXContent ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7675](https://github.com/facebook/docusaurus/pull/7675) docs: add docusaurus-openapi-docs to resources ([@sserrata](https://github.com/sserrata))
- [#7677](https://github.com/facebook/docusaurus/pull/7677) docs: add more info on github cross repo deployment ([@bcabanes](https://github.com/bcabanes))
- [#7563](https://github.com/facebook/docusaurus/pull/7563) docs: add awesome-docusaurus resource ([@webbertakken](https://github.com/webbertakken))
- [#7665](https://github.com/facebook/docusaurus/pull/7665) docs: add link from every category index page to the guide page ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7519](https://github.com/facebook/docusaurus/pull/7519) docs: multiple documentation elaborations ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7518](https://github.com/facebook/docusaurus/pull/7518) docs: remove useless front matter ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7512](https://github.com/facebook/docusaurus/pull/7512) docs: update Kent C. Dodds Twitter avatar ([@DharsanB](https://github.com/DharsanB))
- `create-docusaurus`
- [#7611](https://github.com/facebook/docusaurus/pull/7611) docs: advise using Node 18 in deployment ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7582](https://github.com/facebook/docusaurus/pull/7582) docs: make localhost links clickable ([@dht](https://github.com/dht))
- `docusaurus-plugin-client-redirects`
- [#7607](https://github.com/facebook/docusaurus/pull/7607) refactor(client-redirects): elaborate documentation, minor refactor ([@Josh-Cena](https://github.com/Josh-Cena))
#### :wrench: Maintenance
- `docusaurus-theme-classic`, `docusaurus-theme-common`
- [#7676](https://github.com/facebook/docusaurus/pull/7676) refactor(theme): move LayoutProviders to Layout/Provider; composeProviders util ([@slorber](https://github.com/slorber))
- `docusaurus-theme-classic`
- [#7674](https://github.com/facebook/docusaurus/pull/7674) chore: prevent importing theme components with relative paths ([@slorber](https://github.com/slorber))
- [#7664](https://github.com/facebook/docusaurus/pull/7664) chore: upgrade Infima to alpha.40 ([@slorber](https://github.com/slorber))
- Other
- [#7663](https://github.com/facebook/docusaurus/pull/7663) misc: share .vscode/extensions.json ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus`
- [#7583](https://github.com/facebook/docusaurus/pull/7583) refactor(cli): make the CLI an even thinner wrapper around command functions ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7547](https://github.com/facebook/docusaurus/pull/7547) chore: update static-site-generator-webpack-plugin ([@slorber](https://github.com/slorber))
- `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-types`, `docusaurus-utils-common`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`, `lqip-loader`, `stylelint-copyright`
- [#7586](https://github.com/facebook/docusaurus/pull/7586) chore: upgrade to TS 4.7, compile with NodeNext ([@Josh-Cena](https://github.com/Josh-Cena))
#### Committers: 51
- 7Wate ([@7Wate](https://github.com/7Wate))
- Ahmed Altomy ([@Altomy](https://github.com/Altomy))
- Alexander Nestorov ([@alexandernst](https://github.com/alexandernst))
- Alexey Pyltsyn ([@lex111](https://github.com/lex111))
- Ben Myers ([@BenDMyers](https://github.com/BenDMyers))
- Benjamin Cabanes ([@bcabanes](https://github.com/bcabanes))
- Boulet ([@Boulet-](https://github.com/Boulet-))
- Charles Ancheta ([@cbebe](https://github.com/cbebe))
- Clemie McCartney ([@clemiee](https://github.com/clemiee))
- DOLLE ([@JeremyDolle](https://github.com/JeremyDolle))
- Dharsan B ([@DharsanB](https://github.com/DharsanB))
- Diego França ([@difranca](https://github.com/difranca))
- Dima Grossman ([@scopsy](https://github.com/scopsy))
- Dzung Do ([@saosangmo](https://github.com/saosangmo))
- Flávio Silva ([@201flaviosilva](https://github.com/201flaviosilva))
- Forresst ([@forresst](https://github.com/forresst))
- Huy Nguyen ([@Smilefounder](https://github.com/Smilefounder))
- Hyunseung Lee ([@HyunseungLee-Travis](https://github.com/HyunseungLee-Travis))
- JP ([@jpdriver](https://github.com/jpdriver))
- Joe Harrison ([@sigwinch28](https://github.com/sigwinch28))
- John Reilly ([@johnnyreilly](https://github.com/johnnyreilly))
- Johnie Hjelm ([@johnie](https://github.com/johnie))
- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
- Joshua Schmitt ([@jqshuv](https://github.com/jqshuv))
- Kürşat Şimşek ([@kursatsmsek](https://github.com/kursatsmsek))
- Lane Goolsby ([@lanegoolsby](https://github.com/lanegoolsby))
- Le Thi Van ([@vannyle](https://github.com/vannyle))
- Matthias Koch ([@matkoch](https://github.com/matkoch))
- Ngô Quốc Đạt ([@datlechin](https://github.com/datlechin))
- Paul OShannessy ([@zpao](https://github.com/zpao))
- Redcamel ([@redcamel](https://github.com/redcamel))
- Rein van Haaren ([@reinvanhaaren](https://github.com/reinvanhaaren))
- Rudra Sen ([@RudraSen2](https://github.com/RudraSen2))
- Steven Serrata ([@sserrata](https://github.com/sserrata))
- Sunghyun Cho ([@anaclumos](https://github.com/anaclumos))
- Szilárd Dóró ([@szilarddoro](https://github.com/szilarddoro))
- Sébastien Lorber ([@slorber](https://github.com/slorber))
- Tom Mrazauskas ([@mrazauskas](https://github.com/mrazauskas))
- Webber Takken ([@webbertakken](https://github.com/webbertakken))
- Wes McNamee ([@ghostsquad](https://github.com/ghostsquad))
- Yangshun Tay ([@yangshun](https://github.com/yangshun))
- [@SheetJSDev](https://github.com/SheetJSDev)
- [@alewolf](https://github.com/alewolf)
- [@dpang314](https://github.com/dpang314)
- dht ([@dht](https://github.com/dht))
- emattia ([@emattia](https://github.com/emattia))
- pincman ([@pincman](https://github.com/pincman))
- sado ([@sado0823](https://github.com/sado0823))
- 凱恩 Kane ([@Gary50613](https://github.com/Gary50613))
- 李小雨 ([@metal-young](https://github.com/metal-young))
- 赤城结衣 ([@AkagiYui](https://github.com/AkagiYui))
## 2.0.0-beta.21 (2022-05-27)
#### :boom: Breaking Change

View file

@ -1,6 +1,6 @@
{
"name": "new.docusaurus.io",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"private": true,
"scripts": {
"start": "npx --package netlify-cli netlify dev"

View file

@ -1,5 +1,5 @@
{
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"npmClient": "yarn",
"useWorkspaces": true,
"changelog": {

View file

@ -1,6 +1,6 @@
{
"name": "create-docusaurus",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Create Docusaurus apps easily.",
"type": "module",
"repository": {
@ -22,8 +22,8 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"commander": "^5.1.0",
"fs-extra": "^10.1.0",
"lodash": "^4.17.21",

View file

@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-typescript-template",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@ -15,8 +15,8 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/preset-classic": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/preset-classic": "2.0.0-beta.22",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.0",
"prism-react-renderer": "^1.3.5",
@ -24,7 +24,7 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@tsconfig/docusaurus": "^1.0.5",
"typescript": "^4.7.4"
},

View file

@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-template",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@ -14,8 +14,8 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/preset-classic": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/preset-classic": "2.0.0-beta.22",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.0",
"prism-react-renderer": "^1.3.5",
@ -23,7 +23,7 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21"
"@docusaurus/module-type-aliases": "2.0.0-beta.22"
},
"browserslist": {
"production": [

View file

@ -1,6 +1,6 @@
{
"name": "docusaurus-2-facebook-template",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@ -18,8 +18,8 @@
"format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\""
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/preset-classic": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/preset-classic": "2.0.0-beta.22",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.0",
"react": "^17.0.2",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/cssnano-preset",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Advanced cssnano preset for maximum optimization.",
"main": "lib/index.js",
"license": "MIT",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/logger",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "An encapsulated logger for semantically formatting console messages.",
"main": "./lib/index.js",
"repository": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/mdx-loader",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus Loader for MDX",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -20,8 +20,8 @@
"dependencies": {
"@babel/parser": "^7.18.6",
"@babel/traverse": "^7.18.6",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@mdx-js/mdx": "^1.6.22",
"escape-html": "^1.0.3",
"file-loader": "^6.2.0",
@ -37,14 +37,14 @@
"webpack": "^5.73.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.22",
"@types/escape-html": "^1.0.2",
"@types/mdast": "^3.0.10",
"@types/stringify-object": "^3.3.1",
"@types/unist": "^2.0.6",
"rehype-stringify": "^8.0.0",
"remark": "^12.0.1",
"remark-mdx": "^1.6.21",
"rehype-stringify": "^8.0.0",
"remark-rehype": "^8.1.0",
"to-vfile": "^6.1.0",
"unist-builder": "^2.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/migrate",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "A CLI tool to migrate from older versions of Docusaurus.",
"license": "MIT",
"engines": {
@ -24,8 +24,8 @@
"dependencies": {
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@mapbox/hast-util-to-jsx": "^2.0.0",
"color": "^4.2.3",
"commander": "^5.1.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/module-type-aliases",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus module type aliases.",
"types": "./src/index.d.ts",
"publishConfig": {
@ -13,7 +13,7 @@
},
"dependencies": {
"@docusaurus/react-loadable": "5.5.2",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.22",
"@types/history": "^4.7.11",
"@types/react": "*",
"@types/react-router-config": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-client-redirects",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Client redirects plugin for Docusaurus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -18,18 +18,18 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"eta": "^1.12.3",
"fs-extra": "^10.1.0",
"lodash": "^4.17.21",
"tslib": "^2.4.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.21"
"@docusaurus/types": "2.0.0-beta.22"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-content-blog",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Blog plugin for Docusaurus.",
"main": "lib/index.js",
"types": "src/plugin-content-blog.d.ts",
@ -18,13 +18,13 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"cheerio": "^1.0.0-rc.12",
"feed": "^4.2.2",
"fs-extra": "^10.1.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-content-docs",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docs plugin for Docusaurus.",
"main": "lib/index.js",
"sideEffects": false,
@ -34,13 +34,13 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"@types/react-router-config": "^5.0.6",
"combine-promises": "^1.1.0",
"fs-extra": "^10.1.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-content-pages",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Pages plugin for Docusaurus.",
"main": "lib/index.js",
"types": "src/plugin-content-pages.d.ts",
@ -18,11 +18,11 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"fs-extra": "^10.1.0",
"tslib": "^2.4.0",
"webpack": "^5.73.0"

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-debug",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Debug plugin for Docusaurus.",
"main": "lib/index.js",
"types": "src/plugin-debug.d.ts",
@ -20,9 +20,9 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"fs-extra": "^10.1.0",
"react-json-view": "^1.21.3",
"tslib": "^2.4.0"

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-google-analytics",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Global analytics (analytics.js) plugin for Docusaurus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -18,9 +18,9 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"tslib": "^2.4.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-google-gtag",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Global Site Tag (gtag.js) plugin for Docusaurus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -18,9 +18,9 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"tslib": "^2.4.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-ideal-image",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
"main": "lib/index.js",
"types": "src/plugin-ideal-image.d.ts",
@ -20,12 +20,12 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/lqip-loader": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/lqip-loader": "2.0.0-beta.22",
"@docusaurus/responsive-loader": "^1.7.0",
"@docusaurus/theme-translations": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/theme-translations": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"@endiliey/react-ideal-image": "^0.0.11",
"react-waypoint": "^10.3.0",
"sharp": "^0.30.7",
@ -33,7 +33,7 @@
"webpack": "^5.73.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.21",
"fs-extra": "^10.1.0"
},

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-pwa",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus Plugin to add PWA support.",
"main": "lib/index.js",
"types": "src/plugin-pwa.d.ts",
@ -22,12 +22,12 @@
"dependencies": {
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-translations": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-translations": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"babel-loader": "^8.2.5",
"clsx": "^1.2.0",
"core-js": "^3.23.3",
@ -40,7 +40,7 @@
"workbox-window": "^6.5.3"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"fs-extra": "^10.1.0"
},
"peerDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/plugin-sitemap",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Simple sitemap generation plugin for Docusaurus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -18,12 +18,12 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"fs-extra": "^10.1.0",
"sitemap": "^7.1.1",
"tslib": "^2.4.0"

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/preset-classic",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Classic preset for Docusaurus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -18,18 +18,18 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/plugin-content-blog": "2.0.0-beta.21",
"@docusaurus/plugin-content-docs": "2.0.0-beta.21",
"@docusaurus/plugin-content-pages": "2.0.0-beta.21",
"@docusaurus/plugin-debug": "2.0.0-beta.21",
"@docusaurus/plugin-google-analytics": "2.0.0-beta.21",
"@docusaurus/plugin-google-gtag": "2.0.0-beta.21",
"@docusaurus/plugin-sitemap": "2.0.0-beta.21",
"@docusaurus/theme-classic": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-search-algolia": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21"
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/plugin-content-blog": "2.0.0-beta.22",
"@docusaurus/plugin-content-docs": "2.0.0-beta.22",
"@docusaurus/plugin-content-pages": "2.0.0-beta.22",
"@docusaurus/plugin-debug": "2.0.0-beta.22",
"@docusaurus/plugin-google-analytics": "2.0.0-beta.22",
"@docusaurus/plugin-google-gtag": "2.0.0-beta.22",
"@docusaurus/plugin-sitemap": "2.0.0-beta.22",
"@docusaurus/theme-classic": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-search-algolia": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/remark-plugin-npm2yarn",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Remark plugin for converting npm commands to Yarn commands as tabs.",
"main": "lib/index.js",
"publishConfig": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/theme-classic",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Classic theme for Docusaurus",
"main": "lib/index.js",
"types": "src/theme-classic.d.ts",
@ -20,22 +20,22 @@
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/plugin-content-blog": "2.0.0-beta.21",
"@docusaurus/plugin-content-docs": "2.0.0-beta.21",
"@docusaurus/plugin-content-pages": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-translations": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@docusaurus/plugin-content-blog": "2.0.0-beta.22",
"@docusaurus/plugin-content-docs": "2.0.0-beta.22",
"@docusaurus/plugin-content-pages": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-translations": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.0",
"copy-text-to-clipboard": "^3.0.1",
"infima": "0.2.0-alpha.40",
"infima": "0.2.0-alpha.41",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
"postcss": "^8.4.14",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/theme-common",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Common code for Docusaurus themes.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
@ -30,12 +30,12 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/plugin-content-blog": "2.0.0-beta.21",
"@docusaurus/plugin-content-docs": "2.0.0-beta.21",
"@docusaurus/plugin-content-pages": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@docusaurus/plugin-content-blog": "2.0.0-beta.22",
"@docusaurus/plugin-content-docs": "2.0.0-beta.22",
"@docusaurus/plugin-content-pages": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@types/history": "^4.7.11",
"@types/react": "*",
"@types/react-router-config": "*",
@ -46,8 +46,8 @@
"utility-types": "^3.10.0"
},
"devDependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"fs-extra": "^10.1.0",
"lodash": "^4.17.21"
},

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/theme-live-codeblock",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus live code block component.",
"main": "lib/index.js",
"types": "src/theme-live-codeblock.d.ts",
@ -23,10 +23,10 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-translations": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-translations": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"@philpl/buble": "^0.19.7",
"clsx": "^1.2.0",
"fs-extra": "^10.1.0",
@ -34,7 +34,7 @@
"tslib": "^2.4.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.22",
"@types/buble": "^0.20.1"
},
"peerDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/theme-search-algolia",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Algolia search component for Docusaurus.",
"main": "lib/index.js",
"sideEffects": [
@ -34,13 +34,13 @@
},
"dependencies": {
"@docsearch/react": "^3.1.1",
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/plugin-content-docs": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-translations": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/plugin-content-docs": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-translations": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"algoliasearch": "^4.13.1",
"algoliasearch-helper": "^3.10.0",
"clsx": "^1.2.0",
@ -51,7 +51,7 @@
"utility-types": "^3.10.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21"
"@docusaurus/module-type-aliases": "2.0.0-beta.22"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/theme-translations",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Docusaurus theme translations.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -23,8 +23,8 @@
"tslib": "^2.4.0"
},
"devDependencies": {
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"lodash": "^4.17.21"
},
"engines": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/types",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Common types for Docusaurus packages.",
"types": "./src/index.d.ts",
"publishConfig": {

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/utils-common",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/utils-validation",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Node validation utility functions for Docusaurus packages.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
@ -18,8 +18,8 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"joi": "^17.6.0",
"js-yaml": "^4.1.0",
"tslib": "^2.4.0"

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/utils",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Node utility functions for Docusaurus packages.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
@ -18,7 +18,7 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"@svgr/webpack": "^6.2.1",
"file-loader": "^6.2.0",
"fs-extra": "^10.1.0",
@ -38,7 +38,7 @@
"node": ">=16.14"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.22",
"@types/dedent": "^0.7.0",
"@types/github-slugger": "^1.3.0",
"@types/micromatch": "^4.0.2",

View file

@ -1,7 +1,7 @@
{
"name": "@docusaurus/core",
"description": "Easy to Maintain Open Source Documentation Websites",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"license": "MIT",
"publishConfig": {
"access": "public"
@ -43,13 +43,13 @@
"@babel/runtime": "^7.18.6",
"@babel/runtime-corejs3": "^7.18.6",
"@babel/traverse": "^7.18.6",
"@docusaurus/cssnano-preset": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/mdx-loader": "2.0.0-beta.21",
"@docusaurus/cssnano-preset": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/mdx-loader": "2.0.0-beta.22",
"@docusaurus/react-loadable": "5.5.2",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/utils-validation": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@docusaurus/utils-validation": "2.0.0-beta.22",
"@slorber/static-site-generator-webpack-plugin": "^4.0.7",
"@svgr/webpack": "^6.2.1",
"autoprefixer": "^10.4.7",
@ -106,8 +106,8 @@
"webpackbar": "^5.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@docusaurus/module-type-aliases": "2.0.0-beta.22",
"@docusaurus/types": "2.0.0-beta.22",
"@types/detect-port": "^1.3.2",
"@types/react-dom": "^18.0.5",
"@types/react-router-config": "^5.0.6",

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/eslint-plugin",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "ESLint plugin to enforce best Docusaurus practices.",
"main": "lib/index.js",
"keywords": [

View file

@ -1,6 +1,6 @@
{
"name": "@docusaurus/lqip-loader",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Low Quality Image Placeholders (LQIP) loader for webpack.",
"main": "lib/index.js",
"publishConfig": {
@ -17,7 +17,7 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.22",
"file-loader": "^6.2.0",
"lodash": "^4.17.21",
"sharp": "^0.30.7",

View file

@ -1,6 +1,6 @@
{
"name": "stylelint-copyright",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"description": "Stylelint plugin to check CSS files for a copyright header.",
"main": "lib/index.js",
"license": "MIT",

View file

@ -1,6 +1,6 @@
{
"name": "website",
"version": "2.0.0-beta.21",
"version": "2.0.0-beta.22",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@ -35,18 +35,18 @@
"dependencies": {
"@crowdin/cli": "^3.7.8",
"@crowdin/crowdin-api-client": "^1.18.2",
"@docusaurus/core": "2.0.0-beta.21",
"@docusaurus/logger": "2.0.0-beta.21",
"@docusaurus/plugin-client-redirects": "2.0.0-beta.21",
"@docusaurus/plugin-ideal-image": "2.0.0-beta.21",
"@docusaurus/plugin-pwa": "2.0.0-beta.21",
"@docusaurus/preset-classic": "2.0.0-beta.21",
"@docusaurus/remark-plugin-npm2yarn": "2.0.0-beta.21",
"@docusaurus/theme-classic": "2.0.0-beta.21",
"@docusaurus/theme-common": "2.0.0-beta.21",
"@docusaurus/theme-live-codeblock": "2.0.0-beta.21",
"@docusaurus/utils": "2.0.0-beta.21",
"@docusaurus/utils-common": "2.0.0-beta.21",
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/logger": "2.0.0-beta.22",
"@docusaurus/plugin-client-redirects": "2.0.0-beta.22",
"@docusaurus/plugin-ideal-image": "2.0.0-beta.22",
"@docusaurus/plugin-pwa": "2.0.0-beta.22",
"@docusaurus/preset-classic": "2.0.0-beta.22",
"@docusaurus/remark-plugin-npm2yarn": "2.0.0-beta.22",
"@docusaurus/theme-classic": "2.0.0-beta.22",
"@docusaurus/theme-common": "2.0.0-beta.22",
"@docusaurus/theme-live-codeblock": "2.0.0-beta.22",
"@docusaurus/utils": "2.0.0-beta.22",
"@docusaurus/utils-common": "2.0.0-beta.22",
"@popperjs/core": "^2.11.5",
"@swc/core": "1.2.197",
"clsx": "^1.2.0",
@ -80,7 +80,7 @@
]
},
"devDependencies": {
"@docusaurus/eslint-plugin": "2.0.0-beta.21",
"@docusaurus/eslint-plugin": "2.0.0-beta.22",
"@tsconfig/docusaurus": "^1.0.5",
"@types/jest": "^28.1.4",
"cross-env": "^7.0.3",

View file

@ -1,119 +0,0 @@
---
id: create-doc
title: Create a doc
description: Create a Markdown Document
slug: /create-doc
---
Create a Markdown file, `greeting.md`, and place it under the `docs` directory.
```bash
website # root directory of your site
├── docs
│ └── greeting.md
├── src
│ └── pages
├── docusaurus.config.js
├── ...
```
At the top of the file, specify `id` and `title` in the front matter, so that Docusaurus will pick them up correctly when generating your site.
```md
---
id: greeting
title: Hello
---
## Hello from Docusaurus
Are you ready to create the documentation site for your open source project?
### Headers
will show up on the table of contents on the upper right
So that your users will know what this page is all about without scrolling down or even without reading too much.
### Only h2 and h3 will be in the TOC by default.
You can configure the TOC heading levels either per-document or in the theme configuration.
The headers are well-spaced so that the hierarchy is clear.
- lists will help you
- present the key points
- that you want your users to remember
- and you may nest them
- multiple times
### Custom id headers {#custom-id}
With `{#custom-id}` syntax you can set your own header id.
```
This will render in the browser as follows:
```mdx-code-block
import BrowserWindow from '@site/src/components/BrowserWindow';
<BrowserWindow>
<h2>Hello from Docusaurus</h2>
Are you ready to create the documentation site for your open source project?
<h3>Headers</h3>
will show up on the table of contents on the upper right
So that your users will know what this page is all about without scrolling down or even without reading too much.
<h3>Only h2 and h3 will be in the TOC by default.</h3>
You can configure the TOC heading levels either per document or in the theme configuration.
The headers are well-spaced so that the hierarchy is clear.
- lists will help you
- present the key points
- that you want your users to remember
- and you may nest them
- multiple times
<h3 id="custom-id">Custom id headers</h3>
With <code>{#custom-id}</code> syntax you can set your own header id.
</BrowserWindow>
```
:::note
All files prefixed with an underscore (`_`) under the `docs` directory are treated as "partial" pages and will be ignored by default.
Read more about [importing partial pages](../markdown-features/markdown-features-react.mdx#importing-markdown).
:::
## Doc tags {#doc-tags}
Optionally, you can add tags to your doc pages, which introduces another dimension of categorization in addition to the [docs sidebar](./sidebar/index.md). Tags are passed in the front matter as a list of labels:
```md "your-doc-page.md"
---
id: doc-with-tags
title: A doc with tags
tags:
- Demo
- Getting started
---
```
:::tip
Tags can also be declared with `tags: [Demo, Getting started]`.
Read more about all the possible [Yaml array syntaxes](https://www.w3schools.io/file/yaml-arrays/).
:::

View file

@ -81,7 +81,7 @@ When writing links in Markdown, you could either mean a _file path_, or a _URL p
- If the path has an `.md(x)` extension, Docusaurus would try to resolve that Markdown file to a URL, and replace the file path with a URL path.
- If the path has any other extension, Docusaurus would treat it as [an asset](../guides/markdown-features/markdown-features-assets.mdx) and bundle it.
The following directory structure may help you visualize this file -> URL mapping. Assume that there's no slug customization in any page.
The following directory structure may help you visualize this file URL mapping. Assume that there's no slug customization in any page.
<details>

View file

@ -8,12 +8,14 @@ description: Docusaurus statically renders your React code into HTML, allowing f
In [architecture](architecture.md), we mentioned that the theme is run in Webpack. But beware: that doesn't mean it always has access to browser globals! The theme is built twice:
- During **server-side rendering**, the theme is compiled in a sandbox called [React DOM Server](https://reactjs.org/docs/react-dom-server.html). You can see this as a "headless browser", where there is no `window` or `document`, only React. SSR produces static HTML pages.
- During **client-side rendering**, the theme is compiled with standard React DOM, and has access to browser variables. CSR produces dynamic JavaScript.
- During **client-side rendering**, the theme is compiled to JavaScript that gets eventually executed in the browser, so it has access to browser variables.
:::info SSR or SSG?
_Server-side rendering_ and _static site generation_ can be different concepts, but we use them interchangeably.
Strictly speaking, Docusaurus is a static site generator, because there's no server-side runtime—we statically render to HTML files that are deployed on a CDN, instead of dynamically pre-rendering on each request. This differs from the working model of [Next.js](https://nextjs.org/).
:::
Therefore, while you probably know not to access Node globals like `process` ([or can we?](#node-env)) or the `'fs'` module, you can't freely access browser globals either.
@ -34,9 +36,10 @@ ReferenceError: window is not defined
This is because during server-side rendering, the Docusaurus app isn't actually run in browser, and it doesn't know what `window` is.
```mdx-code-block
<details id="node-env">
<summary>What about <code>process.env.NODE_ENV</code>?</summary>
```
One exception to the "no Node globals" rule is `process.env.NODE_ENV`. In fact, you can use it in React, because Webpack injects this variable as a global:
@ -56,8 +59,10 @@ During Webpack build, the `process.env.NODE_ENV` will be replaced with the value
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
```mdx-code-block
<Tabs>
<TabItem value="Development">
```
```diff
import React from 'react';
@ -72,8 +77,10 @@ export default function expensiveComp() {
}
```
```mdx-code-block
</TabItem>
<TabItem value="Production">
```
```diff
import React from 'react';
@ -88,9 +95,11 @@ export default function expensiveComp() {
}
```
```mdx-code-block
</TabItem>
</Tabs>
</details>
```
## Understanding SSR {#understanding-ssr}

View file

@ -1,6 +1,5 @@
---
sidebar_position: 0
id: docusaurus.config.js
description: API reference for Docusaurus configuration file.
slug: /api/docusaurus-config
---
@ -64,7 +63,7 @@ module.exports = {
- Type: `string`
URL for your website. This can also be considered the top-level hostname. For example, `https://facebook.github.io` is the URL of https://facebook.github.io/metro/, and `https://docusaurus.io` is the URL for https://docusaurus.io. This field is related to the [baseUrl](#baseurl) field.
URL for your website. This can also be considered the top-level hostname. For example, `https://facebook.github.io` is the URL of https://facebook.github.io/metro/, and `https://docusaurus.io` is the URL for https://docusaurus.io. This field is related to the [`baseUrl`](#baseUrl) field.
```js title="docusaurus.config.js"
module.exports = {
@ -76,7 +75,7 @@ module.exports = {
- Type: `string`
Base URL for your site. Can be considered as the path after the host. For example, `/metro/` is the base URL of https://facebook.github.io/metro/. For URLs that have no path, the baseUrl should be set to `/`. This field is related to the [url](#url) field. Always has both leading and trailing slash.
Base URL for your site. Can be considered as the path after the host. For example, `/metro/` is the base URL of https://facebook.github.io/metro/. For URLs that have no path, the baseUrl should be set to `/`. This field is related to the [`url`](#url) field. Always has both leading and trailing slash.
```js title="docusaurus.config.js"
module.exports = {
@ -130,19 +129,22 @@ Example:
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr'],
locales: ['en', 'fa'],
path: 'i18n',
localeConfigs: {
en: {
label: 'English',
direction: 'ltr',
htmlLang: 'en-US',
calendar: 'gregory',
path: 'en',
},
fa: {
label: 'فارسی',
direction: 'rtl',
htmlLang: 'fa-IR',
calendar: 'persian',
path: 'fa',
},
},
},
@ -151,11 +153,13 @@ module.exports = {
- `defaultLocale`: The locale that (1) does not have its name in the base URL (2) gets started with `docusaurus start` without `--locale` option (3) will be used for the `<link hrefLang="x-default">` tag
- `locales`: List of locales deployed on your site. Must contain `defaultLocale`.
- `path`: Root folder which all locale folders are relative to. Can be absolute or relative to the config file. Defaults to `i18n`.
- `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 `<html lang="...">` and in `<link ... hreflang="...">`
- `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`).
- `path`: Root folder that all plugin localization folders of this locale are relative to. Will be resolved against `i18n.path`. Defaults to the locale's name. Note: this has no effect on the locale's `baseUrl`—customization of base URL is a work-in-progress.
### `noIndex` {#noIndex}
@ -173,7 +177,7 @@ module.exports = {
### `onBrokenLinks` {#onBrokenLinks}
- Type: `'ignore' | 'log' | 'warn' | 'error' | 'throw'`
- Type: `'ignore' | 'log' | 'warn' | 'throw'`
The behavior of Docusaurus when it detects any broken link.
@ -187,15 +191,15 @@ The broken links detection is only available for a production build (`docusaurus
### `onBrokenMarkdownLinks` {#onBrokenMarkdownLinks}
- Type: `'ignore' | 'log' | 'warn' | 'error' | 'throw'`
- Type: `'ignore' | 'log' | 'warn' | 'throw'`
The behavior of Docusaurus when it detects any broken markdown link.
The behavior of Docusaurus when it detects any broken Markdown link.
By default, it prints a warning, to let you know about your broken markdown link, but you can change this security if needed.
By default, it prints a warning, to let you know about your broken Markdown link, but you can change this security if needed.
### `onDuplicateRoutes` {#onDuplicateRoutes}
- Type: `'ignore' | 'log' | 'warn' | 'error' | 'throw'`
- Type: `'ignore' | 'log' | 'warn' | 'throw'`
The behavior of Docusaurus when it detects any [duplicate routes](/guides/creating-pages.md#duplicate-routes).
@ -330,8 +334,9 @@ module.exports = {
// ... other links
],
logo: {
alt: 'Facebook Open Source Logo',
src: 'https://docusaurus.io/img/oss_logo.png',
alt: 'Meta Open Source Logo',
src: 'img/meta_oss_logo.png',
href: 'https://opensource.fb.com',
width: 160,
height: 51,
},
@ -426,7 +431,7 @@ module.exports = {
### `scripts` {#scripts}
An array of scripts to load. The values can be either strings or plain objects of attribute-value maps. The `<script>` tags will be inserted in the HTML `<head>`.
An array of scripts to load. The values can be either strings or plain objects of attribute-value maps. The `<script>` tags will be inserted in the HTML `<head>`. If you use a plain object, the only required attribute is `src`, and any other attributes are permitted (each one should have boolean/string values).
Note that `<script>` added here are render-blocking, so you might want to add `async: true`/`defer: true` to the objects.
@ -450,7 +455,7 @@ module.exports = {
### `stylesheets` {#stylesheets}
An array of CSS sources to load. The values can be either strings or plain objects of attribute-value maps. The `<link>` tags will be inserted in the HTML `<head>`.
An array of CSS sources to load. The values can be either strings or plain objects of attribute-value maps. The `<link>` tags will be inserted in the HTML `<head>`. If you use an object, the only required attribute is `href`, and any other attributes are permitted (each one should have boolean/string values).
- Type: `(string | Object)[]`
@ -469,6 +474,12 @@ module.exports = {
};
```
:::info
By default, the `<link>` tags will have `rel="stylesheet"`, but you can explicitly add a custom `rel` value to inject any kind of `<link>` tag, not necessarily stylesheets.
:::
### `clientModules` {#clientModules}
An array of [client modules](../advanced/client.md#client-modules) to load globally on your site.
@ -542,7 +553,7 @@ module.exports = {
};
```
### `baseUrlIssueBanner` {#baseurlIssueBanner}
### `baseUrlIssueBanner` {#baseUrlIssueBanner}
- Type: `boolean`

View file

@ -1,9 +1,10 @@
---
sidebar_position: 0
title: '📦 create-docusaurus'
slug: '/api/misc/create-docusaurus'
slug: /api/misc/create-docusaurus
---
# 📦 create-docusaurus
A scaffolding utility to help you instantly set up a functional Docusaurus app.
## Usage {#usage}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 1
id: eslint-plugin
title: '📦 eslint-plugin'
slug: '/api/misc/@docusaurus/eslint-plugin'
slug: /api/misc/@docusaurus/eslint-plugin
---
# 📦 eslint-plugin
[ESLint](https://eslint.org/) is a tool that statically analyzes your code and reports problems or suggests best practices through editor hints and command line. Docusaurus provides an ESLint plugin to enforce best Docusaurus practices.
## Installation

View file

@ -1,5 +1,5 @@
---
slug: '/api/misc/@docusaurus/eslint-plugin/no-untranslated-text'
slug: /api/misc/@docusaurus/eslint-plugin/no-untranslated-text
---
# no-untranslated-text
@ -32,13 +32,17 @@ Examples of **correct** code for this rule:
Accepted fields:
```mdx-code-block
<APITable>
```
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `ignoredStrings` | `string[]` | `[]` | Text labels that only contain strings in this list will not be reported. |
```mdx-code-block
</APITable>
```
## When Not To Use It {#when-not-to-use}

View file

@ -1,5 +1,5 @@
---
slug: '/api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages'
slug: /api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages
---
# string-literal-i18n-messages

View file

@ -1,9 +1,10 @@
---
sidebar_position: 2
title: '📦 logger'
slug: '/api/misc/@docusaurus/logger'
slug: /api/misc/@docusaurus/logger
---
# 📦 logger
An encapsulated logger for semantically formatting console messages.
Authors of packages in the Docusaurus ecosystem are encouraged to use this package to provide unified log formats.
@ -31,6 +32,7 @@ It exports a single object as default export: `logger`. `logger` has the followi
- `warn`: prints a warning that should be payed attention to.
- `error`: prints an error (not necessarily halting the program) that signals significant problems.
- `success`: prints a success message.
- The `report` function. It takes a `ReportingSeverity` value (`ignore`, `log`, `warn`, `throw`) and reports a message according to the severity.
:::caution A word on the `error` formatter
@ -64,4 +66,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)

View file

@ -103,7 +103,7 @@ module.exports = function (context, options) {
Themes using the `<Translate>` API can provide default code translation messages.
It should return messages in `Record<string, string>`, where keys are translation ids and values are messages (without the description) localized using the site's current locale.
It should return messages in `Record<string, string>`, where keys are translation IDs and values are messages (without the description) localized using the site's current locale.
Example:

View file

@ -178,7 +178,7 @@ The API of `configureWebpack` will be modified in the future to accept an object
- `getStyleLoaders(isServer: boolean, cssOptions: {[key: string]: any}): Loader[]`
- `getJSLoader(isServer: boolean, cacheOptions?: {}): Loader | null`
You may use them to return your webpack configures conditionally.
You may use them to return your webpack configuration conditionally.
For example, this plugin below modify the webpack config to transpile `.foo` files.

View file

@ -1,11 +1,12 @@
---
sidebar_position: 0
id: plugins-overview
title: 'Docusaurus plugins'
sidebar_label: Plugins overview
slug: '/api/plugins'
slug: /api/plugins
---
# Docusaurus plugins
We provide official Docusaurus plugins.
## Content plugins {#content-plugins}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 4
id: plugin-client-redirects
title: '📦 plugin-client-redirects'
slug: '/api/plugins/@docusaurus/plugin-client-redirects'
slug: /api/plugins/@docusaurus/plugin-client-redirects
---
# 📦 plugin-client-redirects
import APITable from '@site/src/components/APITable';
Docusaurus Plugin to generate **client-side redirects**.
@ -35,23 +35,52 @@ npm install --save @docusaurus/plugin-client-redirects
Accepted fields:
```mdx-code-block
<APITable>
```
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `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` | <code><a href="#RedirectRule">RedirectRule</a>[]</code> | `[]` | The list of redirect rules. |
| `createRedirects` | <code><a href="#CreateRedirectsFn">CreateRedirectsFn</a></code> | `undefined` | A callback to create a redirect rule. Docusaurus query this callback against every path it has created, and use its return value to output more paths. |
```mdx-code-block
</APITable>
```
:::note
This plugin will also read the [`siteConfig.onDuplicateRoutes`](../docusaurus.config.js.md#onDuplicateRoutes) config to adjust its logging level when multiple files will be emitted to the same location.
:::
### Types {#types}
#### `RedirectRule` {#RedirectRule}
```ts
type RedirectRule = {
to: string;
from: string | string[];
};
```
:::note
The idea of "from" and "to" is central in this plugin. "From" means a path that you want to _create_, i.e. an extra HTML file that will be written; "to" means a path to want to redirect _to_, usually a route that Docusaurus already knows about.
This is why you can have multiple "from" for the same "to": we will create multiple HTML files that all redirect to the same destination. On the other hand, one "from" can never have more than one "to": the written HTML file needs to have a determinate destination.
:::
#### `CreateRedirectsFn` {#CreateRedirectsFn}
```ts
// The parameter `path` is a route that Docusaurus has already created. It can
// be seen as the "to", and your return value is the "from". Returning a falsy
// value will not create any redirect pages for this particular path.
type CreateRedirectsFn = (path: string) => string[] | string | null | undefined;
```

View file

@ -1,10 +1,10 @@
---
sidebar_position: 2
id: plugin-content-blog
title: '📦 plugin-content-blog'
slug: '/api/plugins/@docusaurus/plugin-content-blog'
slug: /api/plugins/@docusaurus/plugin-content-blog
---
# 📦 plugin-content-blog
import APITable from '@site/src/components/APITable';
Provides the [Blog](blog.mdx) feature and is the default blog plugin for Docusaurus.
@ -33,12 +33,14 @@ You can configure this plugin through the [preset options](#ex-config-preset).
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `path` | `string` | `'blog'` | Path to the blog content directory on the file system, relative to site dir. |
| `editUrl` | <code>string \| EditUrlFunction</code> | `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` | <code>string \| <a href="#EditUrlFn">EditUrlFn</a></code> | `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,17 +63,23 @@ Accepted fields:
| `beforeDefaultRehypePlugins` | `any[]` | `[]` | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. |
| `truncateMarker` | `RegExp` | `/<!--\s*(truncate)\s*-->/` | 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` | <code>FeedType \| FeedType[] \| 'all' \| null</code> | **Required** | Type of feed to be generated. Use `null` to disable generation. |
| `feedOptions.type` | <code><a href="#FeedType">FeedType</a> \| <a href="#FeedType">FeedType</a>[] \| 'all' \| null</code> | **Required** | Type of feed to be generated. Use `null` to disable generation. |
| `feedOptions.title` | `string` | `siteConfig.title` | Title of the feed. |
| `feedOptions.description` | `string` | <code>\`${siteConfig.title} Blog\`</code> | Description of the feed. |
| `feedOptions.copyright` | `string` | `undefined` | Copyright message. |
| `feedOptions.language` | `string` (See [documentation](http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes) for possible values) | `undefined` | Language metadata of the feed. |
| `sortPosts` | <code>'descending' \| 'ascending' </code> | `'descending'` | Governs the direction of blog post sorting. |
```mdx-code-block
</APITable>
```
### Types {#types}
#### `EditUrlFn` {#EditUrlFn}
```ts
type EditUrlFunction = (params: {
@ -80,24 +88,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<string, unknown>;
options?: ReadingTimeOptions;
}) => number;
type ReadingTimeFunctionOption = (params: {
type ReadingTimeFn = (params: {
content: string;
frontMatter: BlogPostFrontMatter & Record<string, unknown>;
defaultReadingTime: ReadingTimeFunction;
defaultReadingTime: ReadingTimeCalculator;
}) => number | undefined;
```
#### `FeedType` {#FeedType}
```ts
type FeedType = 'rss' | 'atom' | 'json';
```
@ -162,7 +178,9 @@ Markdown documents can use the following Markdown front matter metadata fields,
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -181,9 +199,11 @@ Accepted fields:
| `keywords` | `string[]` | `undefined` | Keywords meta tag, which will become the `<meta name="keywords" content="keyword1,keyword2,..."/>` in `<head>`, used by search engines. |
| `description` | `string` | The first line of Markdown content | The description of your document, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. |
| `image` | `string` | `undefined` | Cover or thumbnail image that will be used when displaying the link to your post. |
| `slug` | `string` | File path | Allows to customize the blog post url (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-blog-post`, `slug: /my/path/to/blog/post`, slug: `/`. |
| `slug` | `string` | File path | Allows to customize the blog post URL (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-blog-post`, `slug: /my/path/to/blog/post`, slug: `/`. |
```mdx-code-block
</APITable>
```
```ts
type Tag = string | {label: string; permalink: string};

View file

@ -1,10 +1,10 @@
---
sidebar_position: 1
id: plugin-content-docs
title: '📦 plugin-content-docs'
slug: '/api/plugins/@docusaurus/plugin-content-docs'
slug: /api/plugins/@docusaurus/plugin-content-docs
---
# 📦 plugin-content-docs
import APITable from '@site/src/components/APITable';
Provides the [Docs](../../guides/docs/docs-introduction.md) functionality and is the default docs plugin for Docusaurus.
@ -27,12 +27,14 @@ You can configure this plugin through the preset options.
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `path` | `string` | `'docs'` | Path to the docs content directory on the file system, relative to site directory. |
| `editUrl` | <code>string \| EditUrlFunction</code> | `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` | <code>string \| <a href="#EditUrlFunction">EditUrlFunction</a></code> | `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 +44,8 @@ Accepted fields:
| `sidebarPath` | <code>false \| string</code> | `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` | <code>boolean \| PrefixParser</code> | _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` | <a href="#SidebarGenerator"><code>SidebarGenerator</code></a> | _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` | <code>boolean \|</code> <a href="#PrefixParser"><code>PrefixParser</code></a> | _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,9 +62,15 @@ 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` | <a href="#VersionsConfig"><code>VersionsConfig</code></a> | `{}` | Independent customization of each version's properties. |
```mdx-code-block
</APITable>
```
### Types {#types}
#### `EditUrlFunction` {#EditUrlFunction}
```ts
type EditUrlFunction = (params: {
@ -72,38 +80,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<string, unknown>;
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 +122,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<SidebarItem[]>;
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]: {
/**
@ -239,16 +261,19 @@ Markdown documents can use the following Markdown front matter metadata fields,
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | file path (including folders, without the extension) | A unique document id. |
| `id` | `string` | file path (including folders, without the extension) | A unique document ID. |
| `title` | `string` | Markdown title or `id` | The text title of your document. Used for the page metadata and as a fallback value in multiple places (sidebar, next/previous buttons...). Automatically added at the top of your doc if it does not contain any Markdown title. |
| `pagination_label` | `string` | `sidebar_label` or `title` | The text used in the document next/previous buttons for this document. |
| `sidebar_label` | `string` | `title` | The text shown in the document sidebar for this document. |
| `sidebar_position` | `number` | Default ordering | Controls the position of a doc inside the generated sidebar slice when using `autogenerated` sidebar items. See also [Autogenerated sidebar metadata](/docs/sidebar#autogenerated-sidebar-metadata). |
| `sidebar_class_name` | `string` | `undefined` | Gives the corresponding sidebar label a special class name when using autogenerated sidebars. |
| `sidebar_custom_props` | `string` | `undefined` | Assign custom metadata to the sidebar item referencing this doc. |
| `hide_title` | `boolean` | `false` | Whether to hide the title at the top of the doc. It only hides a title declared through the front matter, and have no effect on a Markdown title at the top of your document. |
| `hide_table_of_contents` | `boolean` | `false` | Whether to hide the table of contents to the right. |
| `toc_min_heading_level` | `number` | `2` | The minimum heading level shown in the table of contents. Must be between 2 and 6 and lower or equal to the max value. |
@ -260,16 +285,23 @@ Accepted fields:
| `keywords` | `string[]` | `undefined` | Keywords meta tag for the document page, for search engines. |
| `description` | `string` | The first line of Markdown content | The description of your document, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. |
| `image` | `string` | `undefined` | Cover or thumbnail image that will be used when displaying the link to your post. |
| `slug` | `string` | File path | Allows to customize the document url (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-doc`, `slug: /my/path/myDoc`, `slug: /`. |
| `slug` | `string` | File path | Allows to customize the document URL (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-doc`, `slug: /my/path/myDoc`, `slug: /`. |
| `tags` | `Tag[]` | `undefined` | A list of strings or objects of two string fields `label` and `permalink` to tag to your docs. |
| `draft` | `boolean` | `false` | A boolean flag to indicate that a document is a work-in-progress. Draft documents will only be displayed during development. |
| `last_update` | `FileChange` | `undefined` | Allows overriding the last updated author and/or date. Date can be any [parsable date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). |
```mdx-code-block
</APITable>
```
```ts
type Tag = string | {label: string; permalink: string};
```
```ts
type FileChange = {date: string; author: string};
```
Example:
```md
@ -288,6 +320,9 @@ keywords:
- docusaurus
image: https://i.imgur.com/mErPwqL.png
slug: /myDoc
last_update:
date: 1/1/2000
author: custom author name
---
# Markdown Features

View file

@ -1,10 +1,10 @@
---
sidebar_position: 3
id: plugin-content-pages
title: '📦 plugin-content-pages'
slug: '/api/plugins/@docusaurus/plugin-content-pages'
slug: /api/plugins/@docusaurus/plugin-content-pages
---
# 📦 plugin-content-pages
import APITable from '@site/src/components/APITable';
The default pages plugin for Docusaurus. The classic template ships with this plugin with default configurations. This plugin provides [creating pages](guides/creating-pages.md) functionality.
@ -27,7 +27,9 @@ You can configure this plugin through the preset options.
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -41,7 +43,9 @@ Accepted fields:
| `beforeDefaultRemarkPlugins` | `any[]` | `[]` | Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins. |
| `beforeDefaultRehypePlugins` | `any[]` | `[]` | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. |
```mdx-code-block
</APITable>
```
### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 5
id: plugin-debug
title: '📦 plugin-debug'
slug: '/api/plugins/@docusaurus/plugin-debug'
slug: /api/plugins/@docusaurus/plugin-debug
---
# 📦 plugin-debug
```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -67,8 +67,10 @@ Most Docusaurus users configure this plugin through the preset options.
:::
<Tabs>
<TabItem value="Preset Options">
```mdx-code-block
<Tabs groupId="api-config-ex">
<TabItem value="preset" label="Preset options">
```
If you use a preset, configure this plugin through the [preset options](../../using-plugins.md#docusauruspreset-classic):
@ -86,8 +88,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
<TabItem value="Plugin Options">
<TabItem value="plugin" label="Plugin Options">
```
If you are using a standalone plugin, provide options directly to the plugin:
@ -98,5 +102,7 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
</Tabs>
```

View file

@ -1,10 +1,10 @@
---
sidebar_position: 6
id: plugin-google-analytics
title: '📦 plugin-google-analytics'
slug: '/api/plugins/@docusaurus/plugin-google-analytics'
slug: /api/plugins/@docusaurus/plugin-google-analytics
---
# 📦 plugin-google-analytics
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.md) instead.
@ -33,14 +33,18 @@ You can configure this plugin through the preset options.
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `trackingID` | `string` | **Required** | The tracking ID of your analytics service. |
| `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. |
```mdx-code-block
</APITable>
```
### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 7
id: plugin-google-gtag
title: '📦 plugin-google-gtag'
slug: '/api/plugins/@docusaurus/plugin-google-gtag'
slug: /api/plugins/@docusaurus/plugin-google-gtag
---
# 📦 plugin-google-gtag
import APITable from '@site/src/components/APITable';
The default [Global Site Tag (gtag.js)](https://developers.google.com/analytics/devguides/collection/gtagjs/) plugin. It is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform. This section describes how to configure a Docusaurus site to enable global site tag for Google Analytics.
@ -39,14 +39,18 @@ You can configure this plugin through the preset options.
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `trackingID` | `string` | **Required** | The tracking ID of your gtag service. |
| `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. |
```mdx-code-block
</APITable>
```
### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 8
id: plugin-ideal-image
title: '📦 plugin-ideal-image'
slug: '/api/plugins/@docusaurus/plugin-ideal-image'
slug: /api/plugins/@docusaurus/plugin-ideal-image
---
# 📦 plugin-ideal-image
import APITable from '@site/src/components/APITable';
Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).
@ -40,7 +40,9 @@ import thumbnail from './path/to/img.png';
Accepted fields:
```mdx-code-block
<APITable>
```
| Option | Type | Default | Description |
| --- | --- | --- | --- |
@ -53,7 +55,9 @@ Accepted fields:
| `quality` | `number` | `85` | JPEG compression quality |
| `disableInDev` | `boolean` | `true` | You can test ideal image behavior in dev mode by setting this to `false`. **Tip**: use [network throttling](https://www.browserstack.com/guide/how-to-perform-network-throttling-in-chrome) in your browser to simulate slow networks. |
```mdx-code-block
</APITable>
```
### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 9
id: plugin-pwa
title: '📦 plugin-pwa'
slug: '/api/plugins/@docusaurus/plugin-pwa'
slug: /api/plugins/@docusaurus/plugin-pwa
---
# 📦 plugin-pwa
Docusaurus Plugin to add PWA support using [Workbox](https://developers.google.com/web/tools/workbox). This plugin generates a [Service Worker](https://developers.google.com/web/fundamentals/primers/service-workers) in production build only, and allows you to create fully PWA-compliant documentation site with offline and installation support.
## Installation {#installation}
@ -70,7 +70,7 @@ If your browser supports it, you should be able to install a Docusaurus site as
:::note
App installation requires the https protocol and a valid manifest.
App installation requires the HTTPS protocol and a valid manifest.
:::
@ -112,15 +112,15 @@ 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:
- `appInstalled`: activates for users having installed the site as an app (not 100% reliable)
- `standalone`: activates for users running the app as standalone (often the case once a PWA is installed)
- `queryString`: activates if queryString contains `offlineMode=true` (convenient for PWA debugging)
- `mobile`: activates for mobile users (width <= 940px)
- `mobile`: activates for mobile users (width <= 996px)
- `saveData`: activates for users with `navigator.connection.saveData === true`
- `always`: activates for all users
@ -160,7 +160,7 @@ module.exports = {
modifyURLPrefix: {
//...
},
// We already add regular static assets (html, images...) to be available offline
// We already add regular static assets (HTML, images...) to be available offline
// You can add more files according to your needs
globPatterns: ['**/*.{pdf,docx,xlsx}'],
// ...
@ -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<string,string>>`
- Type: `({ tagName: string; [attributeName: string]: string })[]`
- Default: `[]`
Array of objects containing `tagName` and key-value pairs for attributes to inject into the `<head>` 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)}
</CodeBlock>
```
## 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.

View file

@ -1,10 +1,10 @@
---
sidebar_position: 10
id: plugin-sitemap
title: '📦 plugin-sitemap'
slug: '/api/plugins/@docusaurus/plugin-sitemap'
slug: /api/plugins/@docusaurus/plugin-sitemap
---
# 📦 plugin-sitemap
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.
@ -33,15 +33,20 @@ You can configure this plugin through the [preset options](#ex-config-preset).
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `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. |
```mdx-code-block
</APITable>
```
:::info
@ -70,6 +75,7 @@ const config = {
changefreq: 'weekly',
priority: 0.5,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
};
```

View file

@ -1,11 +1,12 @@
---
sidebar_position: 0
id: themes-overview
title: 'Docusaurus themes'
sidebar_label: Themes overview
slug: '/api/themes'
slug: /api/themes
---
# Docusaurus themes
We provide official Docusaurus themes.
## Main themes {#main-themes}

View file

@ -1,10 +1,10 @@
---
sidebar_position: 2
id: theme-classic
title: '📦 theme-classic'
slug: '/api/themes/@docusaurus/theme-classic'
slug: /api/themes/@docusaurus/theme-classic
---
# 📦 theme-classic
The classic theme for Docusaurus.
You can refer to the [theme configuration page](theme-configuration.md) for more details on the configuration.

View file

@ -1,12 +1,12 @@
---
sidebar_position: 1
id: theme-configuration
title: 'Theme configuration'
sidebar_label: 'Configuration'
slug: '/api/themes/configuration'
sidebar_label: Configuration
slug: /api/themes/configuration
toc_max_heading_level: 4
---
# Theme configuration
import APITable from '@site/src/components/APITable';
This configuration applies to all [main themes](./overview.md).
@ -21,7 +21,9 @@ It is possible to customize the color mode support within the `colorMode` object
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -29,7 +31,9 @@ Accepted fields:
| `disableSwitch` | `boolean` | `false` | Hides the switch in the navbar. Useful if you want to support a single color mode. |
| `respectPrefersColorScheme` | `boolean` | `false` | Whether to use the `prefers-color-scheme` media-query, using user system preferences, instead of the hardcoded `defaultMode`. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -61,13 +65,17 @@ You can configure a default image that will be used for your meta tag, in partic
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `image` | `string` | `undefined` | The meta image URL for the site. Relative to your site's "static" directory. Cannot be SVGs. Can be external URLs too. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -82,17 +90,21 @@ module.exports = {
### Metadata {#metadata}
You can configure additional html metadata (and override existing ones).
You can configure additional HTML metadata (and override existing ones).
Accepted fields:
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `metadata` | `Metadata[]` | `[]` | Any field will be directly passed to the `<meta />` tag. Possible fields include `id`, `name`, `property`, `content`, `itemprop`, etc. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -111,7 +123,9 @@ Sometimes you want to announce something in your website. Just for such a case,
Accepted fields:
```mdx-code-block
<APITable name="announcement-bar">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -121,7 +135,9 @@ Accepted fields:
| `textColor` | `string` | `'#000'` | Announcement text color. |
| `isCloseable` | `boolean` | `true` | Whether this announcement can be dismissed with a '×' button. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -146,7 +162,9 @@ module.exports = {
Accepted fields:
```mdx-code-block
<APITable name="navbar-overview">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -156,7 +174,9 @@ Accepted fields:
| `hideOnScroll` | `boolean` | `false` | Whether the navbar is hidden when the user scrolls down. |
| `style` | <code>'primary' \| 'dark'</code> | Same as theme | Sets the navbar style, ignoring the dark/light theme. |
```mdx-code-block
</APITable>
```
### Navbar logo {#navbar-logo}
@ -166,7 +186,9 @@ To improve dark mode support, you can also set a different logo for this mode.
Accepted fields:
```mdx-code-block
<APITable name="navbar-logo">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -177,8 +199,12 @@ Accepted fields:
| `width` | <code>string \| number</code> | `undefined` | Specifies the `width` attribute. |
| `height` | <code>string \| number</code> | `undefined` | Specifies the `height` attribute. |
| `target` | `string` | Calculated based on `href` (external links will open in a new tab, all others in the current one). | The `target` attribute of the link; controls whether the link is opened in a new tab, the current one, or otherwise. |
| `className` | `string` | `undefined` | CSS class applied to the image. |
| `style` | `object` | `undefined` | CSS inline style object. React/JSX flavor, using camelCase properties. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -196,6 +222,8 @@ module.exports = {
target: '_self',
width: 32,
height: 32,
className: 'custom-navbar-logo-class',
style: {border: 'solid red'},
},
// highlight-end
},
@ -253,7 +281,9 @@ Outbound (external) links automatically get `target="_blank" rel="noopener noref
Accepted fields:
```mdx-code-block
<APITable name="navbar-link">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -268,7 +298,9 @@ Accepted fields:
| `activeBaseRegex` | `string` | `undefined` | Alternative to `activeBasePath` if required. |
| `className` | `string` | `''` | Custom CSS class (for styling any item). |
```mdx-code-block
</APITable>
```
:::note
@ -318,7 +350,9 @@ Note that the dropdown base item is a clickable link as well, so this item can r
Accepted fields:
```mdx-code-block
<APITable name="navbar-dropdown">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -327,7 +361,9 @@ Accepted fields:
| `items` | <code>[LinkLikeItem](#navbar-dropdown)[]</code> | **Required** | The items to be contained in the dropdown. |
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -367,7 +403,9 @@ If you want to link to a specific doc, this special navbar item type will render
Accepted fields:
```mdx-code-block
<APITable name="navbar-doc-link">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -377,7 +415,9 @@ Accepted fields:
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
| `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc belongs to. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -406,7 +446,9 @@ You can link a navbar item to the first document link (which can be a doc link o
Accepted fields:
```mdx-code-block
<APITable name="navbar-doc-sidebar">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -416,7 +458,9 @@ Accepted fields:
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
| `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the sidebar belongs to. |
```mdx-code-block
</APITable>
```
:::tip
@ -469,11 +513,13 @@ module.exports = {
If you use docs with versioning, this special navbar item type that will render a dropdown with all your site's available versions.
The user will be able to switch from one version to another, while staying on the same doc (as long as the doc id is constant across versions).
The user will be able to switch from one version to another, while staying on the same doc (as long as the doc ID is constant across versions).
Accepted fields:
```mdx-code-block
<APITable name="navbar-docs-version-dropdown">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -484,7 +530,9 @@ Accepted fields:
| `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc versioning belongs to. |
| `dropdownActiveClassDisabled` | `boolean` | `false` | Do not add the link active class when browsing docs. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -513,7 +561,9 @@ If you use docs with versioning, this special navbar item type will link to the
Accepted fields:
```mdx-code-block
<APITable name="navbar-docs-version">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -523,7 +573,9 @@ Accepted fields:
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
| `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc versioning belongs to. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -554,7 +606,9 @@ The user will be able to switch from one locale to another, while staying on the
Accepted fields:
```mdx-code-block
<APITable name="navbar-locale-dropdown">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -563,7 +617,9 @@ Accepted fields:
| `dropdownItemsBefore` | <code>[LinkLikeItem](#navbar-dropdown)[]</code> | `[]` | Add additional dropdown items at the beginning of the dropdown. |
| `dropdownItemsAfter` | <code>[LinkLikeItem](#navbar-dropdown)[]</code> | `[]` | Add additional dropdown items at the end of the dropdown. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -596,14 +652,19 @@ If you use the [search](../../search.md), the search bar will be the rightmost e
However, with this special navbar item type, you can change the default location.
```mdx-code-block
<APITable name="navbar-search">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `type` | `'search'` | **Required** | Sets the type of this item to a search bar. |
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
| `className` | `string` | / | Custom CSS class for this navbar item. |
```mdx-code-block
</APITable>
```
```js title="docusaurus.config.js"
module.exports = {
@ -626,7 +687,9 @@ module.exports = {
You can also render your own HTML markup inside a navbar item using this navbar item type.
```mdx-code-block
<APITable name="navbar-html">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -635,7 +698,9 @@ You can also render your own HTML markup inside a navbar item using this navbar
| `className` | `string` | `''` | Custom CSS class for this navbar item. |
| `value` | `string` | `''` | Custom HTML to be rendered inside this navbar item. |
```mdx-code-block
</APITable>
```
```js title="docusaurus.config.js"
module.exports = {
@ -693,7 +758,9 @@ Docusaurus uses [Prism React Renderer](https://github.com/FormidableLabs/prism-r
Accepted fields:
```mdx-code-block
<APITable name="codeblock">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -702,7 +769,9 @@ Accepted fields:
| `defaultLanguage` | `string` | `undefined` | The side of the navbar this item should appear on. |
| `magicComments` | `MagicCommentConfig[]` | _see below_ | The list of [magic comments](../../guides/markdown-features/markdown-features-code-blocks.mdx#custom-magic-comments). |
```mdx-code-block
</APITable>
```
```ts
type MagicCommentConfig = {
@ -770,7 +839,9 @@ You can add logo and a copyright to the footer via `themeConfig.footer`. Logo ca
Accepted fields:
```mdx-code-block
<APITable name="footer">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
@ -779,7 +850,9 @@ Accepted fields:
| `style` | <code>'dark' \| 'light'</code> | `'light'` | The color theme of the footer component. |
| `links` | <code>(Column \| FooterLink)[]</code> | `[]` | The link groups to be present. |
```mdx-code-block
</APITable>
```
Example configuration:
@ -789,9 +862,9 @@ module.exports = {
// highlight-start
footer: {
logo: {
alt: 'Facebook Open Source Logo',
src: 'img/oss_logo.png',
href: 'https://opensource.facebook.com',
alt: 'Meta Open Source Logo',
src: 'img/meta_oss_logo.png',
href: 'https://opensource.fb.com',
width: 160,
height: 51,
},
@ -808,27 +881,35 @@ You can add links to the footer via `themeConfig.footer.links`. There are two ty
Multi-column footer links have a `title` and a list of `FooterItem`s for each column.
```mdx-code-block
<APITable name="footer-links">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | `undefined` | Label of the section of these links. |
| `items` | `FooterItem[]` | `[]` | Links in this section. |
```mdx-code-block
</APITable>
```
Accepted fields of each `FooterItem`:
```mdx-code-block
<APITable name="footer-items">
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | **Required** | Text to be displayed for this link. |
| `to` | `string` | **Required** | Client-side routing, used for navigating within the website. The baseUrl will be automatically prepended to this value. |
| `href` | `string` | **Required** | A full-page navigation, used for navigating outside of the website. **Only one of `to` or `href` should be used.** |
| `html` | `string` | `undefined` | Renders the html pass-through instead of a simple link. In case `html` is used, no other options should be provided. |
| `html` | `string` | `undefined` | Renders the HTML pass-through instead of a simple link. In case `html` is used, no other options should be provided. |
```mdx-code-block
</APITable>
```
Example multi-column configuration:
@ -918,14 +999,18 @@ module.exports = {
You can adjust the default table of contents via `themeConfig.tableOfContents`.
```mdx-code-block
<APITable>
```
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `minHeadingLevel` | `number` | `2` | The minimum heading level shown in the table of contents. Must be between 2 and 6 and lower or equal to the max value. |
| `maxHeadingLevel` | `number` | `3` | Max heading level displayed in the TOC. Should be an integer between 2 and 6. |
```mdx-code-block
</APITable>
```
Example configuration:

View file

@ -1,10 +1,10 @@
---
sidebar_position: 3
id: theme-live-codeblock
title: '📦 theme-live-codeblock'
slug: '/api/themes/@docusaurus/theme-live-codeblock'
slug: /api/themes/@docusaurus/theme-live-codeblock
---
# 📦 theme-live-codeblock
This theme provides a `@theme/CodeBlock` component that is powered by react-live. You can read more on [interactive code editor](../../guides/markdown-features/markdown-features-code-blocks.mdx#interactive-code-editor) documentation.
```bash npm2yarn

View file

@ -1,17 +1,17 @@
---
sidebar_position: 4
id: theme-search-algolia
title: '📦 theme-search-algolia'
slug: '/api/themes/@docusaurus/theme-search-algolia'
slug: /api/themes/@docusaurus/theme-search-algolia
---
# 📦 theme-search-algolia
This theme provides a `@theme/SearchBar` component that integrates with Algolia DocSearch easily. Combined with `@docusaurus/theme-classic`, it provides a very easy search integration. You can read more on [search](../../search.md) documentation.
```bash npm2yarn
npm install --save @docusaurus/theme-search-algolia
```
This theme also adds search page available at `/search` (as swizzlable `SearchPage` component) path with OpenSearch support. You can this default path via `themeConfig.algolia.searchPagePath`. Use `false` to disable search page.
This theme also adds search page available at `/search` (as swizzlable `SearchPage` component) path with OpenSearch support. You can change this default path via `themeConfig.algolia.searchPagePath`. Use `false` to disable search page.
:::tip

View file

@ -1,12 +1,13 @@
---
id: blog
title: Blog
description: Deploy a full-featured blog in no time with Docusaurus.
---
# Blog
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
The blog feature enables you to deploy in no time a full-featured blog.
The blog feature enables you to deploy a full-featured blog in no time.
:::info
@ -69,7 +70,7 @@ This is my first post on Docusaurus 2.
A whole bunch of exploration to follow.
```
The front matter is useful to add more metadata to your blog post, for example, author information, but Docusaurus will be able to infer all necessary metadata without the front matter. For all possible fields, see [the API documentation](api/plugins/plugin-content-blog.md#markdown-front-matter).
The [front matter](./guides/markdown-features/markdown-features-intro.mdx#front-matter) is useful to add more metadata to your blog post, for example, author information, but Docusaurus will be able to infer all necessary metadata without the front matter. For all possible fields, see [the API documentation](api/plugins/plugin-content-blog.md#markdown-front-matter).
## Blog list {#blog-list}
@ -191,9 +192,10 @@ Use the `authors` front matter field to declare blog post authors. An author sho
Blog post authors can be declared directly inside the front matter:
````mdx-code-block
```mdx-code-block
<Tabs groupId="author-front-matter">
<TabItem value="single" label="Single author">
<TabItem value="single" label="Single author">
```
```md title="my-blog-post.md"
---
@ -206,8 +208,10 @@ authors:
---
```
</TabItem>
<TabItem value="multiple" label="Multiple authors">
```mdx-code-block
</TabItem>
<TabItem value="multiple" label="Multiple authors">
```
```md title="my-blog-post.md"
---
@ -224,9 +228,10 @@ authors:
---
```
</TabItem>
```mdx-code-block
</TabItem>
</Tabs>
````
```
:::tip
@ -278,9 +283,10 @@ Use the `authorsMapPath` plugin option to configure the path. JSON is also suppo
In blog posts front matter, you can reference the authors declared in the global configuration file:
````mdx-code-block
```mdx-code-block
<Tabs groupId="author-front-matter">
<TabItem value="single" label="Single author">
<TabItem value="single" label="Single author">
```
```md title="my-blog-post.md"
---
@ -288,8 +294,10 @@ authors: jmarcey
---
```
</TabItem>
<TabItem value="multiple" label="Multiple authors">
```mdx-code-block
</TabItem>
<TabItem value="multiple" label="Multiple authors">
```
```md title="my-blog-post.md"
---
@ -297,9 +305,10 @@ authors: [jmarcey, slorber]
---
```
</TabItem>
```mdx-code-block
</TabItem>
</Tabs>
````
```
:::info
@ -393,9 +402,10 @@ The default reading time is able to accept additional options: `wordsPerMinute`
Use the callback for all your customization needs:
````mdx-code-block
```mdx-code-block
<Tabs>
<TabItem value="disable-per-post" label="Per-post disabling">
```
**Disable reading time on one page:**
@ -409,7 +419,9 @@ module.exports = {
showReadingTime: true,
// highlight-start
readingTime: ({content, frontMatter, defaultReadingTime}) =>
frontMatter.hide_reading_time ? undefined : defaultReadingTime({content}),
frontMatter.hide_reading_time
? undefined
: defaultReadingTime({content}),
// highlight-end
},
},
@ -428,8 +440,10 @@ hide_reading_time: true
This page will no longer display the reading time stats!
```
```mdx-code-block
</TabItem>
<TabItem value="passing-options" label="Passing options">
```
**Pass options to the default reading time function:**
@ -451,8 +465,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
<TabItem value="using-custom-algo" label="Using custom algorithms">
```
**Use a custom implementation of reading time:**
@ -474,9 +490,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
</Tabs>
````
```
:::
@ -591,7 +608,7 @@ By default, the classic theme assumes only one blog per website and hence includ
Set the `routeBasePath` to the URL route that you want your second blog to be accessed on. Note that the `routeBasePath` here has to be different from the first blog or else there could be a collision of paths! Also, set `path` to the path to the directory containing your second blog's entries.
As documented for [multi-instance plugins](./using-plugins.md#multi-instance-plugins-and-plugin-ids), you need to assign a unique id to the plugins.
As documented for [multi-instance plugins](./using-plugins.md#multi-instance-plugins-and-plugin-ids), you need to assign a unique ID to the plugins.
```js title="docusaurus.config.js"
module.exports = {

View file

@ -1,8 +1,9 @@
---
id: browser-support
title: Browser support
description: How to keep a reasonable bundle size while ensuring sufficient browser support.
---
# Browser support
Docusaurus allows sites to define the list of supported browsers through a [browserslist configuration](https://github.com/browserslist/browserslist).
## Purpose {#purpose}
@ -70,7 +71,7 @@ And browsers used in development are:
- The latest version of Chrome _or_ Firefox _or_ Safari.
You can "evaluate" any config with the `browserslist` cli to obtain the actual list:
You can "evaluate" any config with the `browserslist` CLI to obtain the actual list:
```bash
npx browserslist --env="production"

View file

@ -1,5 +1,5 @@
---
id: cli
description: Docusaurus provides a set of scripts to help you generate, serve, and deploy your website.
---
# CLI
@ -41,8 +41,9 @@ Builds and serves a preview of your site locally with [Webpack Dev Server](https
| `--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`. |
| `--hot-only` | `false` | Enables Hot Module Replacement without page refresh as a fallback in case of build failures. More information [here](https://webpack.js.org/configuration/dev-server/#devserverhotonly). |
| `--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` |
| `--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
@ -86,13 +87,15 @@ Compiles your site for production.
| --- | --- | --- |
| `--bundle-analyzer` | `false` | Analyze your bundle with the [webpack bundle analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). |
| `--out-dir` | `build` | The full path for the new output directory, relative to the current workspace. |
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--config` | `undefined` | Path to Docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. |
:::info
For advanced minification of CSS bundle, we use the [advanced cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-advanced) (along with additional several PostCSS plugins) and [level 2 optimization of clean-css](https://github.com/jakubpawlowicz/clean-css#level-2-optimizations). If as a result of this advanced CSS minification you find broken CSS, build your website with the environment variable `USE_SIMPLE_CSS_MINIFIER=true` to minify CSS with the [default cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-default). **Please [fill out an issue](https://github.com/facebook/docusaurus/issues/new?labels=bug%2C+needs+triage&template=bug.md) if you experience CSS minification bugs.**
You can skip the HTML minification with the environment variable `SKIP_HTML_MINIFICATION=true`.
:::
### `docusaurus swizzle [themeName] [componentName] [siteDir]` {#docusaurus-swizzle}
@ -136,7 +139,7 @@ Deploys your site with [GitHub Pages](https://pages.github.com/). Check out the
| --- | --- | --- |
| `--out-dir` | `build` | The full path for the new output directory, relative to the current workspace. |
| `--skip-build` | `false` | Deploy website without building it. This may be useful when using a custom deploy script. |
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--config` | `undefined` | Path to Docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
### `docusaurus serve [siteDir]` {#docusaurus-serve-sitedir}
@ -147,8 +150,9 @@ Serve your built website locally.
| `--port` | `3000` | Use specified port |
| `--dir` | `build` | The full path for the output directory, relative to the current workspace |
| `--build` | `false` | Build website before serving |
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--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}
@ -166,12 +170,12 @@ By default, the files are written in `website/i18n/<defaultLocale>/...`.
| --- | --- | --- |
| `--locale` | `<defaultLocale>` | Define which locale folder you want to write translations the JSON files in |
| `--override` | `false` | Override existing translation messages |
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--config` | `undefined` | Path to Docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
| `--messagePrefix` | `''` | Allows adding a prefix to each translation message, to help you highlight untranslated strings |
### `docusaurus write-heading-ids [siteDir] [files]` {#docusaurus-write-heading-ids-sitedir}
Add [explicit heading ids](./guides/markdown-features/markdown-features-toc.mdx#explicit-ids) to the Markdown documents of your site.
Add [explicit heading IDs](./guides/markdown-features/markdown-features-toc.mdx#explicit-ids) to the Markdown documents of your site.
| Name | Default | Description |
| --- | --- | --- |

View file

@ -1,8 +1,9 @@
---
id: configuration
title: Configuration
description: Configuring your site's behavior through docusaurus.config.js and more.
---
# Configuration
import TOCInline from '@theme/TOCInline';
Docusaurus has a unique take on configurations. We encourage you to congregate information about your site into one place. We guard the fields of this file and facilitate making this data object accessible across your site.
@ -178,4 +179,4 @@ module.exports = {
};
```
Most of the time, this configuration will work just fine. If you want to customize your babel configuration (e.g. to add support for Flow), you can directly edit this file. For your changes to take effect, you need to restart the Docusaurus dev server.
Most of the time, this configuration will work just fine. If you want to customize your Babel configuration (e.g. to add support for Flow), you can directly edit this file. For your changes to take effect, you need to restart the Docusaurus dev server.

View file

@ -1,8 +1,9 @@
---
id: deployment
title: Deployment
description: Deploy your Docusaurus app for production on a range of static site hosting services.
---
# Deployment
To build the static files of your website for production, run:
```bash npm2yarn
@ -182,8 +183,8 @@ Some Docusaurus sites put the `docs` folder outside of `website` (most likely fo
```bash
repo # git root
├── docs # md files
└── website # docusaurus root
├── docs # MD files
└── website # Docusaurus root
```
If you decide to use the `website` folder as Netlify's base directory, Netlify will not trigger builds when you update the `docs` folder, and you need to configure a [custom `ignore` command](https://docs.netlify.com/configure-builds/common-configurations/ignore-builds/):
@ -301,31 +302,37 @@ GitHub enterprise installations should work in the same manner as github.com; yo
Finally, to deploy your site to GitHub Pages, run:
````mdx-code-block
```mdx-code-block
<Tabs>
<TabItem value="bash" label="Bash">
```
```bash
GIT_USER=<GITHUB_USERNAME> yarn deploy
```
```mdx-code-block
</TabItem>
<TabItem value="windows" label="Windows">
```
```batch
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
```
````mdx-code-block
</TabItem>
<TabItem value="powershell" label="PowerShell">
```mdx-code-block
```powershell
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
```
````
```mdx-code-block
</TabItem>
</Tabs>
````
```
:::caution
@ -351,23 +358,23 @@ Here are two approaches to deploying your docs with GitHub Actions. Based on the
- Source repo and deployment repo are the **same** repository.
- The deployment repo is a **remote** repository, different from the source.
````mdx-code-block
```mdx-code-block
<Tabs>
<TabItem value="same" label="Same">
```
While you can have both jobs defined in the same workflow file, the original `deploy` workflow will always be listed as skipped in the PR check suite status, which is not communicative of the actual status and provides no value to the review process. We therefore propose to manage them as separate workflows instead.
We will use a popular third-party deployment action: [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus).
<details>
<summary>GitHub action files</summary>
Add these two workflow files:
:::warning Tweak the parameters for your setup
These files assume you are using yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
These files assume you are using Yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
If your Docusaurus project is not at the root of your repo, you may need to configure a [default working directory](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-set-the-default-shell-and-working-directory), and adjust the paths accordingly.
@ -391,7 +398,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
cache: yarn
- name: Install dependencies
@ -434,7 +441,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
cache: yarn
- name: Install dependencies
@ -445,17 +452,20 @@ jobs:
</details>
```mdx-code-block
</TabItem>
<TabItem value="remote" label="Remote">
```
A cross-repo publish is more difficult to set up, because you need to push to another repo with permission checks. We will be using SSH to do the authentication.
1. Generate a new [SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
1. Generate a new [SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent). Since this SSH key will be used in CI, make sure to not enter any passphrase.
2. By default, your public key should have been created in `~/.ssh/id_rsa.pub`; otherwise, use the name you've provided in the previous step to add your key to [GitHub deploy keys](https://developer.github.com/v3/guides/managing-deploy-keys/).
3. Copy the key to clipboard with `xclip -sel clip < ~/.ssh/id_rsa.pub` and paste it as a [deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys) in your repository. Copy the file content if the command line doesn't work for you. Check the box for `Allow write access` before saving your deployment key.
3. Copy the key to clipboard with `pbcopy < ~/.ssh/id_rsa.pub` and paste it as a [deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys) in the deployment repository. Copy the file content if the command line doesn't work for you. Check the box for `Allow write access` before saving your deployment key.
4. You'll need your private key as a [GitHub secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) to allow Docusaurus to run the deployment for you.
5. Copy your private key with `xclip -sel clip < ~/.ssh/id_rsa` and paste a GitHub secret with the name `GH_PAGES_DEPLOY`. Copy the file content if the command line doesn't work for you. Save your secret.
5. Copy your private key with `pbcopy < ~/.ssh/id_rsa` and paste a GitHub secret with the name `GH_PAGES_DEPLOY` on your source repository. Copy the file content if the command line doesn't work for you. Save your secret.
6. Create your [documentation workflow file](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#creating-a-workflow-file) in `.github/workflows/`. In this example it's `deploy.yml`.
7. You should have essentially: the source repo with the GitHub workflow set with the private SSH key as GitHub Secret and your deployment repo set with the public SSH key in GitHub Deploy Keys.
<details>
@ -465,7 +475,7 @@ A cross-repo publish is more difficult to set up, because you need to push to an
Please make sure that you replace `actions@github.com` with your GitHub email and `gh-actions` with your name.
This file assumes you are using yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
This file assumes you are using Yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
:::
@ -486,7 +496,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
@ -499,7 +509,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
cache: yarn
- uses: webfactory/ssh-agent@v0.5.0
with:
@ -516,9 +526,24 @@ jobs:
</details>
```mdx-code-block
</TabItem>
</Tabs>
````
```
<details>
<summary>Site not deployed properly?</summary>
After pushing to main, if you don't see your site published at the desired location (for example, it says "There isn't a GitHub Pages site here", or it's showing your repo's README.md file), check the following:
- It may take a few minutes for GitHub pages to pick up the new files, so wait for about 3 minutes and refresh before concluding it isn't working.
- On your repo's landing page, you should see a little green tick next to the last commit's title, indicating the CI has passed. If you see a cross, it means the build or deployment failed, and you should check the log for more debugging information.
- Click on the tick and make sure your see a "Deploy to GitHub Pages" workflow. Names like "pages build and deployment / deploy" are GitHub's default workflows, indicating your custom deployment workflow failed to be triggered at all. Make sure the YAML files are put under the `.github/workflows` folder, and the trigger condition is set correctly (for example, if your default branch is "master" instead of "main", you need to change the `on.push` property).
- We are using `gh-pages` as the deployment branch. Under your repo's Settings > Pages, make sure the "Source" (which is the source for the _deployment_ files, not "source" as in our terminology) is set to "gh-pages" + "/ (root)".
- If you are using a custom domain, make sure the DNS record is pointing to the GitHub pages servers' IP.
</details>
### Triggering deployment with Travis CI {#triggering-deployment-with-travis-ci}
@ -533,7 +558,7 @@ Continuous integration (CI) services are typically used to perform routine tasks
```yml title=".travis.yml"
language: node_js
node_js:
- '14.15.0'
- 18
branches:
only:
- main
@ -575,9 +600,9 @@ After creating this simple pipeline, each new commit pushed to the branch you se
### Using Azure Pipelines {#using-azure-pipelines}
1. Sign Up at [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) if you haven't already.
2. Create an organization and within the organization create a project and connect your repository from GitHub.
2. Create an organization. Within the organization, create a project and connect your repository from GitHub.
3. Go to https://github.com/settings/tokens and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) with the `repo` scope.
4. In the project page (which looks like `https://dev.azure.com/ORG_NAME/REPO_NAME/_build` create a new pipeline with the following text. Also, click on edit and add a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username). Make sure to mark them as secret. Alternatively, you can also add a file named `azure-pipelines.yml` at your repository root.
4. In the project page (which looks like `https://dev.azure.com/ORG_NAME/REPO_NAME/_build`), create a new pipeline with the following text. Also, click on edit and add a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username). Make sure to mark them as secret. Alternatively, you can also add a file named `azure-pipelines.yml` at your repository root.
```yml title="azure-pipelines.yml"
trigger:
@ -592,7 +617,7 @@ steps:
- task: NodeTool@0
inputs:
versionSpec: 14.x
versionSpec: '18'
displayName: Install Node.js
- script: |
@ -611,8 +636,8 @@ steps:
### Using Drone {#using-drone}
1. Create a new ssh key that will be the [deploy key](https://docs.github.com/en/free-pro-team@latest/developers/overview/managing-deploy-keys#deploy-keys) for your project.
2. Name your private and public keys to be specific and so that it does not overwrite your other [ssh keys](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
1. Create a new SSH key that will be the [deploy key](https://docs.github.com/en/free-pro-team@latest/developers/overview/managing-deploy-keys#deploy-keys) for your project.
2. Name your private and public keys to be specific and so that it does not overwrite your other [SSH keys](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
3. Go to `https://github.com/USERNAME/REPO/settings/keys` and add a new deploy key by pasting in the public key you just generated.
4. Open your Drone.io dashboard and log in. The URL looks like `https://cloud.drone.io/USERNAME/REPO`.
5. Click on the repository, click on activate repository, and add a secret called `git_deploy_private_key` with your private key value that you just generated.
@ -778,3 +803,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).

View file

@ -1,9 +1,9 @@
---
id: docusaurus-core
title: Docusaurus Client API
sidebar_label: Client API
---
# Docusaurus Client API
Docusaurus provides some APIs on the clients that can be helpful to you when building your site.
## Components {#components}
@ -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/>` {#head}
@ -473,7 +479,7 @@ Prefer a `require()` call for [assets](./guides/markdown-features/markdown-featu
### `useBaseUrlUtils` {#useBaseUrlUtils}
Sometimes `useBaseUrl` is not good enough. This hook return additional utils related to your site's base url.
Sometimes `useBaseUrl` is not good enough. This hook return additional utils related to your site's base URL.
- `withBaseUrl`: useful if you need to add base URLs to multiple URLs at once.

View file

@ -1,10 +1,10 @@
---
id: creating-pages
title: Creating Pages
slug: /creating-pages
sidebar_label: Pages
---
# Creating Pages
In this section, we will learn about creating pages in Docusaurus.
The `@docusaurus/plugin-content-pages` plugin empowers you to create **one-off standalone pages** like a showcase page, playground page, or support page. You can use React components, or Markdown.

View file

@ -0,0 +1,166 @@
---
id: create-doc
description: Create a Markdown Document
slug: /create-doc
---
# Create a doc
Create a Markdown file, `greeting.md`, and place it under the `docs` directory.
```bash
website # root directory of your site
├── docs
│ └── greeting.md
├── src
│ └── pages
├── docusaurus.config.js
├── ...
```
```md
---
description: Create a doc page with rich content.
---
# Hello from Docusaurus
Are you ready to create the documentation site for your open source project?
## Headers
will show up on the table of contents on the upper right
So that your users will know what this page is all about without scrolling down or even without reading too much.
## Only h2 and h3 will be in the TOC by default.
You can configure the TOC heading levels either per-document or in the theme configuration.
The headers are well-spaced so that the hierarchy is clear.
- lists will help you
- present the key points
- that you want your users to remember
- and you may nest them
- multiple times
## Custom ID headers {#custom-id}
With `{#custom-id}` syntax you can set your own header ID.
```
:::note
All files prefixed with an underscore (`_`) under the `docs` directory are treated as "partial" pages and will be ignored by default.
Read more about [importing partial pages](../markdown-features/markdown-features-react.mdx#importing-markdown).
:::
## Doc front matter {#doc-front-matter}
The [front matter](../markdown-features/markdown-features-intro.mdx#front-matter) is used to provide additional metadata for your doc page. Front matter is optional—Docusaurus will be able to infer all necessary metadata without the front matter. For example, the [doc tags](#dog-tags) feature introduced below requires using front matter. For all possible fields, see [the API documentation](../../api/plugins/plugin-content-docs.md#markdown-front-matter).
## Doc tags {#doc-tags}
Optionally, you can add tags to your doc pages, which introduces another dimension of categorization in addition to the [docs sidebar](./sidebar/index.md). Tags are passed in the front matter as a list of labels:
```md "your-doc-page.md"
---
id: doc-with-tags
title: A doc with tags
tags:
- Demo
- Getting started
---
```
:::tip
Tags can also be declared with `tags: [Demo, Getting started]`.
Read more about all the possible [Yaml array syntaxes](https://www.w3schools.io/file/yaml-arrays/).
:::
## Organizing folder structure {#organizing-folder-structure}
How the Markdown files are arranged under the `docs` folder can have multiple impacts on Docusaurus content generation. However, most of them can be decoupled from the file structure.
### Document ID {#document-id}
Every document has a unique `id`. By default, a document `id` is the name of the document (without the extension) relative to the root docs directory.
For example, the ID of `greeting.md` is `greeting`, and the ID of `guide/hello.md` is `guide/hello`.
```bash
website # Root directory of your site
└── docs
├── greeting.md
└── guide
└── hello.md
```
However, the **last part** of the `id` can be defined by the user in the front matter. For example, if `guide/hello.md`'s content is defined as below, its final `id` is `guide/part1`.
```md
---
id: part1
---
Lorem ipsum
```
The ID is used to refer to a document when hand-writing sidebars, or when using docs-related layout components or hooks.
### Doc URLs {#doc-urls}
By default, a document's URL location is its file path relative to the `docs` folder. Use the `slug` front matter to change a document's URL.
For example, suppose your site structure looks like this:
```bash
website # Root directory of your site
└── docs
└── guide
└── hello.md
```
By default `hello.md` will be available at `/docs/guide/hello`. You can change its URL location to `/docs/bonjour`:
```md
---
slug: /bonjour
---
Lorem ipsum
```
`slug` will be appended to the doc plugin's `routeBasePath`, which is `/docs` by default. See [Docs-only mode](#docs-only-mode) for how to remove the `/docs` part from the URL.
:::note
It is possible to use:
- absolute slugs: `slug: /mySlug`, `slug: /`...
- relative slugs: `slug: mySlug`, `slug: ./../mySlug`...
:::
If you want a document to be available at the root, and have a path like `https://docusaurus.io/docs/`, you can use the slug front matter:
```md
---
id: my-home-doc
slug: /
---
Lorem ipsum
```
### Sidebars {#sidebars}
When using [autogenerated sidebars](./sidebar/autogenerated.md), the file structure will determine the sidebar structure.
Our recommendation for file system organization is: make your file system mirror the sidebar structure (so you don't need to handwrite your `sidebars.js` file), and use the `slug` front matter to customize URLs of each document.

View file

@ -1,10 +1,11 @@
---
id: introduction
title: Docs Introduction
sidebar_label: Introduction
slug: /docs-introduction
---
# Docs Introduction
The docs feature provides users with a way to organize Markdown files in a hierarchical format.
:::info
@ -13,76 +14,14 @@ Check the [Docs Plugin API Reference documentation](./../../api/plugins/plugin-c
:::
## Document ID {#document-id}
Your site's documentation is organized by four levels, from lowest to highest:
Every document has a unique `id`. By default, a document `id` is the name of the document (without the extension) relative to the root docs directory.
1. Individual pages.
2. Sidebars.
3. Versions.
4. Plugin instances.
For example, `greeting.md` id is `greeting` and `guide/hello.md` id is `guide/hello`.
```bash
website # Root directory of your site
└── docs
├── greeting.md
└── guide
└── hello.md
```
However, the **last part** of the `id` can be defined by the user in the front matter. For example, if `guide/hello.md`'s content is defined as below, its final `id` is `guide/part1`.
```md
---
id: part1
---
Lorem ipsum
```
### Customizing doc URLs {#customizing-doc-urls}
By default, a document's URL location is its file path relative to the `docs` folder. Use the `slug` front matter to change a document's URL.
For example, suppose your site structure looks like this:
```bash
website # Root directory of your site
└── docs
└── guide
└── hello.md
```
By default `hello.md` will be available at `/docs/guide/hello`. You can change its URL location to `/docs/bonjour`:
```md
---
slug: /bonjour
---
Lorem ipsum
```
`slug` will be appended to the doc plugin's `routeBasePath`, which is `/docs` by default. See [Docs-only mode](#docs-only-mode) for how to remove the `/docs` part from the URL.
:::note
It is possible to use:
- absolute slugs: `slug: /mySlug`, `slug: /`...
- relative slugs: `slug: mySlug`, `slug: ./../mySlug`...
:::
## Home page docs {#home-page-docs}
If you want a document to be available at the root, and have a path like `https://docusaurus.io/docs/`, you can use the slug front matter:
```md
---
id: my-home-doc
slug: /
---
Lorem ipsum
```
The guide will introduce them in that order: starting from [how individual pages can be configured](./docs-create-doc.mdx), to [how to create a sidebar or multiple ones](./sidebar/index.md), to [how to create and manage versions](./versioning.md), to [how to use multiple docs plugin instances](./docs-multi-instance.mdx).
## Docs-only mode {#docs-only-mode}

View file

@ -1,10 +1,11 @@
---
id: multi-instance
title: Docs Multi-instance
description: Use multiple docs plugin instances on a single Docusaurus site.
slug: /docs-multi-instance
---
# Docs Multi-instance
The `@docusaurus/plugin-content-docs` plugin can support [multi-instance](../../using-plugins.md#multi-instance-plugins-and-plugin-ids).
:::note
@ -134,7 +135,7 @@ Don't forget to assign a unique `id` attribute to plugin instances.
:::note
We consider that the `product` instance is the most important one, and make it the "default" instance by not assigning any id.
We consider that the `product` instance is the most important one, and make it the "default" instance by not assigning any ID.
:::
@ -164,7 +165,7 @@ The instance paths will be simpler, and retro-compatible with a single-instance
## Tagging new versions {#tagging-new-versions}
Each plugin instance will have its own cli command to tag a new version. They will be displayed if you run:
Each plugin instance will have its own CLI command to tag a new version. They will be displayed if you run:
```bash npm2yarn
npm run docusaurus -- --help

View file

@ -411,7 +411,7 @@ By default, Docusaurus will **remove the number prefix** from the doc id, title,
**Prefer using [additional metadata](#autogenerated-sidebar-metadata)**.
Updating a number prefix can be annoying, as it can require **updating multiple existing markdown links**:
Updating a number prefix can be annoying, as it can require **updating multiple existing Markdown links**:
```diff title="docs/02-Tutorial Easy/01-First Part.md"
- Check the [Tutorial End](../04-End.md);

View file

@ -198,7 +198,7 @@ A real-world example from the Docusaurus site:
```mdx-code-block
import CodeBlock from '@theme/CodeBlock';
<CodeBlock className="language-js" title="sidebars.js">
<CodeBlock language="js" title="sidebars.js">
{require('!!raw-loader!@site/sidebars.js')
.default
.split('\n')

View file

@ -60,7 +60,7 @@ module.exports = {
};
```
If you use the doc shorthand or [autogenerated](#sidebar-item-autogenerated) sidebar, you would lose the ability to customize the sidebar label through item definition. You can, however, use the `sidebar_label` markdown front matter within that doc, which has higher precedence over the `label` key in the sidebar item. Similarly, you can use `sidebar_custom_props` to declare custom metadata for a doc page.
If you use the doc shorthand or [autogenerated](#sidebar-item-autogenerated) sidebar, you would lose the ability to customize the sidebar label through item definition. You can, however, use the `sidebar_label` Markdown front matter within that doc, which has higher precedence over the `label` key in the sidebar item. Similarly, you can use `sidebar_custom_props` to declare custom metadata for a doc page.
:::note
@ -230,29 +230,10 @@ With category links, clicking on a category can navigate you to another page.
Use category links to introduce a category of documents.
Autogenerated categories can use the [`_category_.yml`](./autogenerated.md#category-item-metadata) file to declare the link.
:::
#### Doc link {#category-doc-link}
A category can link to an existing document.
```js title="sidebars.js"
module.exports = {
docs: [
{
type: 'category',
label: 'Guides',
// highlight-start
link: {type: 'doc', id: 'introduction'},
// highlight-end
items: ['pages', 'docs', 'blog', 'search'],
},
],
};
```
See it in action on the [i18n introduction page](../../../i18n/i18n-introduction.md).
#### Generated index page {#generated-index-page}
You can auto-generate an index page that displays all the direct children of this category. The `slug` allows you to customize the generated page's route, which defaults to `/category/[categoryName]`.
@ -287,6 +268,27 @@ Use `generated-index` links as a quick way to get an introductory document.
:::
#### Doc link {#category-doc-link}
A category can link to an existing document.
```js title="sidebars.js"
module.exports = {
docs: [
{
type: 'category',
label: 'Guides',
// highlight-start
link: {type: 'doc', id: 'introduction'},
// highlight-end
items: ['pages', 'docs', 'blog', 'search'],
},
],
};
```
See it in action on the [i18n introduction page](../../../i18n/i18n-introduction.md).
#### Embedding generated index in doc page {#embedding-generated-index-in-doc-page}
You can embed the generated cards list in a normal doc page as well, as long as the doc is used as a category index page. To do so, you need to use the `DocCardList` component, paired with the `useCurrentSidebarCategory` hook.
@ -404,8 +406,10 @@ You can express typical sidebar items without much customization more concisely
An item with type `doc` can be simply a string representing its ID:
```mdx-code-block
<Tabs>
<TabItem value="Longhand">
```
```js title="sidebars.js"
module.exports = {
@ -420,8 +424,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
<TabItem value="Shorthand">
```
```js title="sidebars.js"
module.exports = {
@ -433,8 +439,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
</Tabs>
```
So it's possible to simplify the example above to:
@ -472,8 +480,10 @@ module.exports = {
A category item can be represented by an object whose key is its label, and the value is an array of subitems.
```mdx-code-block
<Tabs>
<TabItem value="Longhand">
```
```js title="sidebars.js"
module.exports = {
@ -489,8 +499,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
<TabItem value="Shorthand">
```
```js title="sidebars.js"
module.exports = {
@ -504,8 +516,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
</Tabs>
```
This permits us to simplify that example to:
@ -553,8 +567,10 @@ Note how the two consecutive category shorthands are compressed into one object
Wherever you have an array of items that is reduced to one category shorthand, you can omit that enclosing array as well.
```mdx-code-block
<Tabs>
<TabItem value="Before">
```
```js title="sidebars.js"
module.exports = {
@ -572,8 +588,10 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
<TabItem value="After">
```
```js title="sidebars.js"
module.exports = {
@ -587,5 +605,7 @@ module.exports = {
};
```
```mdx-code-block
</TabItem>
</Tabs>
```

View file

@ -1,16 +1,16 @@
---
id: versioning
title: Versioning
slug: /versioning
---
# Versioning
You can use the versioning CLI to create a new documentation version based on the latest content in the `docs` directory. That specific set of documentation will then be preserved and accessible even as the documentation in the `docs` directory continues to evolve.
```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```
You can use the version script to create a new documentation version based on the latest content in the `docs` directory. That specific set of documentation will then be preserved and accessible even as the documentation in the `docs` directory changes moving forward.
:::caution
Think about it before starting to version your documentation - it can become difficult for contributors to help improve it!
@ -102,8 +102,10 @@ When tagging a new version, the document versioning mechanism will:
1. Place the new file into the corresponding version folder.
2. Include the reference to the new file in the corresponding sidebar file according to the version number.
```mdx-code-block
<Tabs>
<TabItem value="Current version structure">
```
```bash
# The new file.
@ -113,8 +115,10 @@ docs/new.md
sidebars.js
```
```mdx-code-block
</TabItem>
<TabItem value="Older version structure">
```
```bash
# The new file.
@ -124,8 +128,10 @@ versioned_docs/version-1.0.0/new.md
versioned_sidebars/version-1.0.0-sidebars.json
```
```mdx-code-block
</TabItem>
</Tabs>
```
### Updating an existing version {#updating-an-existing-version}

View file

@ -1,10 +1,11 @@
---
id: admonitions
title: Admonitions
description: Handling admonitions/callouts in Docusaurus Markdown
slug: /markdown-features/admonitions
---
# Admonitions
import BrowserWindow from '@site/src/components/BrowserWindow';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -17,68 +18,70 @@ Example:
```md
:::note
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::tip
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::info
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::caution
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::danger
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
```
```mdx-code-block
<BrowserWindow>
:::note
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::tip
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::info
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::caution
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
:::danger
Some **content** with _markdown_ `syntax`. Check [this `api`](#).
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
</BrowserWindow>
```
## Usage with Prettier {#usage-with-prettier}
@ -109,20 +112,22 @@ You may also specify an optional title
```md
:::note Your Title
Some **content** with _markdown_ `syntax`.
Some **content** with _Markdown_ `syntax`.
:::
```
```mdx-code-block
<BrowserWindow>
:::note Your Title
Some **content** with _markdown_ `syntax`.
Some **content** with _Markdown_ `syntax`.
:::
</BrowserWindow>
```
## Admonitions with MDX {#admonitions-with-mdx}
@ -144,21 +149,21 @@ import TabItem from '@theme/TabItem';
:::
```
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
```mdx-code-block
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
<TabItem value="orange" label="Orange">This is an orange 🍊</TabItem>
<TabItem value="banana" label="Banana">This is a banana 🍌</TabItem>
</Tabs>
```
:::
</BrowserWindow>
```
## Usage in JSX {#usage-in-jsx}
@ -189,6 +194,7 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf
</Admonition>
```
```mdx-code-block
<BrowserWindow>
<Admonition type="tip" icon="💡" title="Did you know...">
<p>
@ -197,3 +203,4 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf
</p>
</Admonition>
</BrowserWindow>
```

View file

@ -1,10 +1,11 @@
---
id: assets
title: Assets
description: Handling assets in Docusaurus Markdown
slug: /markdown-features/assets
---
# Assets
import BrowserWindow from '@site/src/components/BrowserWindow';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -26,8 +27,10 @@ Let's imagine the following file structure:
You can display images in three different ways: Markdown syntax, CJS require, or ES imports syntax.
```mdx-code-block
<Tabs>
<TabItem value="Markdown syntax">
```
Display images using simple Markdown syntax:
@ -35,8 +38,10 @@ Display images using simple Markdown syntax:
![Example banner](./assets/docusaurus-asset-example-banner.png)
```
```mdx-code-block
</TabItem>
<TabItem value="CommonJS require">
```
Display images using inline CommonJS `require` in JSX image tag:
@ -47,8 +52,10 @@ Display images using inline CommonJS `require` in JSX image tag:
/>
```
```mdx-code-block
</TabItem>
<TabItem value="Import statement">
```
Display images using ES `import` syntax and JSX image tag:
@ -58,8 +65,10 @@ import myImageUrl from './assets/docusaurus-asset-example-banner.png';
<img src={myImageUrl} alt="Example banner" />;
```
```mdx-code-block
</TabItem>
</Tabs>
```
All of the above result in displaying the image:
@ -101,7 +110,7 @@ or
</BrowserWindow>
:::info markdown links are always file paths
:::info Markdown links are always file paths
If you use the Markdown image or link syntax, all asset paths will be resolved as file paths by Docusaurus and automatically converted to `require()` calls. You don't need to use `require()` in Markdown unless you use the JSX syntax, which you do have to handle yourself.

View file

@ -1,10 +1,11 @@
---
id: code-blocks
title: Code blocks
description: Handling code blocks in Docusaurus Markdown
slug: /markdown-features/code-blocks
---
# Code blocks
import BrowserWindow from '@site/src/components/BrowserWindow';
import CodeBlock from '@theme/CodeBlock';
@ -22,7 +23,9 @@ function HelloCodeTitle(props) {
```
````
```mdx-code-block
<BrowserWindow>
```
```jsx title="/src/components/HelloCodeTitle.js"
function HelloCodeTitle(props) {
@ -30,7 +33,9 @@ function HelloCodeTitle(props) {
}
```
```mdx-code-block
</BrowserWindow>
```
## Syntax highlighting {#syntax-highlighting}
@ -160,8 +165,9 @@ function HighlightMoreText(highlight) {
```
````
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
```js
function HighlightSomeText(highlight) {
@ -184,8 +190,9 @@ function HighlightMoreText(highlight) {
}
```
```mdx-code-block
</BrowserWindow>
````
```
Supported commenting syntax:
@ -234,8 +241,9 @@ export default MyComponent;
```
````
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
```jsx {1,4-6,11}
import React from 'react';
@ -251,8 +259,9 @@ function MyComponent(props) {
export default MyComponent;
```
```mdx-code-block
</BrowserWindow>
````
```
:::tip prefer comments
@ -346,8 +355,9 @@ console.log(name.toUpperCase());
</Tabs>
```
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
In JavaScript, trying to access properties on `null` will error.
@ -358,8 +368,9 @@ console.log(name.toUpperCase());
// Uncaught TypeError: Cannot read properties of null (reading 'toUpperCase')
```
```mdx-code-block
</BrowserWindow>
````
```
If you use number ranges in metastring (the `{1,3-4}` syntax), Docusaurus will apply the **first `magicComments` entry**'s class name. This, by default, is `theme-code-block-highlighted-line`, but if you change the `magicComments` config and use a different entry as the first one, the meaning of the metastring range will change as well.
@ -395,8 +406,9 @@ export default MyComponent;
```
````
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
```jsx {1,4-6,11} showLineNumbers
import React from 'react';
@ -412,8 +424,9 @@ function MyComponent(props) {
export default MyComponent;
```
```mdx-code-block
</BrowserWindow>
````
```
## Interactive code editor {#interactive-code-editor}
@ -442,7 +455,7 @@ To use the plugin, create a code block with `live` attached to the language meta
function Clock(props) {
const [date, setDate] = useState(new Date());
useEffect(() => {
var timerID = setInterval(() => tick(), 1000);
const timerID = setInterval(() => tick(), 1000);
return function cleanup() {
clearInterval(timerID);
@ -464,14 +477,15 @@ function Clock(props) {
The code block will be rendered as an interactive editor. Changes to the code will reflect on the result panel live.
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
```jsx live
function Clock(props) {
const [date, setDate] = useState(new Date());
useEffect(() => {
var timerID = setInterval(() => tick(), 1000);
const timerID = setInterval(() => tick(), 1000);
return function cleanup() {
clearInterval(timerID);
@ -490,8 +504,9 @@ function Clock(props) {
}
```
```mdx-code-block
</BrowserWindow>
````
```
### Imports {#imports}
@ -504,7 +519,7 @@ It is not possible to import components directly from the react-live code editor
By default, all React imports are available. If you need more imports available, swizzle the react-live scope:
```bash npm2yarn
npm run swizzle @docusaurus/theme-live-codeblock ReactLiveScope
npm run swizzle @docusaurus/theme-live-codeblock ReactLiveScope -- --eject
```
```jsx title="src/theme/ReactLiveScope/index.js"
@ -540,8 +555,9 @@ export default ReactLiveScope;
The `ButtonExample` component is now available to use:
````mdx-code-block
```mdx-code-block
<BrowserWindow>
```
```jsx live
function MyPlayground(props) {
@ -553,6 +569,43 @@ function MyPlayground(props) {
}
```
```mdx-code-block
</BrowserWindow>
```
### Imperative Rendering (noInline)
The `noInline` option should be used to avoid errors when your code spans multiple components or variables.
````md
```jsx live noInline
const project = 'Docusaurus';
const Greeting = () => <p>Hello {project}!</p>;
render(<Greeting />);
```
````
Unlike an ordinary interactive code block, when using `noInline` React Live won't wrap your code in an inline function to render it.
You will need to explicitly call `render()` at the end of your code to display the output.
````mdx-code-block
<BrowserWindow>
```jsx live noInline
const project = "Docusaurus";
const Greeting = () => (
<p>Hello {project}!</p>
);
render(
<Greeting />
);
```
</BrowserWindow>
````
@ -645,10 +698,11 @@ class HelloWorld {
And you will get the following:
````mdx-code-block
```mdx-code-block
<BrowserWindow>
<Tabs>
<TabItem value="js" label="JavaScript">
```
```js
function helloWorld() {
@ -656,16 +710,20 @@ function helloWorld() {
}
```
```mdx-code-block
</TabItem>
<TabItem value="py" label="Python">
```
```py
def hello_world():
print("Hello, world!")
```
```mdx-code-block
</TabItem>
<TabItem value="java" label="Java">
```
```java
class HelloWorld {
@ -675,10 +733,11 @@ class HelloWorld {
}
```
```mdx-code-block
</TabItem>
</Tabs>
</BrowserWindow>
````
```
If you have multiple of these multi-language code tabs, and you want to sync the selection across the tab instances, refer to the [Syncing tab choices section](markdown-features-tabs.mdx#syncing-tab-choices).
@ -754,6 +813,7 @@ export default function MyReactPage() {
}
```
```mdx-code-block
<BrowserWindow>
<CodeBlock
language="jsx"
@ -764,6 +824,7 @@ export default function MyReactPage() {
}`}
</CodeBlock>
</BrowserWindow>
```
The props accepted are `language`, `title` and `showLineNumbers`, in the same way as you write Markdown code blocks.

View file

@ -1,6 +1,5 @@
---
id: head-metadata
title: Head Metadata
description: Declaring page-specific head metadata through MDX
slug: /markdown-features/head-metadata
---

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