chore: prepare v2.0.0-rc.1 release (#7778)

This commit is contained in:
Sébastien Lorber 2022-07-14 18:17:25 +02:00 committed by GitHub
parent 443914a579
commit d255389e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
134 changed files with 1147 additions and 672 deletions

View file

@ -1,5 +1,53 @@
# Docusaurus 2 Changelog # Docusaurus 2 Changelog
## 2.0.0-rc.1 (2022-07-14)
#### :bug: Bug Fix
- `docusaurus`
- [#7776](https://github.com/facebook/docusaurus/pull/7776) fix(core): swizzle --eject js should not copy theme .d.ts files ([@slorber](https://github.com/slorber))
- [#7750](https://github.com/facebook/docusaurus/pull/7750) fix(deploy): revert "feat(deploy): copy local git config to tmp repo (#7702)" ([@ghostsquad](https://github.com/ghostsquad))
- `docusaurus-plugin-sitemap`
- [#7774](https://github.com/facebook/docusaurus/pull/7774) fix(sitemap): complete gracefully when all pages have noIndex meta ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-theme-classic`
- [#7771](https://github.com/facebook/docusaurus/pull/7771) chore: bump Infima to 0.2.0-alpha.42, fix a:hover link bug ([@slorber](https://github.com/slorber))
- [#7755](https://github.com/facebook/docusaurus/pull/7755) fix(theme-classic): validate options properly ([@Josh-Cena](https://github.com/Josh-Cena))
- [#7752](https://github.com/facebook/docusaurus/pull/7752) fix(theme-classic): fix Layout theme height CSS ([@LichLord91](https://github.com/LichLord91))
- `docusaurus-migrate`
- [#7766](https://github.com/facebook/docusaurus/pull/7766) fix(migrate): import siteConfig with file extension ([@Josh-Cena](https://github.com/Josh-Cena))
- `docusaurus-theme-search-algolia`
- [#7761](https://github.com/facebook/docusaurus/pull/7761) fix(algolia-search): test for canUseIntersectionObserver ([@RoiArthurB](https://github.com/RoiArthurB))
#### :nail_care: Polish
- `docusaurus-theme-translations`
- [#7762](https://github.com/facebook/docusaurus/pull/7762) chore(theme-translations): complete ko translations ([@anaclumos](https://github.com/anaclumos))
#### :memo: Documentation
- `docusaurus-plugin-content-docs`
- [#7706](https://github.com/facebook/docusaurus/pull/7706) docs: release process, versioning, breaking changes, public API surface ([@slorber](https://github.com/slorber))
#### :wrench: Maintenance
- `docusaurus-theme-classic`
- [#7777](https://github.com/facebook/docusaurus/pull/7777) refactor(theme): fix duplicate page metadata usage ([@slorber](https://github.com/slorber))
- [#7771](https://github.com/facebook/docusaurus/pull/7771) chore: bump Infima to 0.2.0-alpha.42, fix a:hover link bug ([@slorber](https://github.com/slorber))
#### Committers: 11
- Arthur Brugière ([@RoiArthurB](https://github.com/RoiArthurB))
- Bruce Song ([@recallwei](https://github.com/recallwei))
- Evan ([@DigiPie](https://github.com/DigiPie))
- Jeffrey Aven ([@jeffreyaven](https://github.com/jeffreyaven))
- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
- Sunghyun Cho ([@anaclumos](https://github.com/anaclumos))
- Sébastien Lorber ([@slorber](https://github.com/slorber))
- The Nguyen ([@treoden](https://github.com/treoden))
- Wes McNamee ([@ghostsquad](https://github.com/ghostsquad))
- [@LichLord91](https://github.com/LichLord91)
- 凱恩 Kane ([@Gary50613](https://github.com/Gary50613))
## 2.0.0-beta.22 (2022-07-08) ## 2.0.0-beta.22 (2022-07-08)
#### :boom: Breaking Change #### :boom: Breaking Change

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{ {
"name": "@docusaurus/mdx-loader", "name": "@docusaurus/mdx-loader",
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"description": "Docusaurus Loader for MDX", "description": "Docusaurus Loader for MDX",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
@ -20,8 +20,8 @@
"dependencies": { "dependencies": {
"@babel/parser": "^7.18.8", "@babel/parser": "^7.18.8",
"@babel/traverse": "^7.18.8", "@babel/traverse": "^7.18.8",
"@docusaurus/logger": "2.0.0-beta.22", "@docusaurus/logger": "2.0.0-rc.1",
"@docusaurus/utils": "2.0.0-beta.22", "@docusaurus/utils": "2.0.0-rc.1",
"@mdx-js/mdx": "^1.6.22", "@mdx-js/mdx": "^1.6.22",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
@ -37,7 +37,7 @@
"webpack": "^5.73.0" "webpack": "^5.73.0"
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/types": "2.0.0-beta.22", "@docusaurus/types": "2.0.0-rc.1",
"@types/escape-html": "^1.0.2", "@types/escape-html": "^1.0.2",
"@types/mdast": "^3.0.10", "@types/mdast": "^3.0.10",
"@types/stringify-object": "^3.3.1", "@types/stringify-object": "^3.3.1",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,14 +21,14 @@ const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(
5, 5,
); );
// This probably only makes sense for the beta phase, temporary // This probably only makes sense for the alpha/beta/rc phase, temporary
function getNextBetaVersionName() { function getNextVersionName() {
const expectedPrefix = '2.0.0-beta.'; const expectedPrefix = '2.0.0-rc.';
const lastReleasedVersion = versions[0]; const lastReleasedVersion = versions[0];
if (!lastReleasedVersion || !lastReleasedVersion.includes(expectedPrefix)) { if (!lastReleasedVersion || !lastReleasedVersion.includes(expectedPrefix)) {
throw new Error( throw new Error(
'this code is only meant to be used during the 2.0 beta phase.', 'this code is only meant to be used during the 2.0 alpha/beta/rc phase.',
); );
} }
const version = parseInt(lastReleasedVersion.replace(expectedPrefix, ''), 10); const version = parseInt(lastReleasedVersion.replace(expectedPrefix, ''), 10);
@ -310,7 +310,7 @@ const config = {
})(), })(),
versions: { versions: {
current: { current: {
label: `${getNextBetaVersionName()} 🚧`, label: `${getNextVersionName()} 🚧`,
}, },
}, },
}, },

View file

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

View file

@ -1,20 +0,0 @@
---
sidebar_position: 2
id: theme-classic
title: '📦 theme-classic'
slug: '/api/themes/@docusaurus/theme-classic'
---
The classic theme for Docusaurus.
You can refer to the [theme configuration page](theme-configuration.md) for more details on the configuration.
```bash npm2yarn
npm install --save @docusaurus/theme-classic
```
:::tip
If you have installed `@docusaurus/preset-classic`, you don't need to install it as a dependency.
:::

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 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. - 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> <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: 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 **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? :::info SSR or SSG?
_Server-side rendering_ and _static site generation_ can be different concepts, but we use them interchangeably. _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. 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. 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"> <details id="node-env">
<summary>What about <code>process.env.NODE_ENV</code>?</summary> <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: 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'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
```mdx-code-block
<Tabs> <Tabs>
<TabItem value="Development"> <TabItem value="Development">
```
```diff ```diff
import React from 'react'; import React from 'react';
@ -72,8 +77,10 @@ export default function expensiveComp() {
} }
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="Production"> <TabItem value="Production">
```
```diff ```diff
import React from 'react'; import React from 'react';
@ -88,9 +95,11 @@ export default function expensiveComp() {
} }
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
</details> </details>
```
## Understanding SSR {#understanding-ssr} ## Understanding SSR {#understanding-ssr}

View file

@ -1,6 +1,5 @@
--- ---
sidebar_position: 0 sidebar_position: 0
id: docusaurus.config.js
description: API reference for Docusaurus configuration file. description: API reference for Docusaurus configuration file.
slug: /api/docusaurus-config slug: /api/docusaurus-config
--- ---
@ -64,7 +63,7 @@ module.exports = {
- Type: `string` - 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" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
@ -76,7 +75,7 @@ module.exports = {
- Type: `string` - 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" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
@ -131,18 +130,21 @@ module.exports = {
i18n: { i18n: {
defaultLocale: 'en', defaultLocale: 'en',
locales: ['en', 'fa'], locales: ['en', 'fa'],
path: 'i18n',
localeConfigs: { localeConfigs: {
en: { en: {
label: 'English', label: 'English',
direction: 'ltr', direction: 'ltr',
htmlLang: 'en-US', htmlLang: 'en-US',
calendar: 'gregory', calendar: 'gregory',
path: 'en',
}, },
fa: { fa: {
label: 'فارسی', label: 'فارسی',
direction: 'rtl', direction: 'rtl',
htmlLang: 'fa-IR', htmlLang: 'fa-IR',
calendar: 'persian', 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 - `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`. - `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. - `localeConfigs`: Individual options for each locale.
- `label`: The label displayed for this locale in the locales dropdown. - `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 Farsi, 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="...">` - `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`). - `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} ### `noIndex` {#noIndex}
@ -173,7 +177,7 @@ module.exports = {
### `onBrokenLinks` {#onBrokenLinks} ### `onBrokenLinks` {#onBrokenLinks}
- Type: `'ignore' | 'log' | 'warn' | 'error' | 'throw'` - Type: `'ignore' | 'log' | 'warn' | 'throw'`
The behavior of Docusaurus when it detects any broken link. 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} ### `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} ### `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). The behavior of Docusaurus when it detects any [duplicate routes](/guides/creating-pages.md#duplicate-routes).
@ -330,8 +334,9 @@ module.exports = {
// ... other links // ... other links
], ],
logo: { logo: {
alt: 'Facebook Open Source Logo', alt: 'Meta Open Source Logo',
src: 'https://docusaurus.io/img/oss_logo.png', src: 'img/meta_oss_logo.png',
href: 'https://opensource.fb.com',
width: 160, width: 160,
height: 51, height: 51,
}, },
@ -426,7 +431,7 @@ module.exports = {
### `scripts` {#scripts} ### `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. 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} ### `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)[]` - 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} ### `clientModules` {#clientModules}
An array of [client modules](../advanced/client.md#client-modules) to load globally on your site. 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` - Type: `boolean`

View file

@ -1,9 +1,10 @@
--- ---
sidebar_position: 0 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. A scaffolding utility to help you instantly set up a functional Docusaurus app.
## Usage {#usage} ## Usage {#usage}

View file

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

View file

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Before After
Before After

View file

@ -1,9 +1,10 @@
--- ---
sidebar_position: 2 sidebar_position: 2
title: '📦 logger' slug: /api/misc/@docusaurus/logger
slug: '/api/misc/@docusaurus/logger'
--- ---
# 📦 logger
An encapsulated logger for semantically formatting console messages. 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. 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. - `warn`: prints a warning that should be payed attention to.
- `error`: prints an error (not necessarily halting the program) that signals significant problems. - `error`: prints an error (not necessarily halting the program) that signals significant problems.
- `success`: prints a success message. - `success`: prints a success message.
- The `report` function. It takes a `ReportingSeverity` value (`ignore`, `log`, `warn`, `throw`) and reports a message according to the severity.
:::caution A word on the `error` formatter :::caution A word on the `error` formatter

View file

@ -103,7 +103,7 @@ module.exports = function (context, options) {
Themes using the `<Translate>` API can provide default code translation messages. 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: 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[]` - `getStyleLoaders(isServer: boolean, cssOptions: {[key: string]: any}): Loader[]`
- `getJSLoader(isServer: boolean, cacheOptions?: {}): Loader | null` - `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. For example, this plugin below modify the webpack config to transpile `.foo` files.

View file

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

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 4 sidebar_position: 4
id: plugin-client-redirects slug: /api/plugins/@docusaurus/plugin-client-redirects
title: '📦 plugin-client-redirects'
slug: '/api/plugins/@docusaurus/plugin-client-redirects'
--- ---
# 📦 plugin-client-redirects
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
Docusaurus Plugin to generate **client-side redirects**. Docusaurus Plugin to generate **client-side redirects**.
@ -35,16 +35,26 @@ npm install --save @docusaurus/plugin-client-redirects
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Option | Type | Default | Description | | Option | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `fromExtensions` | `string[]` | `[]` | The extensions to be removed from the route after redirecting. | | `fromExtensions` | `string[]` | `[]` | The extensions to be removed from the route after redirecting. |
| `toExtensions` | `string[]` | `[]` | The extensions to be appended to the route after redirecting. | | `toExtensions` | `string[]` | `[]` | The extensions to be appended to the route after redirecting. |
| `redirects` | <code><a href="#RedirectRule">RedirectRule</a>[]</code> | `[]` | The list of redirect rules. | | `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. | | `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> </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} ### Types {#types}
@ -57,9 +67,20 @@ type RedirectRule = {
}; };
``` ```
:::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} #### `CreateRedirectsFn` {#CreateRedirectsFn}
```ts ```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; type CreateRedirectsFn = (path: string) => string[] | string | null | undefined;
``` ```

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 2 sidebar_position: 2
id: plugin-content-blog slug: /api/plugins/@docusaurus/plugin-content-blog
title: '📦 plugin-content-blog'
slug: '/api/plugins/@docusaurus/plugin-content-blog'
--- ---
# 📦 plugin-content-blog
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
Provides the [Blog](blog.mdx) feature and is the default blog plugin for Docusaurus. Provides the [Blog](blog.mdx) feature and is the default blog plugin for Docusaurus.
@ -33,7 +33,9 @@ You can configure this plugin through the [preset options](#ex-config-preset).
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -71,7 +73,9 @@ Accepted fields:
| `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. | | `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. | | `sortPosts` | <code>'descending' \| 'ascending' </code> | `'descending'` | Governs the direction of blog post sorting. |
```mdx-code-block
</APITable> </APITable>
```
### Types {#types} ### Types {#types}
@ -174,7 +178,9 @@ Markdown documents can use the following Markdown front matter metadata fields,
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -193,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. | | `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. | | `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. | | `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> </APITable>
```
```ts ```ts
type Tag = string | {label: string; permalink: string}; type Tag = string | {label: string; permalink: string};

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 1 sidebar_position: 1
id: plugin-content-docs slug: /api/plugins/@docusaurus/plugin-content-docs
title: '📦 plugin-content-docs'
slug: '/api/plugins/@docusaurus/plugin-content-docs'
--- ---
# 📦 plugin-content-docs
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
Provides the [Docs](../../guides/docs/docs-introduction.md) functionality and is the default docs plugin for Docusaurus. Provides the [Docs](../../guides/docs/docs-introduction.md) functionality and is the default docs plugin for Docusaurus.
@ -27,7 +27,9 @@ You can configure this plugin through the preset options.
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -62,7 +64,9 @@ Accepted fields:
| `onlyIncludeVersions` | `string[]` | All versions available | Only include a subset of all available versions. | | `onlyIncludeVersions` | `string[]` | All versions available | Only include a subset of all available versions. |
| `versions` | <a href="#VersionsConfig"><code>VersionsConfig</code></a> | `{}` | 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> </APITable>
```
### Types {#types} ### Types {#types}
@ -257,16 +261,19 @@ Markdown documents can use the following Markdown front matter metadata fields,
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | 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. | | `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. | | `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_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_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_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_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. | | `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. | | `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. |
@ -278,16 +285,23 @@ Accepted fields:
| `keywords` | `string[]` | `undefined` | Keywords meta tag for the document page, for search engines. | | `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. | | `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. | | `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. | | `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. | | `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> </APITable>
```
```ts ```ts
type Tag = string | {label: string; permalink: string}; type Tag = string | {label: string; permalink: string};
``` ```
```ts
type FileChange = {date: string; author: string};
```
Example: Example:
```md ```md
@ -306,6 +320,9 @@ keywords:
- docusaurus - docusaurus
image: https://i.imgur.com/mErPwqL.png image: https://i.imgur.com/mErPwqL.png
slug: /myDoc slug: /myDoc
last_update:
date: 1/1/2000
author: custom author name
--- ---
# Markdown Features # Markdown Features

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 3 sidebar_position: 3
id: plugin-content-pages slug: /api/plugins/@docusaurus/plugin-content-pages
title: '📦 plugin-content-pages'
slug: '/api/plugins/@docusaurus/plugin-content-pages'
--- ---
# 📦 plugin-content-pages
import APITable from '@site/src/components/APITable'; 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. 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: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -41,7 +43,9 @@ Accepted fields:
| `beforeDefaultRemarkPlugins` | `any[]` | `[]` | Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins. | | `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. | | `beforeDefaultRehypePlugins` | `any[]` | `[]` | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. |
```mdx-code-block
</APITable> </APITable>
```
### Example configuration {#ex-config} ### Example configuration {#ex-config}

View file

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

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 6 sidebar_position: 6
id: plugin-google-analytics slug: /api/plugins/@docusaurus/plugin-google-analytics
title: '📦 plugin-google-analytics'
slug: '/api/plugins/@docusaurus/plugin-google-analytics'
--- ---
# 📦 plugin-google-analytics
import APITable from '@site/src/components/APITable'; 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. 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: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `trackingID` | `string` | **Required** | The tracking ID of your analytics service. | | `trackingID` | `string` | **Required** | The tracking ID of your analytics service. |
| `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. | | `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. |
```mdx-code-block
</APITable> </APITable>
```
### Example configuration {#ex-config} ### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 7 sidebar_position: 7
id: plugin-google-gtag slug: /api/plugins/@docusaurus/plugin-google-gtag
title: '📦 plugin-google-gtag'
slug: '/api/plugins/@docusaurus/plugin-google-gtag'
--- ---
# 📦 plugin-google-gtag
import APITable from '@site/src/components/APITable'; 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. 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: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `trackingID` | `string` | **Required** | The tracking ID of your gtag service. | | `trackingID` | `string` | **Required** | The tracking ID of your gtag service. |
| `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. | | `anonymizeIP` | `boolean` | `false` | Whether the IP should be anonymized when sending requests. |
```mdx-code-block
</APITable> </APITable>
```
### Example configuration {#ex-config} ### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 8 sidebar_position: 8
id: plugin-ideal-image slug: /api/plugins/@docusaurus/plugin-ideal-image
title: '📦 plugin-ideal-image'
slug: '/api/plugins/@docusaurus/plugin-ideal-image'
--- ---
# 📦 plugin-ideal-image
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder). 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: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Option | Type | Default | Description | | Option | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -53,7 +55,9 @@ Accepted fields:
| `quality` | `number` | `85` | JPEG compression quality | | `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. | | `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> </APITable>
```
### Example configuration {#ex-config} ### Example configuration {#ex-config}

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 9 sidebar_position: 9
id: plugin-pwa slug: /api/plugins/@docusaurus/plugin-pwa
title: '📦 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. 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} ## Installation {#installation}
@ -70,7 +70,7 @@ If your browser supports it, you should be able to install a Docusaurus site as
:::note :::note
App installation requires the https protocol and a valid manifest. App installation requires the HTTPS protocol and a valid manifest.
::: :::
@ -120,7 +120,7 @@ Strategies used to turn the offline mode on:
- `appInstalled`: activates for users having installed the site as an app (not 100% reliable) - `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) - `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) - `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` - `saveData`: activates for users with `navigator.connection.saveData === true`
- `always`: activates for all users - `always`: activates for all users
@ -160,7 +160,7 @@ module.exports = {
modifyURLPrefix: { 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 // You can add more files according to your needs
globPatterns: ['**/*.{pdf,docx,xlsx}'], globPatterns: ['**/*.{pdf,docx,xlsx}'],
// ... // ...

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 10 sidebar_position: 10
id: plugin-sitemap slug: /api/plugins/@docusaurus/plugin-sitemap
title: '📦 plugin-sitemap'
slug: '/api/plugins/@docusaurus/plugin-sitemap'
--- ---
# 📦 plugin-sitemap
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
This plugin creates sitemaps for your site so that search engine crawlers can crawl your site more accurately. This plugin creates sitemaps for your site so that search engine crawlers can crawl your site more accurately.
@ -33,7 +33,9 @@ You can configure this plugin through the [preset options](#ex-config-preset).
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -42,7 +44,9 @@ Accepted fields:
| `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. | | `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. | | `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> </APITable>
```
:::info :::info

View file

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

View file

@ -0,0 +1,61 @@
---
sidebar_position: 2
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.
```bash npm2yarn
npm install --save @docusaurus/theme-classic
```
:::tip
If you have installed `@docusaurus/preset-classic`, you don't need to install it as a dependency.
:::
## Configuration {#configuration}
Accepted fields:
```mdx-code-block
<APITable>
```
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `customCss` | <code>string[] \| string</code> | `[]` | Stylesheets to be imported globally as [client modules](../../advanced/client.md#client-modules). Relative paths are resolved against the site directory. |
```mdx-code-block
</APITable>
```
:::note
Most configuration for the theme is done in `themeConfig`, which can be found in [theme configuration](./theme-configuration.md).
:::
### Example configuration {#ex-config}
You can configure this theme through preset options or plugin options.
:::tip
Most Docusaurus users configure this plugin through the preset options.
:::
```js config-tabs
// Preset Options: theme
// Plugin Options: @docusaurus/theme-classic
const config = {
customCss: require.resolve('./src/css/custom.css'),
};
```

View file

@ -1,12 +1,12 @@
--- ---
sidebar_position: 1 sidebar_position: 1
id: theme-configuration sidebar_label: Configuration
title: 'Theme configuration' slug: /api/themes/configuration
sidebar_label: 'Configuration'
slug: '/api/themes/configuration'
toc_max_heading_level: 4 toc_max_heading_level: 4
--- ---
# Theme configuration
import APITable from '@site/src/components/APITable'; import APITable from '@site/src/components/APITable';
This configuration applies to all [main themes](./overview.md). 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: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | 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. | | `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`. | | `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> </APITable>
```
Example configuration: Example configuration:
@ -61,13 +65,17 @@ You can configure a default image that will be used for your meta tag, in partic
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | 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. | | `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> </APITable>
```
Example configuration: Example configuration:
@ -82,17 +90,21 @@ module.exports = {
### Metadata {#metadata} ### Metadata {#metadata}
You can configure additional html metadata (and override existing ones). You can configure additional HTML metadata (and override existing ones).
Accepted fields: Accepted fields:
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | 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. | | `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> </APITable>
```
Example configuration: Example configuration:
@ -111,7 +123,9 @@ Sometimes you want to announce something in your website. Just for such a case,
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="announcement-bar"> <APITable name="announcement-bar">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -121,7 +135,9 @@ Accepted fields:
| `textColor` | `string` | `'#000'` | Announcement text color. | | `textColor` | `string` | `'#000'` | Announcement text color. |
| `isCloseable` | `boolean` | `true` | Whether this announcement can be dismissed with a '×' button. | | `isCloseable` | `boolean` | `true` | Whether this announcement can be dismissed with a '×' button. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -146,7 +162,9 @@ module.exports = {
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-overview"> <APITable name="navbar-overview">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -156,7 +174,9 @@ Accepted fields:
| `hideOnScroll` | `boolean` | `false` | Whether the navbar is hidden when the user scrolls down. | | `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. | | `style` | <code>'primary' \| 'dark'</code> | Same as theme | Sets the navbar style, ignoring the dark/light theme. |
```mdx-code-block
</APITable> </APITable>
```
### Navbar logo {#navbar-logo} ### 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: Accepted fields:
```mdx-code-block
<APITable name="navbar-logo"> <APITable name="navbar-logo">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -177,8 +199,12 @@ Accepted fields:
| `width` | <code>string \| number</code> | `undefined` | Specifies the `width` attribute. | | `width` | <code>string \| number</code> | `undefined` | Specifies the `width` attribute. |
| `height` | <code>string \| number</code> | `undefined` | Specifies the `height` 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. | | `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> </APITable>
```
Example configuration: Example configuration:
@ -196,6 +222,8 @@ module.exports = {
target: '_self', target: '_self',
width: 32, width: 32,
height: 32, height: 32,
className: 'custom-navbar-logo-class',
style: {border: 'solid red'},
}, },
// highlight-end // highlight-end
}, },
@ -253,7 +281,9 @@ Outbound (external) links automatically get `target="_blank" rel="noopener noref
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-link"> <APITable name="navbar-link">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -268,7 +298,9 @@ Accepted fields:
| `activeBaseRegex` | `string` | `undefined` | Alternative to `activeBasePath` if required. | | `activeBaseRegex` | `string` | `undefined` | Alternative to `activeBasePath` if required. |
| `className` | `string` | `''` | Custom CSS class (for styling any item). | | `className` | `string` | `''` | Custom CSS class (for styling any item). |
```mdx-code-block
</APITable> </APITable>
```
:::note :::note
@ -318,7 +350,9 @@ Note that the dropdown base item is a clickable link as well, so this item can r
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-dropdown"> <APITable name="navbar-dropdown">
```
| Name | Type | Default | Description | | 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. | | `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. | | `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -367,7 +403,9 @@ If you want to link to a specific doc, this special navbar item type will render
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-doc-link"> <APITable name="navbar-doc-link">
```
| Name | Type | Default | Description | | 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. | | `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. | | `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc belongs to. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: 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: Accepted fields:
```mdx-code-block
<APITable name="navbar-doc-sidebar"> <APITable name="navbar-doc-sidebar">
```
| Name | Type | Default | Description | | 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. | | `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. | | `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the sidebar belongs to. |
```mdx-code-block
</APITable> </APITable>
```
:::tip :::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. 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: Accepted fields:
```mdx-code-block
<APITable name="navbar-docs-version-dropdown"> <APITable name="navbar-docs-version-dropdown">
```
| Name | Type | Default | Description | | 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. | | `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. | | `dropdownActiveClassDisabled` | `boolean` | `false` | Do not add the link active class when browsing docs. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -513,7 +561,9 @@ If you use docs with versioning, this special navbar item type will link to the
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-docs-version"> <APITable name="navbar-docs-version">
```
| Name | Type | Default | Description | | 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. | | `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. | | `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc versioning belongs to. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -554,7 +606,9 @@ The user will be able to switch from one locale to another, while staying on the
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="navbar-locale-dropdown"> <APITable name="navbar-locale-dropdown">
```
| Name | Type | Default | Description | | 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. | | `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. | | `dropdownItemsAfter` | <code>[LinkLikeItem](#navbar-dropdown)[]</code> | `[]` | Add additional dropdown items at the end of the dropdown. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -596,7 +652,9 @@ 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. However, with this special navbar item type, you can change the default location.
```mdx-code-block
<APITable name="navbar-search"> <APITable name="navbar-search">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -604,7 +662,9 @@ However, with this special navbar item type, you can change the default location
| `position` | <code>'left' \| 'right'</code> | `'left'` | The side of the navbar this item should appear on. | | `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. | | `className` | `string` | / | Custom CSS class for this navbar item. |
```mdx-code-block
</APITable> </APITable>
```
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
@ -627,7 +687,9 @@ module.exports = {
You can also render your own HTML markup inside a navbar item using this navbar item type. You can also render your own HTML markup inside a navbar item using this navbar item type.
```mdx-code-block
<APITable name="navbar-html"> <APITable name="navbar-html">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -636,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. | | `className` | `string` | `''` | Custom CSS class for this navbar item. |
| `value` | `string` | `''` | Custom HTML to be rendered inside this navbar item. | | `value` | `string` | `''` | Custom HTML to be rendered inside this navbar item. |
```mdx-code-block
</APITable> </APITable>
```
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { module.exports = {
@ -694,7 +758,9 @@ Docusaurus uses [Prism React Renderer](https://github.com/FormidableLabs/prism-r
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="codeblock"> <APITable name="codeblock">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -703,7 +769,9 @@ Accepted fields:
| `defaultLanguage` | `string` | `undefined` | The side of the navbar this item should appear on. | | `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). | | `magicComments` | `MagicCommentConfig[]` | _see below_ | The list of [magic comments](../../guides/markdown-features/markdown-features-code-blocks.mdx#custom-magic-comments). |
```mdx-code-block
</APITable> </APITable>
```
```ts ```ts
type MagicCommentConfig = { type MagicCommentConfig = {
@ -771,7 +839,9 @@ You can add logo and a copyright to the footer via `themeConfig.footer`. Logo ca
Accepted fields: Accepted fields:
```mdx-code-block
<APITable name="footer"> <APITable name="footer">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@ -780,7 +850,9 @@ Accepted fields:
| `style` | <code>'dark' \| 'light'</code> | `'light'` | The color theme of the footer component. | | `style` | <code>'dark' \| 'light'</code> | `'light'` | The color theme of the footer component. |
| `links` | <code>(Column \| FooterLink)[]</code> | `[]` | The link groups to be present. | | `links` | <code>(Column \| FooterLink)[]</code> | `[]` | The link groups to be present. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:
@ -790,9 +862,9 @@ module.exports = {
// highlight-start // highlight-start
footer: { footer: {
logo: { logo: {
alt: 'Facebook Open Source Logo', alt: 'Meta Open Source Logo',
src: 'img/oss_logo.png', src: 'img/meta_oss_logo.png',
href: 'https://opensource.facebook.com', href: 'https://opensource.fb.com',
width: 160, width: 160,
height: 51, height: 51,
}, },
@ -809,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. Multi-column footer links have a `title` and a list of `FooterItem`s for each column.
```mdx-code-block
<APITable name="footer-links"> <APITable name="footer-links">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `title` | `string` | `undefined` | Label of the section of these links. | | `title` | `string` | `undefined` | Label of the section of these links. |
| `items` | `FooterItem[]` | `[]` | Links in this section. | | `items` | `FooterItem[]` | `[]` | Links in this section. |
```mdx-code-block
</APITable> </APITable>
```
Accepted fields of each `FooterItem`: Accepted fields of each `FooterItem`:
```mdx-code-block
<APITable name="footer-items"> <APITable name="footer-items">
```
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `label` | `string` | **Required** | Text to be displayed for this link. | | `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. | | `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.** | | `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> </APITable>
```
Example multi-column configuration: Example multi-column configuration:
@ -919,14 +999,18 @@ module.exports = {
You can adjust the default table of contents via `themeConfig.tableOfContents`. You can adjust the default table of contents via `themeConfig.tableOfContents`.
```mdx-code-block
<APITable> <APITable>
```
| Name | Type | Default | Description | | 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. | | `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. | | `maxHeadingLevel` | `number` | `3` | Max heading level displayed in the TOC. Should be an integer between 2 and 6. |
```mdx-code-block
</APITable> </APITable>
```
Example configuration: Example configuration:

View file

@ -1,10 +1,10 @@
--- ---
sidebar_position: 3 sidebar_position: 3
id: theme-live-codeblock slug: /api/themes/@docusaurus/theme-live-codeblock
title: '📦 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. 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 ```bash npm2yarn

View file

@ -1,17 +1,17 @@
--- ---
sidebar_position: 4 sidebar_position: 4
id: theme-search-algolia slug: /api/themes/@docusaurus/theme-search-algolia
title: '📦 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. 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 ```bash npm2yarn
npm install --save @docusaurus/theme-search-algolia 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 :::tip

View file

@ -1,12 +1,13 @@
--- ---
id: blog description: Deploy a full-featured blog in no time with Docusaurus.
title: Blog
--- ---
# Blog
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; 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 :::info
@ -69,7 +70,7 @@ This is my first post on Docusaurus 2.
A whole bunch of exploration to follow. 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} ## 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: Blog post authors can be declared directly inside the front matter:
````mdx-code-block ```mdx-code-block
<Tabs groupId="author-front-matter"> <Tabs groupId="author-front-matter">
<TabItem value="single" label="Single author"> <TabItem value="single" label="Single author">
```
```md title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
@ -206,8 +208,10 @@ authors:
--- ---
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="multiple" label="Multiple authors"> <TabItem value="multiple" label="Multiple authors">
```
```md title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
@ -224,9 +228,10 @@ authors:
--- ---
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
```` ```
:::tip :::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: 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"> <Tabs groupId="author-front-matter">
<TabItem value="single" label="Single author"> <TabItem value="single" label="Single author">
```
```md title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
@ -288,8 +294,10 @@ authors: jmarcey
--- ---
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="multiple" label="Multiple authors"> <TabItem value="multiple" label="Multiple authors">
```
```md title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
@ -297,9 +305,10 @@ authors: [jmarcey, slorber]
--- ---
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
```` ```
:::info :::info
@ -393,9 +402,10 @@ The default reading time is able to accept additional options: `wordsPerMinute`
Use the callback for all your customization needs: Use the callback for all your customization needs:
````mdx-code-block ```mdx-code-block
<Tabs> <Tabs>
<TabItem value="disable-per-post" label="Per-post disabling"> <TabItem value="disable-per-post" label="Per-post disabling">
```
**Disable reading time on one page:** **Disable reading time on one page:**
@ -409,7 +419,9 @@ module.exports = {
showReadingTime: true, showReadingTime: true,
// highlight-start // highlight-start
readingTime: ({content, frontMatter, defaultReadingTime}) => readingTime: ({content, frontMatter, defaultReadingTime}) =>
frontMatter.hide_reading_time ? undefined : defaultReadingTime({content}), frontMatter.hide_reading_time
? undefined
: defaultReadingTime({content}),
// highlight-end // highlight-end
}, },
}, },
@ -428,8 +440,10 @@ hide_reading_time: true
This page will no longer display the reading time stats! This page will no longer display the reading time stats!
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="passing-options" label="Passing options"> <TabItem value="passing-options" label="Passing options">
```
**Pass options to the default reading time function:** **Pass options to the default reading time function:**
@ -451,8 +465,10 @@ module.exports = {
}; };
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="using-custom-algo" label="Using custom algorithms"> <TabItem value="using-custom-algo" label="Using custom algorithms">
```
**Use a custom implementation of reading time:** **Use a custom implementation of reading time:**
@ -474,9 +490,10 @@ module.exports = {
}; };
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </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. 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" ```js title="docusaurus.config.js"
module.exports = { module.exports = {

View file

@ -1,8 +1,9 @@
--- ---
id: browser-support description: How to keep a reasonable bundle size while ensuring sufficient browser support.
title: Browser support
--- ---
# Browser support
Docusaurus allows sites to define the list of supported browsers through a [browserslist configuration](https://github.com/browserslist/browserslist). Docusaurus allows sites to define the list of supported browsers through a [browserslist configuration](https://github.com/browserslist/browserslist).
## Purpose {#purpose} ## Purpose {#purpose}
@ -70,7 +71,7 @@ And browsers used in development are:
- The latest version of Chrome _or_ Firefox _or_ Safari. - 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 ```bash
npx browserslist --env="production" 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 # CLI
@ -41,7 +41,7 @@ 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`. | | `--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). | | `--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. | | `--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). | | `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). |
| `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. | | `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. |
@ -87,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). | | `--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. | | `--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. | | `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. |
:::info :::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.** 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} ### `docusaurus swizzle [themeName] [componentName] [siteDir]` {#docusaurus-swizzle}
@ -137,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. | | `--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. | | `--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} ### `docusaurus serve [siteDir]` {#docusaurus-serve-sitedir}
@ -148,7 +150,7 @@ Serve your built website locally.
| `--port` | `3000` | Use specified port | | `--port` | `3000` | Use specified port |
| `--dir` | `build` | The full path for the output directory, relative to the current workspace | | `--dir` | `build` | The full path for the output directory, relative to the current workspace |
| `--build` | `false` | Build website before serving | | `--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`. | | `--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. | | `--no-open` | `false` locally, `true` in CI | Do not open a browser window to the server location. |
@ -168,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 | | `--locale` | `<defaultLocale>` | Define which locale folder you want to write translations the JSON files in |
| `--override` | `false` | Override existing translation messages | | `--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 | | `--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} ### `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 | | Name | Default | Description |
| --- | --- | --- | | --- | --- | --- |

View file

@ -1,8 +1,9 @@
--- ---
id: configuration description: Configuring your site's behavior through docusaurus.config.js and more.
title: Configuration
--- ---
# Configuration
import TOCInline from '@theme/TOCInline'; 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. 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 description: Deploy your Docusaurus app for production on a range of static site hosting services.
title: Deployment
--- ---
# Deployment
To build the static files of your website for production, run: To build the static files of your website for production, run:
```bash npm2yarn ```bash npm2yarn
@ -182,8 +183,8 @@ Some Docusaurus sites put the `docs` folder outside of `website` (most likely fo
```bash ```bash
repo # git root repo # git root
├── docs # md files ├── docs # MD files
└── website # docusaurus root └── 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/): 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: Finally, to deploy your site to GitHub Pages, run:
````mdx-code-block ```mdx-code-block
<Tabs> <Tabs>
<TabItem value="bash" label="Bash"> <TabItem value="bash" label="Bash">
```
```bash ```bash
GIT_USER=<GITHUB_USERNAME> yarn deploy GIT_USER=<GITHUB_USERNAME> yarn deploy
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="windows" label="Windows"> <TabItem value="windows" label="Windows">
```
```batch ```batch
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy" cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
``` ```
````mdx-code-block
</TabItem> </TabItem>
<TabItem value="powershell" label="PowerShell"> <TabItem value="powershell" label="PowerShell">
```mdx-code-block
```powershell ```powershell
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy' cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
``` ````
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
```` ```
:::caution :::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. - Source repo and deployment repo are the **same** repository.
- The deployment repo is a **remote** repository, different from the source. - The deployment repo is a **remote** repository, different from the source.
````mdx-code-block ```mdx-code-block
<Tabs> <Tabs>
<TabItem value="same" label="Same"> <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. 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). 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> <details>
<summary>GitHub action files</summary> <summary>GitHub action files</summary>
Add these two workflow files: Add these two workflow files:
:::warning Tweak the parameters for your setup :::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. 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/checkout@v2
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 18
cache: yarn cache: yarn
- name: Install dependencies - name: Install dependencies
@ -434,7 +441,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 18
cache: yarn cache: yarn
- name: Install dependencies - name: Install dependencies
@ -445,17 +452,20 @@ jobs:
</details> </details>
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="remote" label="Remote"> <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. 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/). 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. 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`. 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> <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. 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/checkout@v2
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 18
cache: yarn cache: yarn
- name: Install dependencies - name: Install dependencies
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
@ -499,7 +509,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 18
cache: yarn cache: yarn
- uses: webfactory/ssh-agent@v0.5.0 - uses: webfactory/ssh-agent@v0.5.0
with: with:
@ -516,9 +526,24 @@ jobs:
</details> </details>
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </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} ### 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" ```yml title=".travis.yml"
language: node_js language: node_js
node_js: node_js:
- '14.15.0' - 18
branches: branches:
only: only:
- main - 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} ### 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. 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. 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" ```yml title="azure-pipelines.yml"
trigger: trigger:
@ -592,7 +617,7 @@ steps:
- task: NodeTool@0 - task: NodeTool@0
inputs: inputs:
versionSpec: 14.x versionSpec: '18'
displayName: Install Node.js displayName: Install Node.js
- script: | - script: |
@ -611,8 +636,8 @@ steps:
### Using Drone {#using-drone} ### 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. 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). 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. 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`. 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. 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.

View file

@ -1,9 +1,9 @@
--- ---
id: docusaurus-core
title: Docusaurus Client API
sidebar_label: 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. Docusaurus provides some APIs on the clients that can be helpful to you when building your site.
## Components {#components} ## Components {#components}
@ -479,7 +479,7 @@ Prefer a `require()` call for [assets](./guides/markdown-features/markdown-featu
### `useBaseUrlUtils` {#useBaseUrlUtils} ### `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. - `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 slug: /creating-pages
sidebar_label: Pages sidebar_label: Pages
--- ---
# Creating Pages
In this section, we will learn about creating pages in Docusaurus. 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. 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 id: introduction
title: Docs Introduction
sidebar_label: Introduction sidebar_label: Introduction
slug: /docs-introduction slug: /docs-introduction
--- ---
# Docs Introduction
The docs feature provides users with a way to organize Markdown files in a hierarchical format. The docs feature provides users with a way to organize Markdown files in a hierarchical format.
:::info :::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`. 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).
```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
```
## Docs-only mode {#docs-only-mode} ## Docs-only mode {#docs-only-mode}

View file

@ -1,10 +1,11 @@
--- ---
id: multi-instance id: multi-instance
title: Docs Multi-instance
description: Use multiple docs plugin instances on a single Docusaurus site. description: Use multiple docs plugin instances on a single Docusaurus site.
slug: /docs-multi-instance 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). The `@docusaurus/plugin-content-docs` plugin can support [multi-instance](../../using-plugins.md#multi-instance-plugins-and-plugin-ids).
:::note :::note
@ -134,7 +135,7 @@ Don't forget to assign a unique `id` attribute to plugin instances.
:::note :::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} ## 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 ```bash npm2yarn
npm run docusaurus -- --help 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)**. **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" ```diff title="docs/02-Tutorial Easy/01-First Part.md"
- Check the [Tutorial End](../04-End.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 ```mdx-code-block
import CodeBlock from '@theme/CodeBlock'; import CodeBlock from '@theme/CodeBlock';
<CodeBlock className="language-js" title="sidebars.js"> <CodeBlock language="js" title="sidebars.js">
{require('!!raw-loader!@site/sidebars.js') {require('!!raw-loader!@site/sidebars.js')
.default .default
.split('\n') .split('\n')

View file

@ -1,16 +1,16 @@
--- ---
id: versioning
title: Versioning
slug: /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 ```mdx-code-block
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; 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 :::caution
Think about it before starting to version your documentation - it can become difficult for contributors to help improve it! Think about it before starting to version your documentation - it can become difficult for contributors to help improve it!
@ -102,8 +102,10 @@ When tagging a new version, the document versioning mechanism will:
1. Place the new file into the corresponding version folder. 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. 2. Include the reference to the new file in the corresponding sidebar file according to the version number.
```mdx-code-block
<Tabs> <Tabs>
<TabItem value="Current version structure"> <TabItem value="Current version structure">
```
```bash ```bash
# The new file. # The new file.
@ -113,8 +115,10 @@ docs/new.md
sidebars.js sidebars.js
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="Older version structure"> <TabItem value="Older version structure">
```
```bash ```bash
# The new file. # The new file.
@ -124,8 +128,10 @@ versioned_docs/version-1.0.0/new.md
versioned_sidebars/version-1.0.0-sidebars.json versioned_sidebars/version-1.0.0-sidebars.json
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
```
### Updating an existing version {#updating-an-existing-version} ### Updating an existing version {#updating-an-existing-version}

View file

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

View file

@ -1,10 +1,11 @@
--- ---
id: assets id: assets
title: Assets
description: Handling assets in Docusaurus Markdown description: Handling assets in Docusaurus Markdown
slug: /markdown-features/assets slug: /markdown-features/assets
--- ---
# Assets
import BrowserWindow from '@site/src/components/BrowserWindow'; import BrowserWindow from '@site/src/components/BrowserWindow';
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; 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. You can display images in three different ways: Markdown syntax, CJS require, or ES imports syntax.
```mdx-code-block
<Tabs> <Tabs>
<TabItem value="Markdown syntax"> <TabItem value="Markdown syntax">
```
Display images using simple 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) ![Example banner](./assets/docusaurus-asset-example-banner.png)
``` ```
```mdx-code-block
</TabItem> </TabItem>
<TabItem value="CommonJS require"> <TabItem value="CommonJS require">
```
Display images using inline CommonJS `require` in JSX image tag: 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>
<TabItem value="Import statement"> <TabItem value="Import statement">
```
Display images using ES `import` syntax and JSX image tag: 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" />; <img src={myImageUrl} alt="Example banner" />;
``` ```
```mdx-code-block
</TabItem> </TabItem>
</Tabs> </Tabs>
```
All of the above result in displaying the image: All of the above result in displaying the image:
@ -101,7 +110,7 @@ or
</BrowserWindow> </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. 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.

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