mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
chore: prepare v2.0.0-beta.8 release (#5762)
This commit is contained in:
parent
ef246dafcd
commit
68a116611f
105 changed files with 755 additions and 468 deletions
80
CHANGELOG.md
80
CHANGELOG.md
|
@ -1,5 +1,85 @@
|
|||
# Docusaurus 2 Changelog
|
||||
|
||||
## 2.0.0-beta.8 (2021-10-21)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
||||
- `docusaurus-plugin-content-blog`
|
||||
- [#5702](https://github.com/facebook/docusaurus/pull/5702) feat(content-blog): new readingTime plugin option ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- `docusaurus`
|
||||
- [#5740](https://github.com/facebook/docusaurus/pull/5740) feat(core): write-heading-ids options maintainCasing, overwrite ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- `docusaurus-plugin-content-docs`
|
||||
- [#5705](https://github.com/facebook/docusaurus/pull/5705) feat(content-docs): new front matter options to customize pagination ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
|
||||
#### :boom: Breaking Change
|
||||
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#5751](https://github.com/facebook/docusaurus/pull/5751) fix: stable callbacks in useSearchQuery + refactor ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-plugin-ideal-image`
|
||||
- [#5760](https://github.com/facebook/docusaurus/pull/5760) fix(ideal-image): fix IdealImage in dev not handling ES import images properly ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#5732](https://github.com/facebook/docusaurus/pull/5732) fix(theme-classic): allow tabs with number as value ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- [#5721](https://github.com/facebook/docusaurus/pull/5721) fix: handle rubber band scrolling in hideable navbar ([@lex111](https://github.com/lex111))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#5751](https://github.com/facebook/docusaurus/pull/5751) fix: stable callbacks in useSearchQuery + refactor ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :nail_care: Polish
|
||||
|
||||
- `docusaurus-theme-classic`
|
||||
- [#5717](https://github.com/facebook/docusaurus/pull/5717) refactor: Polish de translation ([@philipp985](https://github.com/philipp985))
|
||||
- [#5725](https://github.com/facebook/docusaurus/pull/5725) refactor: add missing Turkish translations to theme-classic ([@canercanbaz](https://github.com/canercanbaz))
|
||||
- [#5723](https://github.com/facebook/docusaurus/pull/5723) refactor(v2): update Vietnamese translations ([@datlechin](https://github.com/datlechin))
|
||||
- `docusaurus-module-type-aliases`, `docusaurus-plugin-ideal-image`, `docusaurus-theme-classic`, `docusaurus`
|
||||
- [#5726](https://github.com/facebook/docusaurus/pull/5726) refactor(module-type-aliases): remove fallback aliases ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- Other
|
||||
- [#5755](https://github.com/facebook/docusaurus/pull/5755) docs: rename docusaurus.config.js route + redirects cleanup ([@slorber](https://github.com/slorber))
|
||||
- [#5750](https://github.com/facebook/docusaurus/pull/5750) docs(v2): Fix typo in using-plugins.md ([@thanasis00](https://github.com/thanasis00))
|
||||
- [#5727](https://github.com/facebook/docusaurus/pull/5727) docs(v2): Add Fenghua Frontend Developer site to showcase page ([@zxuqian](https://github.com/zxuqian))
|
||||
- [#5746](https://github.com/facebook/docusaurus/pull/5746) docs: Add plugin-image-zoom ([@ataft](https://github.com/ataft))
|
||||
- [#5728](https://github.com/facebook/docusaurus/pull/5728) docs: add h4 into toc on certain pages ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- [#5737](https://github.com/facebook/docusaurus/pull/5737) docs: Add Apex FP to showcase ([@ipavlic](https://github.com/ipavlic))
|
||||
- `docusaurus-plugin-content-blog`
|
||||
- [#5753](https://github.com/facebook/docusaurus/pull/5753) fix(content-blog): temporarily swallow feed mdxToHtml errors + feed refactor ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :house: Internal
|
||||
|
||||
- `docusaurus`
|
||||
- [#5761](https://github.com/facebook/docusaurus/pull/5761) chore: upgrade html-webpack-plugin, remove terser 4 ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-search-algolia`, `docusaurus`
|
||||
- [#5714](https://github.com/facebook/docusaurus/pull/5714) chore: Enable ESLint rules of hooks + fix new lint errors ([@slorber](https://github.com/slorber))
|
||||
- Other
|
||||
- [#5722](https://github.com/facebook/docusaurus/pull/5722) chore: fix gen script to support TS template ([@lex111](https://github.com/lex111))
|
||||
- [#5730](https://github.com/facebook/docusaurus/pull/5730) chore: fix typos / casing in issue template ([@johnnyreilly](https://github.com/johnnyreilly))
|
||||
- [#5720](https://github.com/facebook/docusaurus/pull/5720) chore: regenerate beta.7 examples ([@lex111](https://github.com/lex111))
|
||||
- [#5719](https://github.com/facebook/docusaurus/pull/5719) chore: remove beta.5 docs ([@lex111](https://github.com/lex111))
|
||||
|
||||
#### :running_woman: Performance
|
||||
|
||||
- `docusaurus`
|
||||
- [#5748](https://github.com/facebook/docusaurus/pull/5748) refactor: perform shallow clone during deploy ([@nlfurniss](https://github.com/nlfurniss))
|
||||
|
||||
#### Committers: 13
|
||||
|
||||
- Alexey Pyltsyn ([@lex111](https://github.com/lex111))
|
||||
- Andrew Taft ([@ataft](https://github.com/ataft))
|
||||
- Caner Canbaz ([@canercanbaz](https://github.com/canercanbaz))
|
||||
- Dimi Mikadze ([@DimiMikadze](https://github.com/DimiMikadze))
|
||||
- Ilija Pavlic ([@ipavlic](https://github.com/ipavlic))
|
||||
- John Reilly ([@johnnyreilly](https://github.com/johnnyreilly))
|
||||
- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- Nathaniel Furniss ([@nlfurniss](https://github.com/nlfurniss))
|
||||
- Ngô Quốc Đạt ([@datlechin](https://github.com/datlechin))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Thanasis Katsadas ([@thanasis00](https://github.com/thanasis00))
|
||||
- Xuqian ([@zxuqian](https://github.com/zxuqian))
|
||||
- [@philipp985](https://github.com/philipp985)
|
||||
|
||||
## 2.0.0-beta.7 (2021-10-15)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "new.docusaurus.io",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "netlify dev"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"changelog": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "create-docusaurus",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Create Docusaurus apps easily.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-typescript-template",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -15,8 +15,8 @@
|
|||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.8",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.1.1",
|
||||
|
@ -27,7 +27,7 @@
|
|||
"url-loader": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.7",
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.8",
|
||||
"@tsconfig/docusaurus": "^1.0.4",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-template",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -14,8 +14,8 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.8",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-facebook-template",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -18,8 +18,8 @@
|
|||
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.8",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/cssnano-preset",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Advanced cssnano preset for maximum optimization.",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/mdx-loader",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docusaurus Loader for MDX",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/types.d.ts",
|
||||
|
@ -20,8 +20,8 @@
|
|||
"dependencies": {
|
||||
"@babel/parser": "^7.12.16",
|
||||
"@babel/traverse": "^7.12.13",
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@mdx-js/mdx": "^1.6.21",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"chalk": "^4.1.2",
|
||||
|
@ -38,7 +38,7 @@
|
|||
"webpack": "^5.40.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@types/escape-html": "^1.0.1",
|
||||
"@types/mdast": "^3.0.7",
|
||||
"@types/stringify-object": "^3.3.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/migrate",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "A CLI tool to migrate from older versions of Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/module-type-aliases",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docusaurus module type aliases.",
|
||||
"types": "./src/index.d.ts",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-client-redirects",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Client redirects plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-client-redirects.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"chalk": "^4.1.2",
|
||||
"eta": "^1.12.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-blog",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Blog plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-blog.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"chalk": "^4.1.2",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"feed": "^4.2.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-docs",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docs plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-docs.d.ts",
|
||||
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.7",
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.8",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/picomatch": "^2.2.1",
|
||||
"commander": "^5.1.0",
|
||||
|
@ -26,11 +26,11 @@
|
|||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"chalk": "^4.1.2",
|
||||
"combine-promises": "^1.1.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-pages",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Pages plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-pages.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/mdx-loader": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"globby": "^11.0.2",
|
||||
"lodash": "^4.17.20",
|
||||
"remark-admonitions": "^1.2.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-debug",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Debug plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/types.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"fs-extra": "^10.0.0",
|
||||
"react-json-view": "^1.21.3",
|
||||
"tslib": "^2.3.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-google-analytics",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Global analytics (analytics.js) plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-google-analytics.d.ts",
|
||||
|
@ -18,10 +18,10 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7"
|
||||
"@docusaurus/core": "2.0.0-beta.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "2.0.0-beta.7"
|
||||
"@docusaurus/types": "2.0.0-beta.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-google-gtag",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Global Site Tag (gtag.js) plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-google-gtag.d.ts",
|
||||
|
@ -18,10 +18,10 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7"
|
||||
"@docusaurus/core": "2.0.0-beta.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "2.0.0-beta.7"
|
||||
"@docusaurus/types": "2.0.0-beta.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-ideal-image",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-ideal-image.d.ts",
|
||||
|
@ -21,10 +21,10 @@
|
|||
"fs-extra": "^10.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/lqip-loader": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/lqip-loader": "2.0.0-beta.8",
|
||||
"@docusaurus/responsive-loader": "1.4.0",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@endiliey/react-ideal-image": "^0.0.11",
|
||||
"react-waypoint": "^10.1.0",
|
||||
"sharp": "^0.29.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-pwa",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docusaurus Plugin to add PWA support.",
|
||||
"main": "src/index.js",
|
||||
"publishConfig": {
|
||||
|
@ -16,10 +16,10 @@
|
|||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.12.16",
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"babel-loader": "^8.2.2",
|
||||
"clsx": "^1.1.1",
|
||||
"core-js": "^2.6.5",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-sitemap",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Simple sitemap generation plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-sitemap.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"fs-extra": "^10.0.0",
|
||||
"sitemap": "^7.0.0",
|
||||
"tslib": "^2.3.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/preset-classic",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Classic preset for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/preset-classic.d.ts",
|
||||
|
@ -18,16 +18,16 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-debug": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-google-analytics": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-google-gtag": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-sitemap": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-classic": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-search-algolia": "2.0.0-beta.7"
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-debug": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-google-analytics": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-google-gtag": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-sitemap": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-classic": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-search-algolia": "2.0.0-beta.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/remark-plugin-npm2yarn",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Remark plugin for converting npm commands to Yarn commands as tabs.",
|
||||
"main": "src/index.js",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-classic",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Classic theme for Docusaurus",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/types.d.ts",
|
||||
|
@ -23,15 +23,15 @@
|
|||
"update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"@mdx-js/mdx": "^1.6.21",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"chalk": "^4.1.2",
|
||||
|
@ -50,7 +50,7 @@
|
|||
"rtlcss": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.7",
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.8",
|
||||
"@types/mdx-js__react": "^1.5.4",
|
||||
"@types/parse-numeric-range": "^0.0.1",
|
||||
"@types/rtlcss": "^3.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-common",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Common code for Docusaurus themes.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,18 +18,18 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-blog": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-docs": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-content-pages": "2.0.0-beta.8",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"clsx": "^1.1.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"tslib": "^2.3.1",
|
||||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.7",
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.8",
|
||||
"lodash": "^4.17.20"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-live-codeblock",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Docusaurus live code block component.",
|
||||
"main": "src/index.js",
|
||||
"publishConfig": {
|
||||
|
@ -13,8 +13,8 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"@philpl/buble": "^0.19.7",
|
||||
"clsx": "^1.1.1",
|
||||
"parse-numeric-range": "^1.3.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-search-algolia",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Algolia search component for Docusaurus.",
|
||||
"main": "src/index.js",
|
||||
"publishConfig": {
|
||||
|
@ -14,10 +14,10 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docsearch/react": "^3.0.0-alpha.39",
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"algoliasearch": "^4.10.5",
|
||||
"algoliasearch-helper": "^3.5.5",
|
||||
"clsx": "^1.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/types",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Common types for Docusaurus packages.",
|
||||
"types": "./src/index.d.ts",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils-common",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils-validation",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Node validation utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"chalk": "^4.1.2",
|
||||
"joi": "^17.4.2",
|
||||
"tslib": "^2.3.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Node utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@mdx-js/runtime": "^1.6.22",
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"chalk": "^4.1.2",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@docusaurus/core",
|
||||
"description": "Easy to Maintain Open Source Documentation Websites",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -31,7 +31,7 @@
|
|||
"url": "https://github.com/facebook/docusaurus/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.7",
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.8",
|
||||
"@types/copy-webpack-plugin": "^8.0.1",
|
||||
"@types/css-minimizer-webpack-plugin": "^3.0.2",
|
||||
"@types/detect-port": "^1.3.0",
|
||||
|
@ -55,12 +55,12 @@
|
|||
"@babel/runtime": "^7.15.4",
|
||||
"@babel/runtime-corejs3": "^7.15.4",
|
||||
"@babel/traverse": "^7.12.13",
|
||||
"@docusaurus/cssnano-preset": "2.0.0-beta.7",
|
||||
"@docusaurus/cssnano-preset": "2.0.0-beta.8",
|
||||
"@docusaurus/react-loadable": "5.5.0",
|
||||
"@docusaurus/types": "2.0.0-beta.7",
|
||||
"@docusaurus/utils": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.7",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.7",
|
||||
"@docusaurus/types": "2.0.0-beta.8",
|
||||
"@docusaurus/utils": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-common": "2.0.0-beta.8",
|
||||
"@docusaurus/utils-validation": "2.0.0-beta.8",
|
||||
"@slorber/static-site-generator-webpack-plugin": "^4.0.0",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"autoprefixer": "^10.3.5",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/lqip-loader",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Low Quality Image Placeholders (LQIP) loader for webpack.",
|
||||
"main": "src/index.js",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "stylelint-copyright",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"description": "Stylelint plugin to check CSS files for a copyright header.",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "website",
|
||||
"version": "2.0.0-beta.7",
|
||||
"version": "2.0.0-beta.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -31,13 +31,13 @@
|
|||
"dependencies": {
|
||||
"@crowdin/cli": "^3.5.2",
|
||||
"@crowdin/crowdin-api-client": "^1.10.6",
|
||||
"@docusaurus/core": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-client-redirects": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-ideal-image": "2.0.0-beta.7",
|
||||
"@docusaurus/plugin-pwa": "2.0.0-beta.7",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.7",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "2.0.0-beta.7",
|
||||
"@docusaurus/theme-live-codeblock": "2.0.0-beta.7",
|
||||
"@docusaurus/core": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-client-redirects": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-ideal-image": "2.0.0-beta.8",
|
||||
"@docusaurus/plugin-pwa": "2.0.0-beta.8",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.8",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "2.0.0-beta.8",
|
||||
"@docusaurus/theme-live-codeblock": "2.0.0-beta.8",
|
||||
"clsx": "^1.1.1",
|
||||
"color": "^4.0.1",
|
||||
"esbuild-loader": "2.13.1",
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
id: theme-bootstrap
|
||||
title: '📦 theme-bootstrap'
|
||||
slug: '/api/themes/@docusaurus/theme-bootstrap'
|
||||
---
|
||||
|
||||
:::danger
|
||||
|
||||
The bootstrap theme is a work in progress, and is not production ready.
|
||||
|
||||
:::
|
||||
|
||||
🚧 The bootstrap 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-bootstrap
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
If you have installed `@docusaurus/preset-bootstrap`, you don't need to install it as a dependency.
|
||||
|
||||
:::
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
id: docusaurus.config.js
|
||||
description: API reference for Docusaurus configuration file.
|
||||
slug: /docusaurus.config.js
|
||||
slug: /api/docusaurus-config
|
||||
---
|
||||
|
||||
# `docusaurus.config.js`
|
|
@ -36,6 +36,7 @@ Accepted fields:
|
|||
| `blogSidebarCount` | <code>number \| 'ALL'</code> | `5` | Number of blog post elements to show in the blog sidebar. `'ALL'` to show all blog posts; `0` to disable |
|
||||
| `blogSidebarTitle` | `string` | `'Recent posts'` | Title of the blog sidebar. |
|
||||
| `routeBasePath` | `string` | `'blog'` | URL route for the blog section of your site. **DO NOT** include a trailing slash. Use `/` to put the blog at root path. |
|
||||
| `tagsBasePath` | `string` | `'tags'` | URL route for the tags list page of your site. It is prepended to the `routeBasePath`. |
|
||||
| `archiveBasePath` | `string` | `'/archive'` | URL route for the archive blog section of your site. It is prepended to the `routeBasePath`. **DO NOT** include a trailing slash. |
|
||||
| `include` | `string[]` | `['**/*.{md,mdx}']` | Matching files will be included and processed. |
|
||||
| `exclude` | `string[]` | _See example configuration_ | No route will be created for matching files. |
|
||||
|
@ -50,6 +51,7 @@ Accepted fields:
|
|||
| `beforeDefaultRehypePlugins` | `any[]` | `[]` | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. |
|
||||
| `truncateMarker` | `string` | `/<!--\s*(truncate)\s*-->/` | Truncate marker, can be a regex or string. |
|
||||
| `showReadingTime` | `boolean` | `true` | Show estimated reading time for the blog post. |
|
||||
| `readingTime` | `ReadingTimeFunctionOption` | The default reading time | A callback to customize the reading time number displayed. |
|
||||
| `authorsMapPath` | `string` | `'authors.yml'` | Path to the authors map file, relative to the blog content directory specified with `path`. Can also be a `json` file. |
|
||||
| `feedOptions` | _See below_ | `{type: ['rss', 'atom']}` | Blog feed. If undefined, no rss feed will be generated. |
|
||||
| `feedOptions.type` | <code>'rss' \| 'atom' \| 'all'</code> (or array of multiple options) | **Required** | Type of feed to be generated. |
|
||||
|
@ -67,6 +69,23 @@ type EditUrlFunction = (params: {
|
|||
permalink: string;
|
||||
locale: string;
|
||||
}) => string | undefined;
|
||||
|
||||
type ReadingTimeOptions = {
|
||||
wordsPerMinute: number;
|
||||
wordBound: (char: string) => boolean;
|
||||
};
|
||||
|
||||
type ReadingTimeFunction = (params: {
|
||||
content: string;
|
||||
frontMatter?: BlogPostFrontMatter & Record<string, unknown>;
|
||||
options?: ReadingTimeOptions;
|
||||
}) => number;
|
||||
|
||||
type ReadingTimeFunctionOption = (params: {
|
||||
content: string;
|
||||
frontMatter: BlogPostFrontMatter & Record<string, unknown>;
|
||||
defaultReadingTime: ReadingTimeFunction;
|
||||
}) => number | undefined;
|
||||
```
|
||||
|
||||
## Example configuration {#ex-config}
|
||||
|
@ -186,6 +205,8 @@ Accepted fields:
|
|||
| `tags` | `Tag[]` | `undefined` | A list of strings or objects of two string fields `label` and `permalink` to tag to your post. |
|
||||
| `draft` | `boolean` | `false` | A boolean flag to indicate that the blog post is work-in-progress and therefore should not be published yet. However, draft blog posts will be displayed during development. |
|
||||
| `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_max_heading_level` | `number` | `3` | The max heading level shown in the table of contents. Must be between 2 and 6. |
|
||||
| `keywords` | `string[]` | `undefined` | Keywords meta tag, which will become the `<meta name="keywords" content="keyword1,keyword2,..."/>` in `<head>`, used by search engines. |
|
||||
| `description` | `string` | The first line of Markdown content | The description of your document, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. |
|
||||
| `image` | `string` | `undefined` | Cover or thumbnail image that will be used when displaying the link to your post. |
|
|
@ -33,6 +33,7 @@ Accepted fields:
|
|||
| `editLocalizedFiles` | `boolean` | `false` | The edit URL will target the localized file, instead of the original unlocalized file. Ignored when `editUrl` is a function. |
|
||||
| `editCurrentVersion` | `boolean` | `false` | The edit URL will always target the current version doc instead of older versions. Ignored when `editUrl` is a function. |
|
||||
| `routeBasePath` | `string` | `'docs'` | URL route for the docs section of your site. **DO NOT** include a trailing slash. Use `/` for shipping docs without base path. |
|
||||
| `tagsBasePath` | `string` | `'tags'` | URL route for the tags list page of your site. It is prepended to the `routeBasePath`. |
|
||||
| `include` | `string[]` | `['**/*.{md,mdx}']` | Matching files will be included and processed. |
|
||||
| `exclude` | `string[]` | _See example configuration_ | No route will be created for matching files. |
|
||||
| `sidebarPath` | <code>false \| string</code> | `undefined` (creates autogenerated sidebar) | Path to sidebar configuration. |
|
||||
|
@ -246,8 +247,13 @@ Accepted fields:
|
|||
| `pagination_label` | `string` | `sidebar_label` or `title` | The text used in the document next/previous buttons for this document. |
|
||||
| `sidebar_label` | `string` | `title` | The text shown in the document sidebar for this document. |
|
||||
| `sidebar_position` | `number` | Default ordering | Controls the position of a doc inside the generated sidebar slice when using `autogenerated` sidebar items. See also [Autogenerated sidebar metadatas](/docs/sidebar#autogenerated-sidebar-metadatas). |
|
||||
| `sidebar_class_name` | `string` | `undefined` | Gives the corresponding sidebar label a special class name when using autogenerated sidebars. |
|
||||
| `hide_title` | `boolean` | `false` | Whether to hide the title at the top of the doc. It only hides a title declared through the frontmatter, and have no effect on a Markdown title at the top of your document. |
|
||||
| `hide_table_of_contents` | `boolean` | `false` | Whether to hide the table of contents to the right. |
|
||||
| `toc_min_heading_level` | `number` | `2` | The minimum heading level shown in the table of contents. Must be between 2 and 6 and lower or equal to the max value. |
|
||||
| `toc_max_heading_level` | `number` | `3` | The max heading level shown in the table of contents. Must be between 2 and 6. |
|
||||
| `pagination_next` | <code>string \| null</code> | Next doc in the sidebar | The ID of the documentation you want the "Next" pagination to link to. Use `null` to disable showing "Next" for this page. |
|
||||
| `pagination_prev` | <code>string \| null</code> | Previous doc in the sidebar | The ID of the documentation you want the "Previous" pagination to link to. Use `null` to disable showing "Previous" for this page. |
|
||||
| `parse_number_prefixes` | `boolean` | `numberPrefixParser` plugin option | Whether number prefix parsing is disabled on this doc. See also [Using number prefixes](/docs/sidebar#using-number-prefixes). |
|
||||
| `custom_edit_url` | `string` | Computed using the `editUrl` plugin option | The URL for editing this document. |
|
||||
| `keywords` | `string[]` | `undefined` | Keywords meta tag for the document page, for search engines. |
|
|
@ -12,7 +12,7 @@ We provide official Docusaurus themes.
|
|||
The main themes implement the user interface for the [docs](../plugins/plugin-content-docs.md), [blog](../plugins/plugin-content-blog.md) and [pages](../plugins/plugin-content-pages.md) plugins.
|
||||
|
||||
- [@docusaurus/theme-classic](./theme-classic.md)
|
||||
- [@docusaurus/theme-bootstrap](./theme-bootstrap.md) 🚧
|
||||
- 🚧 other themes are planned
|
||||
|
||||
:::caution
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
id: theme-configuration
|
||||
title: 'Theme configuration'
|
||||
slug: '/api/themes/configuration'
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
This configuration applies to all [main themes](./overview.md).
|
||||
|
@ -251,7 +252,7 @@ module.exports = {
|
|||
|
||||
The items can have different behaviors based on the `type` field. The sections below will introduce you to all the types of navbar items available.
|
||||
|
||||
### Navbar link {#navbar-link}
|
||||
#### Navbar link {#navbar-link}
|
||||
|
||||
By default, Navbar items are regular links (internal or external).
|
||||
|
||||
|
@ -306,7 +307,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar dropdown {#navbar-dropdown}
|
||||
#### Navbar dropdown {#navbar-dropdown}
|
||||
|
||||
Navbar items of the type `dropdown` has the additional `items` field, an inner array of navbar items.
|
||||
|
||||
|
@ -362,7 +363,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar doc link {#navbar-doc-link}
|
||||
#### Navbar doc link {#navbar-doc-link}
|
||||
|
||||
If you want to link to a specific doc, this special navbar item type will render the link to the doc of the provided `docId`. It will get the class `navbar__link--active` as long as you browse a doc of the same sidebar.
|
||||
|
||||
|
@ -400,7 +401,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar docs version dropdown {#navbar-docs-version-dropdown}
|
||||
#### Navbar docs version dropdown {#navbar-docs-version-dropdown}
|
||||
|
||||
If you use docs with versioning, this special navbar item type that will render a dropdown with all your site's available versions.
|
||||
|
||||
|
@ -441,7 +442,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar docs version {#navbar-docs-version}
|
||||
#### Navbar docs version {#navbar-docs-version}
|
||||
|
||||
If you use docs with versioning, this special navbar item type will link to the active/browsed version of your doc (depends on the current URL), and fallback to the latest version.
|
||||
|
||||
|
@ -479,7 +480,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar locale dropdown {#navbar-locale-dropdown}
|
||||
#### Navbar locale dropdown {#navbar-locale-dropdown}
|
||||
|
||||
If you use the [i18n feature](../../i18n/i18n-introduction.md), this special navbar item type will render a dropdown with all your site's available locales.
|
||||
|
||||
|
@ -522,7 +523,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
### Navbar search {#navbar-search}
|
||||
#### Navbar search {#navbar-search}
|
||||
|
||||
If you use the [search](../../search.md), the search bar will be the rightmost element in the navbar.
|
||||
|
||||
|
@ -757,6 +758,34 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
## Table of Contents {#table-of-contents}
|
||||
|
||||
You can adjust the default table of contents via `themeConfig.tableOfContents`.
|
||||
|
||||
<small>
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `minHeadingLevel` | `number` | `2` | The minimum heading level shown in the table of contents. Must be between 2 and 6 and lower or equal to the max value. |
|
||||
| `maxHeadingLevel` | `number` | `3` | Max heading level displayed in the TOC. Should be an integer between 2 and 6. |
|
||||
|
||||
</small>
|
||||
|
||||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
themeConfig: {
|
||||
// highlight-start
|
||||
tableOfContents: {
|
||||
minHeadingLevel: 2,
|
||||
maxHeadingLevel: 5,
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Hooks {#hooks}
|
||||
|
||||
### `useThemeContext` {#usethemecontext}
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
@ -176,14 +176,8 @@ Use the `authors` FrontMatter field to declare blog post authors.
|
|||
Blog post authors can be declared directly inside the FrontMatter:
|
||||
|
||||
````mdx-code-block
|
||||
<Tabs
|
||||
defaultValue="single"
|
||||
values={[
|
||||
{label: 'Single author', value: 'single'},
|
||||
{label: 'Multiple authors', value: 'multiple'},
|
||||
]}
|
||||
groupId="author-frontmatter">
|
||||
<TabItem value="single">
|
||||
<Tabs groupId="author-frontmatter">
|
||||
<TabItem value="single" label="Single author">
|
||||
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
|
@ -196,7 +190,7 @@ authors:
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="multiple">
|
||||
<TabItem value="multiple" label="Multiple authors">
|
||||
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
|
@ -226,7 +220,6 @@ This option works best to get started, or for casual, irregular authors.
|
|||
|
||||
Prefer usage of the `authors` FrontMatter, but the legacy `author_*` FrontMatter remains supported:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
author: Joel Marcey
|
||||
|
@ -235,7 +228,6 @@ author_url: https://github.com/JoelMarcey
|
|||
author_image_url: https://github.com/JoelMarcey.png
|
||||
---
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
:::
|
||||
|
||||
|
@ -268,14 +260,8 @@ Use the `authorsMapPath` plugin option to configure the path. JSON is also suppo
|
|||
In blog posts FrontMatter, you can reference the authors declared in the global configuration file:
|
||||
|
||||
````mdx-code-block
|
||||
<Tabs
|
||||
defaultValue="single"
|
||||
values={[
|
||||
{label: 'Single author', value: 'single'},
|
||||
{label: 'Multiple authors', value: 'multiple'},
|
||||
]}
|
||||
groupId="author-frontmatter">
|
||||
<TabItem value="single">
|
||||
<Tabs groupId="author-frontmatter">
|
||||
<TabItem value="single" label="Single author">
|
||||
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
|
@ -284,7 +270,7 @@ authors: jmarcey
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="multiple">
|
||||
<TabItem value="multiple" label="Multiple authors">
|
||||
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
|
@ -305,7 +291,6 @@ The `authors` system is very flexible and can suit more advanced use-case:
|
|||
|
||||
You can use global authors most of the time, and still use inline authors:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
authors:
|
||||
|
@ -317,7 +302,6 @@ authors:
|
|||
image_url: https://github.com/inlineAuthor
|
||||
---
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -326,7 +310,6 @@ authors:
|
|||
|
||||
You can customize the global author's data on per-blog-post basis:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```yml title="my-blog-post.md"
|
||||
---
|
||||
authors:
|
||||
|
@ -336,7 +319,6 @@ authors:
|
|||
name: Sébastien Lorber's new name
|
||||
---
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -353,6 +335,124 @@ website/i18n/<locale>/docusaurus-plugin-content-blog/authors.yml
|
|||
|
||||
:::
|
||||
|
||||
## Reading time {#reading-time}
|
||||
|
||||
Docusaurus generates a reading time estimation for each blog post based on word count. We provide an option to customize this.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
blog: {
|
||||
// highlight-start
|
||||
showReadingTime: true, // When set to false, the "x min read" won't be shown
|
||||
readingTime: ({content, frontMatter, defaultReadingTime}) =>
|
||||
defaultReadingTime({content, options: {wordsPerMinute: 300}}),
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
The `readingTime` callback receives three parameters: the blog content text as a string, front matter as a record of string keys and their values, and the default reading time function. It returns a number (reading time in minutes) or `undefined` (disable reading time for this page).
|
||||
|
||||
The default reading time is able to accept additional options: `wordsPerMinute` as a number (default: 300), and `wordBound` as a function from string to boolean. If the string passed to `wordBound` should be a word bound (spaces, tabs, and line breaks by default), the function should return `true`.
|
||||
|
||||
:::tip
|
||||
|
||||
Use the callback for all your customization needs:
|
||||
|
||||
````mdx-code-block
|
||||
<Tabs>
|
||||
<TabItem value="disable-per-post" label="Per-post disabling">
|
||||
|
||||
**Disable reading time on one page:**
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// highlight-start
|
||||
readingTime: ({content, frontMatter, defaultReadingTime}) =>
|
||||
frontMatter.hide_reading_time ? undefined : defaultReadingTime({content}),
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
Usage:
|
||||
|
||||
```yml "my-blog-post.md"
|
||||
---
|
||||
hide_reading_time: true
|
||||
---
|
||||
|
||||
This page will no longer display the reading time stats!
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="passing-options" label="Passing options">
|
||||
|
||||
**Pass options to the default reading time function:**
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
blog: {
|
||||
// highlight-start
|
||||
readingTime: ({content, defaultReadingTime}) =>
|
||||
defaultReadingTime({content, options: {wordsPerMinute: 100}}),
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="using-custom-algo" label="Using custom algorithms">
|
||||
|
||||
**Use a custom implementation of reading time:**
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
const myReadingTime = require('./myReadingTime');
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
blog: {
|
||||
// highlight-next-line
|
||||
readingTime: ({content}) => myReadingTime(content),
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
````
|
||||
|
||||
:::
|
||||
|
||||
## Feed {#feed}
|
||||
|
||||
You can generate RSS/Atom feed by passing feedOptions. By default, RSS and Atom feeds are generated. To disable feed generation, set `feedOptions.type` to `null`.
|
|
@ -183,6 +183,12 @@ By default, the files are written in `website/i18n/<defaultLocale>/...`.
|
|||
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
|
||||
| `--messagePrefix` | `''` | Allows to add a prefix to each translation message, to help you highlight untranslated strings |
|
||||
|
||||
### `docusaurus write-heading-ids [siteDir]` {#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-headings.mdx#explicit-ids) to the Markdown documents of your site.
|
||||
|
||||
| Name | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `files` | All MD files used by plugins | The files that you want heading IDs to be written to. |
|
||||
| `--maintain-case` | `false` | Keep the headings' casing, otherwise make all lowercase. |
|
||||
| `--overwrite` | `false` | Overwrite existing heading IDs. |
|
|
@ -143,28 +143,22 @@ GitHub enterprise installations should work in the same manner as github.com; yo
|
|||
Finally, to deploy your site to GitHub Pages, run:
|
||||
|
||||
````mdx-code-block
|
||||
<Tabs
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' },
|
||||
{ label: 'PowerShell', value: 'powershell' }
|
||||
]}>
|
||||
<TabItem value="bash">
|
||||
<Tabs>
|
||||
<TabItem value="bash" label="Bash">
|
||||
|
||||
```bash
|
||||
GIT_USER=<GITHUB_USERNAME> yarn deploy
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="windows">
|
||||
<TabItem value="windows" label="Windows">
|
||||
|
||||
```batch
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="powershell">
|
||||
<TabItem value="powershell" label="PowerShell">
|
||||
|
||||
```powershell
|
||||
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
|
|
@ -253,6 +253,16 @@ export default function Home() {
|
|||
}
|
||||
```
|
||||
|
||||
:::note
|
||||
|
||||
You can even omit a children prop and specify a translation string in your `code.json` file manually after running the `docusaurus write-translations` CLI command.
|
||||
|
||||
```jsx
|
||||
<Translate id="homepage.title" />
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## Hooks {#hooks}
|
||||
|
||||
### `useDocusaurusContext` {#usedocusauruscontext}
|
|
@ -45,7 +45,7 @@ function Hello() {
|
|||
fontSize: '20px',
|
||||
}}>
|
||||
<p>
|
||||
Edit <code>pages/hello.js</code> and save to reload.
|
||||
Edit <code>pages/helloReact.js</code> and save to reload.
|
||||
</p>
|
||||
</div>
|
||||
</Layout>
|
|
@ -35,7 +35,9 @@ 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
|
||||
### 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.
|
||||
|
||||
|
@ -67,7 +69,9 @@ 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</h3>
|
||||
<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.
|
||||
|
||||
|
@ -84,11 +88,18 @@ 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.md). Tags are passed in the front matter as a list of labels:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```yml "your-doc-page.md"
|
||||
---
|
||||
id: doc-with-tags
|
||||
|
@ -98,4 +109,11 @@ tags:
|
|||
- Getting started
|
||||
---
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
:::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/).
|
||||
|
||||
:::
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
id: sidebar
|
||||
title: Sidebar
|
||||
toc_max_heading_level: 4
|
||||
slug: /sidebar
|
||||
---
|
||||
|
||||
|
@ -173,6 +174,7 @@ type SidebarItemDoc =
|
|||
type: 'doc';
|
||||
id: string;
|
||||
label: string; // Sidebar label text
|
||||
className?: string; // Class name for sidebar label
|
||||
}
|
||||
|
||||
// Shorthand syntax
|
||||
|
@ -244,6 +246,7 @@ type SidebarItemLink = {
|
|||
type: 'link';
|
||||
label: string;
|
||||
href: string;
|
||||
className?: string;
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -282,6 +285,7 @@ type SidebarItemCategory = {
|
|||
type: 'category';
|
||||
label: string; // Sidebar label text.
|
||||
items: SidebarItem[]; // Array of sidebar items.
|
||||
className?: string;
|
||||
|
||||
// Category options:
|
||||
collapsible: boolean; // Set the category to be collapsible
|
||||
|
@ -519,7 +523,8 @@ This is the easy tutorial!
|
|||
```json title="docs/tutorials/_category_.json"
|
||||
{
|
||||
"label": "Tutorial",
|
||||
"position": 3
|
||||
"position": 3,
|
||||
"className": "red"
|
||||
}
|
||||
```
|
||||
|
|
@ -89,23 +89,17 @@ Some **content** with _markdown_ `syntax`.
|
|||
|
||||
You can use MDX inside admonitions too!
|
||||
|
||||
```mdx
|
||||
```jsx
|
||||
import Tabs from '@theme/Tabs';
|
||||
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
:::tip Use tabs in admonitions
|
||||
|
||||
<Tabs
|
||||
defaultValue="apple"
|
||||
values={[
|
||||
{label: 'Apple', value: 'apple'},
|
||||
{label: 'Orange', value: 'orange'},
|
||||
{label: 'Banana', value: 'banana'},
|
||||
]}>
|
||||
<TabItem value="apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="banana">This is a banana 🍌</TabItem>
|
||||
<Tabs>
|
||||
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="orange" label="Orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="banana" label="Banana">This is a banana 🍌</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::
|
||||
|
@ -119,16 +113,10 @@ import TabItem from '@theme/TabItem';
|
|||
:::tip Use tabs in admonitions
|
||||
|
||||
```mdx-code-block
|
||||
<Tabs
|
||||
defaultValue="apple"
|
||||
values={[
|
||||
{label: 'Apple', value: 'apple'},
|
||||
{label: 'Orange', value: 'orange'},
|
||||
{label: 'Banana', value: 'banana'},
|
||||
]}>
|
||||
<TabItem value="apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="banana">This is a banana 🍌</TabItem>
|
||||
<Tabs>
|
||||
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="orange" label="Orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="banana" label="Banana">This is a banana 🍌</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
|
@ -119,7 +119,7 @@ html[data-theme='dark'] .themedDocusaurus [fill='#FFFF50'] {
|
|||
|
||||
## Themed Images {#themed-images}
|
||||
|
||||
Docusaurus supports themed images: the `ThemedImage` component (included in the classic/bootstrap themes) allows you to switch the image source based on the current theme.
|
||||
Docusaurus supports themed images: the `ThemedImage` component (included in the themes) allows you to switch the image source based on the current theme.
|
||||
|
||||
```jsx {5-8}
|
||||
import ThemedImage from '@theme/ThemedImage';
|
|
@ -374,15 +374,8 @@ The following example is how you can have multi-language code tabs in your docs.
|
|||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
values={[
|
||||
{ label: 'JavaScript', value: 'js', },
|
||||
{ label: 'Python', value: 'py', },
|
||||
{ label: 'Java', value: 'java', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="js">
|
||||
<Tabs>
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
function helloWorld() {
|
||||
|
@ -391,7 +384,7 @@ function helloWorld() {
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="py">
|
||||
<TabItem value="py" label="Python">
|
||||
|
||||
```py
|
||||
def hello_world():
|
||||
|
@ -399,7 +392,7 @@ def hello_world():
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="java">
|
||||
<TabItem value="java" label="Java">
|
||||
|
||||
```java
|
||||
class HelloWorld {
|
||||
|
@ -416,15 +409,8 @@ class HelloWorld {
|
|||
And you will get the following:
|
||||
|
||||
````mdx-code-block
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
values={[
|
||||
{ label: 'JavaScript', value: 'js', },
|
||||
{ label: 'Python', value: 'py', },
|
||||
{ label: 'Java', value: 'java', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="js">
|
||||
<Tabs>
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
function helloWorld() {
|
||||
|
@ -433,7 +419,7 @@ function helloWorld() {
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="py">
|
||||
<TabItem value="py" label="Python">
|
||||
|
||||
```py
|
||||
def hello_world():
|
||||
|
@ -441,7 +427,7 @@ def hello_world():
|
|||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="java">
|
||||
<TabItem value="java" label="Java">
|
||||
|
||||
```java
|
||||
class HelloWorld {
|
||||
|
@ -455,6 +441,51 @@ class HelloWorld {
|
|||
</Tabs>
|
||||
````
|
||||
|
||||
You may want to implement your own `<MultiLanguageCode />` abstraction if you find the above approach too verbose. We might just implement one in future for convenience.
|
||||
|
||||
If you have multiple of these multi-language code tabs, and you want to sync the selection across the tab instances, refer to the [Syncing tab choices section](markdown-features-tabs.mdx#syncing-tab-choices).
|
||||
|
||||
### Docusaurus npm2yarn remark plugin {#npm2yarn-remark-plugin}
|
||||
|
||||
Displaying CLI commands in both NPM and Yarn is a very common need, for example:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install @docusaurus/remark-plugin-npm2yarn
|
||||
```
|
||||
|
||||
Docusaurus provides such a utility out of the box, freeing you from using the `Tabs` component every time. To enable this feature, first install the `@docusaurus/remark-plugin-npm2yarn` package as above, and then in `docusaurus.config.js`, for the plugins where you need this feature (doc, blog, pages, etc.), register it in the `remarkPlugins` option. (See [Docs configuration](../../api/plugins/plugin-content-docs.md#ex-config) for more details on configuration format)
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
// highlight-start
|
||||
remarkPlugins: [
|
||||
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
|
||||
],
|
||||
// highlight-end
|
||||
},
|
||||
pages: {
|
||||
// highlight-next-line
|
||||
remarkPlugins: [require('@docusaurus/remark-plugin-npm2yarn')],
|
||||
},
|
||||
blog: {
|
||||
// ...
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
And then use it by adding the `npm2yarn` key to the code block:
|
||||
|
||||
````md
|
||||
```bash npm2yarn
|
||||
npm install @docusaurus/remark-plugin-npm2yarn
|
||||
```
|
||||
````
|
||||
|
||||
Using the `{sync: true}` option would make all tab choices synced. Because the choice is stored under the same namespace `npm2yarn`, different `npm2yarn` plugin instances would also sync their choices.
|
|
@ -13,7 +13,9 @@ But it is also possible to display an inline table of contents directly inside a
|
|||
|
||||
## Full table of contents {#full-table-of-contents}
|
||||
|
||||
The `toc` variable is available in any MDX document, and contain all the top level headings of a MDX document.
|
||||
The `toc` variable is available in any MDX document, and contains all the headings of a MDX document.
|
||||
|
||||
By default, only `h2` and `h3` headings are displayed in the TOC. You can change which heading levels are visible by setting `minHeadingLevel` or `maxHeadingLevel`.
|
||||
|
||||
```jsx
|
||||
import TOCInline from '@theme/TOCInline';
|
||||
|
@ -40,6 +42,7 @@ type TOCItem = {
|
|||
value: string;
|
||||
id: string;
|
||||
children: TOCItem[];
|
||||
level: number;
|
||||
};
|
||||
```
|
||||
|
|
@ -11,7 +11,7 @@ import BrowserWindow from '@site/src/components/BrowserWindow';
|
|||
|
||||
## Using JSX in Markdown {#using-jsx-in-markdown}
|
||||
|
||||
Docusaurus has built-in support for [MDX](https://mdxjs.com/), which allows you to write JSX within your Markdown files and render them as React components.
|
||||
Docusaurus has built-in support for [MDX v1](https://mdxjs.com/), which allows you to write JSX within your Markdown files and render them as React components.
|
||||
|
||||
:::note
|
||||
|
||||
|
@ -23,7 +23,7 @@ While both `.md` and `.mdx` files are parsed using MDX, some of the syntax are t
|
|||
|
||||
MDX is not [100% compatible with CommonMark](https://github.com/facebook/docusaurus/issues/3018).
|
||||
|
||||
Use the **[MDX playground](https://mdxjs.com/playground)** to ensure that your syntax is valid MDX.
|
||||
Use the **[MDX playground](https://mdx-git-renovate-babel-monorepo-mdx.vercel.app/playground)** to ensure that your syntax is valid MDX.
|
||||
|
||||
:::
|
||||
|
|
@ -13,6 +13,7 @@ import TabItem from '@theme/TabItem';
|
|||
|
||||
Docusaurus provides `<Tabs>` components that you can use thanks to [MDX](./markdown-features-react.mdx):
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```jsx
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
@ -27,13 +28,14 @@ import TabItem from '@theme/TabItem';
|
|||
<TabItem value="banana" label="Banana">
|
||||
This is a banana 🍌
|
||||
</TabItem>
|
||||
</Tabs>;
|
||||
</Tabs>
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<Tabs>
|
||||
<TabItem value="apple" label="Apple" default>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="banana" label="Banana">This is a banana 🍌</TabItem>
|
||||
</Tabs>
|
||||
|
@ -109,7 +111,7 @@ It is also possible to provide `values` and `defaultValue` props to `Tabs`:
|
|||
]}>
|
||||
<TabItem value="apple" label="Apple 2">This is an apple 🍎</TabItem>
|
||||
<TabItem value="orange" label="Orange 2">This is an orange 🍊</TabItem>
|
||||
<TabItem value="banana" label="Banana 2">This is a banana 🍌</TabItem>
|
||||
<TabItem value="banana" label="Banana 2" default>This is a banana 🍌</TabItem>
|
||||
</Tabs>
|
||||
</BrowserWindow>
|
||||
<br/>
|
||||
|
@ -121,17 +123,15 @@ It is also possible to provide `values` and `defaultValue` props to `Tabs`:
|
|||
|
||||
By default, all tabs are rendered eagerly during the build process, and search engines can index hidden tabs.
|
||||
|
||||
It is possible to only render the default tab with `<Tabs lazy={true} />`.
|
||||
It is possible to only render the default tab with `<Tabs lazy />`.
|
||||
|
||||
:::
|
||||
|
||||
## Displaying a default tab
|
||||
|
||||
Add `default` to one of the tab items to make it displayed by default. You can also set the `defaultValue` prop in the `Tabs` component to the label value of your choice.
|
||||
The first tab is displayed by default, and to override this behavior, you can specify a default tab by adding `default` to one of the tab items. You can also set the `defaultValue` prop of the `Tabs` component to the label value of your choice. For example, in the example above, either setting `default` for the `value="apple"` tab or setting `defaultValue="apple"` for the tabs forces the "Apple" tab to be open by default.
|
||||
|
||||
For example, in the example above, setting `default` for the `value="apple"` tab forces it to be open by default.
|
||||
|
||||
If none of the children contains the `default` prop, neither is the `defaultValue` provided for the `Tabs`, or it refers to an non-existing value, only the tab headings appear until the user clicks on a tab.
|
||||
Docusaurus will throw an error if a `defaultValue` is provided for the `Tabs` but it refers to an non-existing value. If you want none of the tabs to be shown by default, use `defaultValue={null}`.
|
||||
|
||||
## Syncing tab choices {#syncing-tab-choices}
|
||||
|
||||
|
@ -140,13 +140,13 @@ You may want choices of the same kind of tabs to sync with each other. For examp
|
|||
```jsx
|
||||
// highlight-next-line
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Use Ctrl + C to copy.</TabItem>
|
||||
<TabItem value="win" label="Windows">Use Ctrl + C to copy.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">Use Command + C to copy.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
// highlight-next-line
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Use Ctrl + V to paste.</TabItem>
|
||||
<TabItem value="win" label="Windows">Use Ctrl + V to paste.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">Use Command + V to paste.</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
@ -154,12 +154,12 @@ You may want choices of the same kind of tabs to sync with each other. For examp
|
|||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Use Ctrl + C to copy.</TabItem>
|
||||
<TabItem value="win" label="Windows">Use Ctrl + C to copy.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">Use Command + C to copy.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Use Ctrl + V to paste.</TabItem>
|
||||
<TabItem value="win" label="Windows">Use Ctrl + V to paste.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">Use Command + V to paste.</TabItem>
|
||||
</Tabs>
|
||||
</BrowserWindow>
|
||||
|
@ -170,7 +170,7 @@ For all tab groups that have the same `groupId`, the possible values do not need
|
|||
|
||||
```jsx
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>
|
||||
<TabItem value="win" label="Windows">
|
||||
I am Windows.
|
||||
</TabItem>
|
||||
<TabItem value="mac" label="MacOS">
|
||||
|
@ -185,7 +185,7 @@ For all tab groups that have the same `groupId`, the possible values do not need
|
|||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>I am Windows.</TabItem>
|
||||
<TabItem value="win" label="Windows">I am Windows.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">I am macOS.</TabItem>
|
||||
<TabItem value="linux" label="Linux">I am Linux.</TabItem>
|
||||
</Tabs>
|
||||
|
@ -199,13 +199,13 @@ Tab choices with different `groupId`s will not interfere with each other:
|
|||
```jsx
|
||||
// highlight-next-line
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Windows in windows.</TabItem>
|
||||
<TabItem value="win" label="Windows">Windows in windows.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">macOS is macOS.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
// highlight-next-line
|
||||
<Tabs groupId="non-mac-operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Windows is windows.</TabItem>
|
||||
<TabItem value="win" label="Windows">Windows is windows.</TabItem>
|
||||
<TabItem value="unix" label="Unix">Unix is unix.</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
@ -213,12 +213,12 @@ Tab choices with different `groupId`s will not interfere with each other:
|
|||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<Tabs groupId="operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Windows in windows.</TabItem>
|
||||
<TabItem value="win" label="Windows">Windows in windows.</TabItem>
|
||||
<TabItem value="mac" label="MacOS">macOS is macOS.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
<Tabs groupId="non-mac-operating-systems">
|
||||
<TabItem value="win" label="Windows" default>Windows is windows.</TabItem>
|
||||
<TabItem value="win" label="Windows">Windows is windows.</TabItem>
|
||||
<TabItem value="unix" label="Unix">Unix is unix.</TabItem>
|
||||
</Tabs>
|
||||
</BrowserWindow>
|
||||
|
@ -234,9 +234,7 @@ import TabItem from '@theme/TabItem';
|
|||
|
||||
// highlight-next-line
|
||||
<Tabs className="unique-tabs">
|
||||
<TabItem value="Apple" default>
|
||||
This is an apple 🍎
|
||||
</TabItem>
|
||||
<TabItem value="Apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="Orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="Banana">This is a banana 🍌</TabItem>
|
||||
</Tabs>;
|
||||
|
@ -245,7 +243,7 @@ import TabItem from '@theme/TabItem';
|
|||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<Tabs className="unique-tabs">
|
||||
<TabItem value="Apple" default>This is an apple 🍎</TabItem>
|
||||
<TabItem value="Apple">This is an apple 🍎</TabItem>
|
||||
<TabItem value="Orange">This is an orange 🍊</TabItem>
|
||||
<TabItem value="Banana">This is a banana 🍌</TabItem>
|
||||
</Tabs>
|
|
@ -2,6 +2,7 @@
|
|||
id: crowdin
|
||||
title: i18n - Using Crowdin
|
||||
slug: /i18n/crowdin
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
The i18n system of Docusaurus is **decoupled from any translation software**.
|
||||
|
@ -363,20 +364,15 @@ import Tabs from '@theme/Tabs';
|
|||
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' }
|
||||
]}>
|
||||
<TabItem value="bash">
|
||||
<Tabs>
|
||||
<TabItem value="bash" label="Bash">
|
||||
|
||||
```bash
|
||||
GIT_USER=<GITHUB_USERNAME> yarn deploy
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="windows">
|
||||
<TabItem value="windows" label="Windows">
|
||||
|
||||
```batch
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
|
@ -29,10 +29,10 @@ npm init docusaurus@latest [name] [template]
|
|||
Example:
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website classic
|
||||
npm init docusaurus@latest website classic
|
||||
```
|
||||
|
||||
If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus.
|
||||
If you do not specify `name` or `template`, it will prompt you for them. We recommend the `classic` template so that you can get started quickly, and it contains features found in Docusaurus 1. The `classic` template contains `@docusaurus/preset-classic` which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus.
|
||||
|
||||
**[FB-Only]:** If you are setting up a new Docusaurus website for a Facebook open source project, use the `facebook` template instead, which comes with some useful Facebook-specific defaults:
|
||||
|
||||
|
@ -40,22 +40,16 @@ If you do not specify `name` or `template`, it will prompt you for them. We reco
|
|||
npm init docusaurus@latest my-website facebook
|
||||
```
|
||||
|
||||
**[Experimental]:** If you want setting up a new website using [bootstrap](https://getbootstrap.com/), use the `bootstrap` template, like the following:
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website bootstrap
|
||||
```
|
||||
|
||||
If you want to skip installing dependencies, use the `--skip-install` option, like the following:
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website classic --skip-install
|
||||
npm init docusaurus@latest my-website classic -- --skip-install
|
||||
```
|
||||
|
||||
You can also use the template's TypeScript variant by passing the `--typescript` flag.
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website classic --typescript
|
||||
npm init docusaurus@latest my-website classic -- --typescript
|
||||
```
|
||||
|
||||
## Project structure {#project-structure}
|
|
@ -177,7 +177,7 @@ In comparison with statically generated HTML and interactivity added using `<scr
|
|||
- [GitHub](https://github.com/facebook/docusaurus)
|
||||
- [Twitter](https://twitter.com/docusaurus)
|
||||
- [Blog](/blog)
|
||||
- [Discord](https://discord.gg/Je6Ash6)
|
||||
- [Discord](https://discord.gg/docusaurus)
|
||||
|
||||
## Something missing? {#something-missing}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
id: lifecycle-apis
|
||||
title: Lifecycle APIs
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
:::caution
|
||||
|
@ -162,9 +163,9 @@ Plugins should use the data loaded in `loadContent` and construct the pages/rout
|
|||
|
||||
### `actions` {#actions}
|
||||
|
||||
`actions` contain two functions:
|
||||
`actions` contain three functions:
|
||||
|
||||
- `addRoute(config: RouteConfig): void`
|
||||
#### `addRoute(config: RouteConfig): void`
|
||||
|
||||
Create a route to add to the website.
|
||||
|
||||
|
@ -189,7 +190,7 @@ type Module =
|
|||
| string;
|
||||
```
|
||||
|
||||
- `createData(name: string, data: any): Promise<string>`
|
||||
#### `createData(name: string, data: any): Promise<string>`
|
||||
|
||||
A function to help you create static data (generally json or string), that you can provide to your routes as props.
|
||||
|
||||
|
@ -231,7 +232,7 @@ export default function friendsPlugin(context, options) {
|
|||
}
|
||||
```
|
||||
|
||||
- `setGlobalData(data: any): void`
|
||||
#### `setGlobalData(data: any): void`
|
||||
|
||||
This function permits to create some global plugin data, that can be read from any page, including the pages created by other plugins, and your theme layout.
|
||||
|
||||
|
@ -396,7 +397,7 @@ module.exports = function (context, options) {
|
|||
Called when a (production) build finishes.
|
||||
|
||||
```ts
|
||||
type Props = {
|
||||
interface Props {
|
||||
siteDir: string;
|
||||
generatedFilesDir: string;
|
||||
siteConfig: DocusaurusConfig;
|
||||
|
@ -407,7 +408,7 @@ type Props = {
|
|||
postBodyTags: string;
|
||||
routesPaths: string[];
|
||||
plugins: Plugin<any>[];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Example:
|
|
@ -2,6 +2,7 @@
|
|||
id: migration-manual
|
||||
title: Manual migration
|
||||
slug: /migration/manual
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
This manual migration process should be run after the [automated migration process](./migration-automated.md), to complete the missing parts, or debug issues in the migration CLI output.
|
|
@ -94,7 +94,7 @@ The [manual migration guide](./migration-manual.md) will give you all the manual
|
|||
|
||||
## Support {#support}
|
||||
|
||||
For any questions, you can ask in the [`#docusaurus-1-to-2-migration` Discord channel](https://discordapp.com/invite/kYaNd6V).
|
||||
For any questions, you can ask in the [`#migration-v1-to-v2` Discord channel](https://discord.gg/C3P6CxMMxY).
|
||||
|
||||
Feel free to tag [@slorber](https://github.com/slorber) in any migration PRs if you would like us to have a look.
|
||||
|
|
@ -35,16 +35,13 @@ module.exports = {
|
|||
|
||||
## Presets -> themes and plugins {#presets---themes-and-plugins}
|
||||
|
||||
Presets in some way are a shorthand function to add plugins and themes to your Docusaurus config. For example, you can specify a preset that includes the following themes and plugins,
|
||||
Presets are a shorthand function to add plugins and themes to your Docusaurus config. For example, you can specify a preset that includes the following themes and plugins,
|
||||
|
||||
```js
|
||||
module.exports = function preset(context, opts = {}) {
|
||||
return {
|
||||
themes: [
|
||||
require.resolve('@docusaurus/themes-cool'),
|
||||
require.resolve('@docusaurus/themes-bootstrap'),
|
||||
],
|
||||
plugins: [require.resolve('@docusaurus/plugin-blog')],
|
||||
themes: ['@docusaurus/theme-cool', opts.cool],
|
||||
plugins: ['@docusaurus/plugin-blog', opts.blog],
|
||||
};
|
||||
};
|
||||
```
|
||||
|
@ -53,8 +50,10 @@ then in your Docusaurus config, you may configure the preset instead:
|
|||
|
||||
```jsx {3} title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
presets: ['@docusaurus/preset-my-own'],
|
||||
presets: [
|
||||
'@docusaurus/preset-my-own',
|
||||
{cool: {hello: 'world'}, blog: {path: '/blog'}},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -62,8 +61,8 @@ This is equivalent of doing:
|
|||
|
||||
```jsx title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
themes: ['@docusaurus/themes-cool', '@docusaurus/themes-bootstrap'],
|
||||
plugins: ['@docusaurus/plugin-blog'],
|
||||
themes: ['@docusaurus/themes-cool', {hello: 'world'}],
|
||||
plugins: ['@docusaurus/plugin-blog', {path: '/blog'}],
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -132,51 +131,3 @@ module.exports = {
|
|||
],
|
||||
};
|
||||
```
|
||||
|
||||
### `@docusaurus/preset-bootstrap` {#docusauruspreset-bootstrap}
|
||||
|
||||
An alternative preset that uses Bootstrap styling.
|
||||
|
||||
| Themes | Plugins |
|
||||
| ----------------------------- | ---------------------------------- |
|
||||
| `@docusaurus/theme-bootstrap` | `@docusaurus/plugin-content-docs` |
|
||||
| | `@docusaurus/plugin-content-blog` |
|
||||
| | `@docusaurus/plugin-content-pages` |
|
||||
| | `@docusaurus/plugin-debug` |
|
||||
|
||||
To specify plugin options individually, you can provide the necessary fields to certain plugins, i.e. `docs` for `@docusaurus/theme-bootstrap`, pass them in the preset field, like this:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-bootstrap',
|
||||
{
|
||||
// Debug defaults to true in dev, false in prod
|
||||
debug: undefined,
|
||||
// Will be passed to @docusaurus/plugin-content-docs (false to disable)
|
||||
docs: {},
|
||||
// Will be passed to @docusaurus/plugin-content-blog (false to disable)
|
||||
blog: {},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
:::caution
|
||||
|
||||
This preset is work in progress
|
||||
|
||||
:::
|
||||
|
||||
<!--
|
||||
|
||||
Advanced guide on using and configuring presets
|
||||
|
||||
References
|
||||
---
|
||||
- [classic themes](/packages/docusaurus-preset-classic/src/index.js)
|
||||
- [babel docs on presets](https://babeljs.io/docs/en/presets)
|
||||
|
||||
-->
|
|
@ -6,18 +6,60 @@ keywords:
|
|||
- search
|
||||
---
|
||||
|
||||
Docusaurus' own `@docusaurus/preset-classic` supports a search integration.
|
||||
There are a few options you can use to add search to your website:
|
||||
|
||||
There are two main options, you can use [Algolia DocSearch](https://docsearch.algolia.com) or bring in your own `SearchBar` component.
|
||||
- 🥇 [Algolia DocSearch](#using-algolia-docsearch) (**official**)
|
||||
- 👥 [Typesense DocSearch](#using-typesense-docsearch)
|
||||
- 👥 [Local Search](#using-local-search)
|
||||
- 👥 [Your own `SearchBar` component](#using-your-own-search)
|
||||
|
||||
## Using Algolia DocSearch {#using-algolia-docsearch}
|
||||
:::info
|
||||
|
||||
Algolia DocSearch works by crawling the content of your website every 24 hours and putting all the content in an Algolia index. This content is then queried directly from your front-end using the Algolia API. Note that your website needs to be publicly available for this to work (i.e., not behind a firewall). The service is free.
|
||||
🥇 Docusaurus provides **first-class support** for [Algolia DocSearch](#using-algolia-docsearch).
|
||||
|
||||
If your website is [not eligible](https://docsearch.algolia.com/docs/who-can-apply) for the free, hosted version of DocSearch, or if your website sits behind a firewall, then you can [run your own](https://docsearch.algolia.com/docs/run-your-own/) DocSearch crawler. For best results, you may want to use a config file based on the [Docusaurus 2 config](https://github.com/algolia/docsearch-configs/blob/master/configs/docusaurus-2.json).
|
||||
👥 Other options are **maintained by the community**: please report bugs to their respective repositories.
|
||||
|
||||
:::
|
||||
|
||||
## 🥇 Using Algolia DocSearch {#using-algolia-docsearch}
|
||||
|
||||
Docusaurus has **official support** for [Algolia DocSearch](https://docsearch.algolia.com).
|
||||
|
||||
The service is **free** in most cases: just [apply to the DocSearch program](https://docsearch.algolia.com/docs/apply).
|
||||
|
||||
It works by crawling the content of your website every 24 hours and putting all the content in an Algolia index. This content is then queried directly from your front-end using the Algolia API.
|
||||
|
||||
If your website is [not eligible](https://docsearch.algolia.com/docs/who-can-apply) for the free, hosted version of DocSearch, or if your website sits behind a firewall and is not public, then you can [run your own](https://docsearch.algolia.com/docs/run-your-own/) DocSearch crawler.
|
||||
|
||||
:::note
|
||||
|
||||
By default, the Docusaurus preset generates a [sitemap.xml](https://docusaurus.io/sitemap.xml) that the Algolia crawler can use.
|
||||
|
||||
:::
|
||||
|
||||
### Index Configuration {#algolia-index-configuration}
|
||||
|
||||
After applying, your site's DocSearch config should be created at:
|
||||
|
||||
```
|
||||
https://github.com/algolia/docsearch-configs/blob/master/configs/<indexName>.json
|
||||
```
|
||||
|
||||
This configuration file can be updated by:
|
||||
|
||||
- [**asking for help**](#algolia-support): the DocSearch team can help you maintain it
|
||||
- opening a pull-requests in [algolia/docsearch-configs](https://github.com/algolia/docsearch-configs)
|
||||
|
||||
:::caution
|
||||
|
||||
It is highly recommended using a config similar to the [**Docusaurus 2 website config**](https://github.com/algolia/docsearch-configs/blob/master/configs/docusaurus-2.json).
|
||||
|
||||
:::
|
||||
|
||||
### Connecting Algolia {#connecting-algolia}
|
||||
|
||||
Docusaurus' own `@docusaurus/preset-classic` supports an Algolia DocSearch integration.
|
||||
|
||||
To connect your docs with Algolia, first add the package to your website:
|
||||
|
||||
```bash npm2yarn
|
||||
|
@ -33,7 +75,12 @@ module.exports = {
|
|||
// ...
|
||||
// highlight-start
|
||||
algolia: {
|
||||
apiKey: 'YOUR_API_KEY',
|
||||
// If Algolia did not provide you any appId, use 'BH4D9OD16A'
|
||||
appId: 'YOUR_APP_ID',
|
||||
|
||||
// Public API key: it is safe to commit it
|
||||
apiKey: 'YOUR_SEARCH_API_KEY',
|
||||
|
||||
indexName: 'YOUR_INDEX_NAME',
|
||||
|
||||
// Optional: see doc section below
|
||||
|
@ -58,6 +105,14 @@ The `searchParameters` option used to be named `algoliaOptions` in Docusaurus v1
|
|||
|
||||
:::
|
||||
|
||||
:::caution
|
||||
|
||||
The search feature will not work reliably until Algolia crawls your site with the **search plugin enabled**.
|
||||
|
||||
If you are installing the Algolia plugin for the first time and want to ensure the search feature works before deploying it to production, you can ask the DocSearch team to trigger a crawl on a staging environment url or deploy preview.
|
||||
|
||||
:::
|
||||
|
||||
### Contextual search {#contextual-search}
|
||||
|
||||
Contextual search is mostly useful for versioned Docusaurus sites.
|
||||
|
@ -89,24 +144,6 @@ When using `contextualSearch: true`, the contextual facet filters will be merged
|
|||
|
||||
:::
|
||||
|
||||
### Custom Application ID {#custom-application-id}
|
||||
|
||||
When [running your own](https://docsearch.algolia.com/docs/run-your-own/) DocSearch crawler, it is [required to set the `appId` configuration key](https://docsearch.algolia.com/docs/behavior/#appid) to your own Application ID. If left unset, the `appId` will fallback to the one used with the free, hosted version of Algolia DocSearch.
|
||||
|
||||
```jsx title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
themeConfig: {
|
||||
// ...
|
||||
// highlight-start
|
||||
algolia: {
|
||||
appId: 'YOUR_APP_ID',
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Styling your Algolia search {#styling-your-algolia-search}
|
||||
|
||||
By default, DocSearch comes with a fine-tuned theme that was designed for accessibility, making sure that colors and contrasts respect standards.
|
||||
|
@ -182,7 +219,37 @@ If you prefer to edit the Algolia search React component, swizzle the `SearchBar
|
|||
npm run swizzle @docusaurus/theme-search-algolia SearchBar
|
||||
```
|
||||
|
||||
## Using your own search {#using-your-own-search}
|
||||
### Support {#algolia-support}
|
||||
|
||||
The Algolia DocSearch team can help you figure out search problems on your site.
|
||||
|
||||
You can contact them by [email](mailto:documentationsearch@algolia.com) or on [Discord](https://discord.gg/tXdr5mP).
|
||||
|
||||
Docusaurus also has an `#algolia` channel on [Discord](https://discordapp.com/invite/docusaurus).
|
||||
|
||||
## 👥 Using Typesense DocSearch {#using-typesense-docsearch}
|
||||
|
||||
[Typesense](https://typesense.org) DocSearch works similar to Algolia DocSearch, except that your website is indexed into a Typesense search cluster.
|
||||
|
||||
Typesense is an [open source](https://github.com/typesense/typesense) instant-search engine that you can either:
|
||||
|
||||
- [Self-Host](https://typesense.org/docs/latest/guide/install-typesense.html#option-2-local-machine-self-hosting) on your own servers or
|
||||
- Use the Managed [Typesense Cloud](https://cloud.typesense.org) service.
|
||||
|
||||
Similar to Algolia DocSearch, there are two components:
|
||||
|
||||
- [typesense-docsearch-scraper](https://github.com/typesense/typesense-docsearch-scraper) - which scrapes your website and indexes the data in your Typesense cluster.
|
||||
- [docusaurus-theme-search-typesense](https://github.com/typesense/docusaurus-theme-search-typesense) - a search bar UI component to add to your website.
|
||||
|
||||
Read a step-by-step walk-through of how to [run typesense-docsearch-scraper here](https://typesense.org/docs/latest/guide/docsearch.html#step-1-set-up-docsearch-scraper) and how to [install the Search Bar in your Docusaurus Site here](https://typesense.org/docs/latest/guide/docsearch.html#option-a-docusaurus-powered-sites).
|
||||
|
||||
## 👥 Using Local Search {#using-local-search}
|
||||
|
||||
You can use a local search plugin for websites where the search index is small and can be downloaded to your users' browsers when they visit your website.
|
||||
|
||||
You'll find a list of community-supported [local search plugins listed here](https://docusaurus.io/community/resources#search).
|
||||
|
||||
## 👥 Using your own search {#using-your-own-search}
|
||||
|
||||
To use your own search, swizzle the `SearchBar` component in `@docusaurus/theme-classic`
|
||||
|
|
@ -3,24 +3,24 @@ id: typescript-support
|
|||
title: TypeScript Support
|
||||
---
|
||||
|
||||
Docusaurus is written in TypeScript, and provide first-class TypeScript support.
|
||||
Docusaurus is written in TypeScript, and provides first-class TypeScript support.
|
||||
|
||||
## Initialization {#initialization}
|
||||
|
||||
Docusaurus supports writing and using TypeScript theme components. If the init template provides a Typescript variant, you can directly initialize a site with full TypeScript support by using the `--typescript` flag.
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website classic --typescript
|
||||
npm init docusaurus@latest my-website classic -- --typescript
|
||||
```
|
||||
|
||||
Below are some guides on how to migrate an existing project to TypeScript.
|
||||
|
||||
## Setup {#setup}
|
||||
|
||||
To start using TypeScript, add `@docusaurus/module-type-aliases` and some `@types` dependencies to your project:
|
||||
To start using TypeScript, add `@docusaurus/module-type-aliases` and the base TS config to your project:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save-dev typescript @docusaurus/module-type-aliases @types/react @types/react-router-dom @types/react-helmet @tsconfig/docusaurus
|
||||
npm install --save-dev typescript @docusaurus/module-type-aliases @tsconfig/docusaurus
|
||||
```
|
||||
|
||||
Then add `tsconfig.json` to your project root with the following content:
|
||||
|
@ -42,8 +42,11 @@ It is **not possible** to use a TypeScript config file in Docusaurus, unless you
|
|||
|
||||
We recommend using [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html):
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```js title="docusaurus.config.js"
|
||||
// highlight-start
|
||||
// @ts-check
|
||||
// highlight-end
|
||||
|
||||
// highlight-start
|
||||
/** @type {import('@docusaurus/types').Plugin} */
|
||||
// highlight-end
|
||||
|
@ -54,9 +57,9 @@ function MyPlugin(context, options) {
|
|||
}
|
||||
|
||||
// highlight-start
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
// highlight-end
|
||||
(module.exports = {
|
||||
const config = {
|
||||
title: 'Docusaurus',
|
||||
tagline: 'Build optimized websites quickly, focus on your content',
|
||||
organizationName: 'facebook',
|
||||
|
@ -98,9 +101,10 @@ function MyPlugin(context, options) {
|
|||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
:::tip
|
||||
|
||||
|
@ -110,6 +114,18 @@ The best IDEs (VSCode, WebStorm, Intellij...) will provide a nice auto-completio
|
|||
|
||||
:::
|
||||
|
||||
:::info
|
||||
|
||||
By default, the Docusaurus TypeScript config does not type-check JavaScript files.
|
||||
|
||||
The `// @ts-check` comment ensures the config file is properly type-checked when running:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run tsc
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## Swizzling TypeScript theme components {#swizzling-typescript-theme-components}
|
||||
|
||||
For themes that supports TypeScript theme components, you can add the `--typescript` flag to the end of swizzling command to get TypeScript source code. For example, the following command will generate `index.tsx` and `styles.module.css` into `src/theme/Footer`.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue