diff --git a/admin/new.docusaurus.io/package.json b/admin/new.docusaurus.io/package.json index cb3fe5ed85e6..eccd00e8b54c 100644 --- a/admin/new.docusaurus.io/package.json +++ b/admin/new.docusaurus.io/package.json @@ -1,6 +1,6 @@ { "name": "new.docusaurus.io", - "version": "2.1.0", + "version": "2.2.0", "private": true, "scripts": { "start": "npx --package netlify-cli netlify dev" diff --git a/lerna.json b/lerna.json index 0f7756b7af0f..146c099d38cc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.0", + "version": "2.2.0", "npmClient": "yarn", "useWorkspaces": true, "changelog": { diff --git a/packages/create-docusaurus/package.json b/packages/create-docusaurus/package.json index fc1c7e8e48e5..a79e9902fbd1 100755 --- a/packages/create-docusaurus/package.json +++ b/packages/create-docusaurus/package.json @@ -1,6 +1,6 @@ { "name": "create-docusaurus", - "version": "2.1.0", + "version": "2.2.0", "description": "Create Docusaurus apps easily.", "type": "module", "repository": { @@ -22,8 +22,8 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/logger": "2.1.0", - "@docusaurus/utils": "2.1.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/utils": "2.2.0", "commander": "^5.1.0", "fs-extra": "^10.1.0", "lodash": "^4.17.21", diff --git a/packages/create-docusaurus/src/index.ts b/packages/create-docusaurus/src/index.ts index b996c3e90b6b..d2ac2150fe8c 100755 --- a/packages/create-docusaurus/src/index.ts +++ b/packages/create-docusaurus/src/index.ts @@ -456,8 +456,10 @@ export default async function init( reqTemplate?: string, cliOptions: CLIOptions = {}, ): Promise { - const templates = await readTemplates(); - const siteName = await getSiteName(reqName, rootDir); + const [templates, siteName] = await Promise.all([ + readTemplates(), + getSiteName(reqName, rootDir), + ]); const dest = path.resolve(rootDir, siteName); const source = await getSource(reqTemplate, templates, cliOptions); diff --git a/packages/create-docusaurus/templates/classic-typescript/package.json b/packages/create-docusaurus/templates/classic-typescript/package.json index 38b5117542f8..dd08b3cb39e7 100644 --- a/packages/create-docusaurus/templates/classic-typescript/package.json +++ b/packages/create-docusaurus/templates/classic-typescript/package.json @@ -1,6 +1,6 @@ { "name": "docusaurus-2-classic-typescript-template", - "version": "2.1.0", + "version": "2.2.0", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -15,8 +15,8 @@ "typecheck": "tsc" }, "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/preset-classic": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/preset-classic": "2.2.0", "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", @@ -24,7 +24,7 @@ "react-dom": "^17.0.2" }, "devDependencies": { - "@docusaurus/module-type-aliases": "2.1.0", + "@docusaurus/module-type-aliases": "2.2.0", "@tsconfig/docusaurus": "^1.0.5", "typescript": "^4.7.4" }, diff --git a/packages/create-docusaurus/templates/classic/package.json b/packages/create-docusaurus/templates/classic/package.json index 8d06adc2f779..49f99873d7b8 100644 --- a/packages/create-docusaurus/templates/classic/package.json +++ b/packages/create-docusaurus/templates/classic/package.json @@ -1,6 +1,6 @@ { "name": "docusaurus-2-classic-template", - "version": "2.1.0", + "version": "2.2.0", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -14,8 +14,8 @@ "write-heading-ids": "docusaurus write-heading-ids" }, "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/preset-classic": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/preset-classic": "2.2.0", "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", @@ -23,7 +23,7 @@ "react-dom": "^17.0.2" }, "devDependencies": { - "@docusaurus/module-type-aliases": "2.1.0" + "@docusaurus/module-type-aliases": "2.2.0" }, "browserslist": { "production": [ diff --git a/packages/create-docusaurus/templates/facebook/package.json b/packages/create-docusaurus/templates/facebook/package.json index fc20b301b2ae..1e9345099b75 100644 --- a/packages/create-docusaurus/templates/facebook/package.json +++ b/packages/create-docusaurus/templates/facebook/package.json @@ -1,6 +1,6 @@ { "name": "docusaurus-2-facebook-template", - "version": "2.1.0", + "version": "2.2.0", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -18,8 +18,8 @@ "format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\"" }, "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/preset-classic": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/preset-classic": "2.2.0", "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "react": "^17.0.2", diff --git a/packages/docusaurus-cssnano-preset/package.json b/packages/docusaurus-cssnano-preset/package.json index 19f2c3a1b4cc..a2fcd9d3162d 100644 --- a/packages/docusaurus-cssnano-preset/package.json +++ b/packages/docusaurus-cssnano-preset/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/cssnano-preset", - "version": "2.1.0", + "version": "2.2.0", "description": "Advanced cssnano preset for maximum optimization.", "main": "lib/index.js", "license": "MIT", diff --git a/packages/docusaurus-logger/package.json b/packages/docusaurus-logger/package.json index dccd046feef6..ca5d5ea818f6 100644 --- a/packages/docusaurus-logger/package.json +++ b/packages/docusaurus-logger/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/logger", - "version": "2.1.0", + "version": "2.2.0", "description": "An encapsulated logger for semantically formatting console messages.", "main": "./lib/index.js", "repository": { diff --git a/packages/docusaurus-mdx-loader/package.json b/packages/docusaurus-mdx-loader/package.json index bc270024bbe5..d6dc246f9ab7 100644 --- a/packages/docusaurus-mdx-loader/package.json +++ b/packages/docusaurus-mdx-loader/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/mdx-loader", - "version": "2.1.0", + "version": "2.2.0", "description": "Docusaurus Loader for MDX", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,8 +20,8 @@ "dependencies": { "@babel/parser": "^7.18.8", "@babel/traverse": "^7.18.8", - "@docusaurus/logger": "2.1.0", - "@docusaurus/utils": "2.1.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/utils": "2.2.0", "@mdx-js/mdx": "^1.6.22", "escape-html": "^1.0.3", "file-loader": "^6.2.0", @@ -37,9 +37,10 @@ "webpack": "^5.73.0" }, "devDependencies": { - "@docusaurus/types": "2.1.0", + "@docusaurus/types": "2.2.0", "@types/escape-html": "^1.0.2", "@types/mdast": "^3.0.10", + "@types/mermaid": "^8.2.9", "@types/stringify-object": "^3.3.1", "@types/unist": "^2.0.6", "rehype-stringify": "^8.0.0", diff --git a/packages/docusaurus-mdx-loader/src/loader.ts b/packages/docusaurus-mdx-loader/src/loader.ts index 764d62c2bdc5..1b40d5833c8d 100644 --- a/packages/docusaurus-mdx-loader/src/loader.ts +++ b/packages/docusaurus-mdx-loader/src/loader.ts @@ -22,8 +22,10 @@ import toc from './remark/toc'; import unwrapMdxCodeBlocks from './remark/unwrapMdxCodeBlocks'; import transformImage from './remark/transformImage'; import transformLinks from './remark/transformLinks'; +import mermaid from './remark/mermaid'; import transformAdmonitions from './remark/admonitions'; +import type {MarkdownConfig} from '@docusaurus/types'; import type {LoaderContext} from 'webpack'; import type {Processor, Plugin} from 'unified'; import type {AdmonitionOptions} from './remark/admonitions'; @@ -61,6 +63,7 @@ export type MDXOptions = { }; export type Options = Partial & { + markdownConfig: MarkdownConfig; staticDirs: string[]; siteDir: string; isMDXPartial?: (filePath: string) => boolean; @@ -71,7 +74,6 @@ export type Options = Partial & { frontMatter: {[key: string]: unknown}; metadata: {[key: string]: unknown}; }) => {[key: string]: unknown}; - filepath: string; }; /** @@ -171,6 +173,7 @@ export async function mdxLoader( ...(reqOptions.beforeDefaultRemarkPlugins ?? []), ...getAdmonitionsPlugins(reqOptions.admonitions ?? false), ...DEFAULT_OPTIONS.remarkPlugins, + ...(reqOptions.markdownConfig.mermaid ? [mermaid] : []), [ transformImage, { diff --git a/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/__snapshots__/index.test.ts.snap b/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/__snapshots__/index.test.ts.snap new file mode 100644 index 000000000000..157f963ccdb3 --- /dev/null +++ b/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/__snapshots__/index.test.ts.snap @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`mermaid remark plugin does nothing if there's no mermaid code block 1`] = ` +" + + +const layoutProps = { + +}; +const MDXLayout = "wrapper" +export default function MDXContent({ + components, + ...props +}) { + return +

{\`Heading 1\`}

+

{\`No Mermaid diagram :(\`}

+
{\`this is not mermaid
+\`}
+
; +} + +; +MDXContent.isMDXComponent = true;" +`; + +exports[`mermaid remark plugin works for basic mermaid code blocks 1`] = ` +" + + +const layoutProps = { + +}; +const MDXLayout = "wrapper" +export default function MDXContent({ + components, + ...props +}) { + return +

{\`Heading 1\`}

+ B;/n A-->C;/n B-->D;/n C-->D;" + }}> +
; +} + +; +MDXContent.isMDXComponent = true;" +`; diff --git a/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/index.test.ts b/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/index.test.ts new file mode 100644 index 000000000000..e61272955427 --- /dev/null +++ b/packages/docusaurus-mdx-loader/src/remark/mermaid/__tests__/index.test.ts @@ -0,0 +1,46 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {createCompiler} from '@mdx-js/mdx'; +import mermaid from '..'; + +describe('mermaid remark plugin', () => { + function createTestCompiler() { + return createCompiler({ + remarkPlugins: [mermaid], + }); + } + + it("does nothing if there's no mermaid code block", async () => { + const mdxCompiler = createTestCompiler(); + const result = await mdxCompiler.process( + `# Heading 1 + +No Mermaid diagram :( + +\`\`\`js +this is not mermaid +\`\`\` +`, + ); + expect(result.contents).toMatchSnapshot(); + }); + + it('works for basic mermaid code blocks', async () => { + const mdxCompiler = createTestCompiler(); + const result = await mdxCompiler.process(`# Heading 1 + +\`\`\`mermaid +graph TD; + A-->B; + A-->C; + B-->D; + C-->D; +\`\`\``); + expect(result.contents).toMatchSnapshot(); + }); +}); diff --git a/packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts b/packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts new file mode 100644 index 000000000000..d0b6232cdfad --- /dev/null +++ b/packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import visit from 'unist-util-visit'; +import type {Transformer} from 'unified'; +import type {Code} from 'mdast'; + +// TODO: this plugin shouldn't be in the core MDX loader +// After we allow plugins to provide Remark/Rehype plugins (see +// https://github.com/facebook/docusaurus/issues/6370), this should be provided +// by theme-mermaid itself +export default function plugin(): Transformer { + return (root) => { + visit(root, 'code', (node: Code, index, parent) => { + if (node.lang === 'mermaid') { + parent!.children.splice(index, 1, { + type: 'mermaidCodeBlock', + data: { + hName: 'mermaid', + hProperties: { + value: node.value, + }, + }, + }); + } + }); + }; +} diff --git a/packages/docusaurus-migrate/package.json b/packages/docusaurus-migrate/package.json index 87fcfbaf3c6e..0b43a166c261 100644 --- a/packages/docusaurus-migrate/package.json +++ b/packages/docusaurus-migrate/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/migrate", - "version": "2.1.0", + "version": "2.2.0", "description": "A CLI tool to migrate from older versions of Docusaurus.", "license": "MIT", "engines": { @@ -24,8 +24,8 @@ "dependencies": { "@babel/core": "^7.18.6", "@babel/preset-env": "^7.18.6", - "@docusaurus/logger": "2.1.0", - "@docusaurus/utils": "2.1.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/utils": "2.2.0", "@mapbox/hast-util-to-jsx": "^2.0.0", "color": "^4.2.3", "commander": "^5.1.0", diff --git a/packages/docusaurus-module-type-aliases/package.json b/packages/docusaurus-module-type-aliases/package.json index afa3a202d6a6..a3ca49abc086 100644 --- a/packages/docusaurus-module-type-aliases/package.json +++ b/packages/docusaurus-module-type-aliases/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/module-type-aliases", - "version": "2.1.0", + "version": "2.2.0", "description": "Docusaurus module type aliases.", "types": "./src/index.d.ts", "publishConfig": { @@ -13,7 +13,7 @@ }, "dependencies": { "@docusaurus/react-loadable": "5.5.2", - "@docusaurus/types": "2.1.0", + "@docusaurus/types": "2.2.0", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", diff --git a/packages/docusaurus-plugin-client-redirects/package.json b/packages/docusaurus-plugin-client-redirects/package.json index 486b219e189a..042b6bf08d07 100644 --- a/packages/docusaurus-plugin-client-redirects/package.json +++ b/packages/docusaurus-plugin-client-redirects/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-client-redirects", - "version": "2.1.0", + "version": "2.2.0", "description": "Client redirects plugin for Docusaurus.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -18,18 +18,18 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/logger": "2.1.0", - "@docusaurus/utils": "2.1.0", - "@docusaurus/utils-common": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/utils": "2.2.0", + "@docusaurus/utils-common": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "eta": "^1.12.3", "fs-extra": "^10.1.0", "lodash": "^4.17.21", "tslib": "^2.4.0" }, "devDependencies": { - "@docusaurus/types": "2.1.0" + "@docusaurus/types": "2.2.0" }, "peerDependencies": { "react": "^16.8.4 || ^17.0.0", diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/collectRedirects.test.ts.snap b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/collectRedirects.test.ts.snap index a9ce789f9861..25887592b6a4 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/collectRedirects.test.ts.snap +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/collectRedirects.test.ts.snap @@ -1,8 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`collectRedirects throw if plugin option redirects contain invalid to paths 1`] = ` -"You are trying to create client-side redirections to paths that do not exist: -- /this/path/does/not/exist2 +"You are trying to create client-side redirections to invalid paths. + +These paths are redirected to but do not exist: - /this/path/does/not/exist2 Valid paths you can redirect to: @@ -12,6 +13,22 @@ Valid paths you can redirect to: " `; +exports[`collectRedirects throw if plugin option redirects contain to paths with mismatching trailing slash 1`] = ` +"You are trying to create client-side redirections to invalid paths. + +These paths do exist, but because you have explicitly set trailingSlash=false, you need to write the path without trailing slash: +- /someExistingPath/ +" +`; + +exports[`collectRedirects throw if plugin option redirects contain to paths with mismatching trailing slash 2`] = ` +"You are trying to create client-side redirections to invalid paths. + +These paths do exist, but because you have explicitly set trailingSlash=true, you need to write the path with trailing slash: +- /someExistingPath +" +`; + exports[`collectRedirects throws if redirect creator creates array of array redirect 1`] = ` "Some created redirects are invalid: - {"from":["/fromPath"],"to":"/"} => Validation error: "from" must be a string diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/createRedirectPageContent.test.ts.snap b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/createRedirectPageContent.test.ts.snap index a98e1c3f7ed7..38da1a1723ec 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/createRedirectPageContent.test.ts.snap +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/createRedirectPageContent.test.ts.snap @@ -9,7 +9,7 @@ exports[`createRedirectPageContent encodes uri special chars 1`] = ` " `; @@ -23,7 +23,7 @@ exports[`createRedirectPageContent works 1`] = ` " `; diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/writeRedirectFiles.test.ts.snap b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/writeRedirectFiles.test.ts.snap index a344a553cc34..3c53d36e7c1a 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/writeRedirectFiles.test.ts.snap +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/__snapshots__/writeRedirectFiles.test.ts.snap @@ -10,7 +10,7 @@ exports[`toRedirectFiles creates appropriate metadata for empty baseUrl: fileCon ", ] @@ -26,7 +26,7 @@ exports[`toRedirectFiles creates appropriate metadata for root baseUrl: fileCont ", ] @@ -42,7 +42,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC ", " @@ -53,7 +53,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC ", " @@ -64,7 +64,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC ", ] @@ -80,7 +80,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo ", " @@ -91,7 +91,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo ", " @@ -102,7 +102,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo ", ] @@ -118,7 +118,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f ", " @@ -129,7 +129,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f ", " @@ -140,7 +140,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f ", ] diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts b/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts index e9a200c98943..021eba260387 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts @@ -220,6 +220,69 @@ describe('collectRedirects', () => { ).toThrowErrorMatchingSnapshot(); }); + it('tolerates mismatched trailing slash if option is undefined', () => { + expect( + collectRedirects( + createTestPluginContext( + { + redirects: [ + { + from: '/someLegacyPath', + to: '/somePath', + }, + ], + }, + ['/', '/somePath/'], + {trailingSlash: undefined}, + ), + undefined, + ), + ).toEqual([ + { + from: '/someLegacyPath', + to: '/somePath', + }, + ]); + }); + + it('throw if plugin option redirects contain to paths with mismatching trailing slash', () => { + expect(() => + collectRedirects( + createTestPluginContext( + { + redirects: [ + { + from: '/someLegacyPath', + to: '/someExistingPath/', + }, + ], + }, + ['/', '/someExistingPath', '/anotherExistingPath'], + {trailingSlash: false}, + ), + undefined, + ), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + collectRedirects( + createTestPluginContext( + { + redirects: [ + { + from: '/someLegacyPath', + to: '/someExistingPath', + }, + ], + }, + ['/', '/someExistingPath/', '/anotherExistingPath/'], + {trailingSlash: true}, + ), + undefined, + ), + ).toThrowErrorMatchingSnapshot(); + }); + it('collects redirects with custom redirect creator', () => { expect( collectRedirects( diff --git a/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts b/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts index 605a2b4af75f..666c51e433ab 100644 --- a/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts +++ b/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts @@ -7,6 +7,7 @@ import _ from 'lodash'; import logger from '@docusaurus/logger'; +import {addTrailingSlash, removeTrailingSlash} from '@docusaurus/utils'; import {applyTrailingSlash} from '@docusaurus/utils-common'; import { createFromExtensionsRedirects, @@ -80,16 +81,59 @@ function validateCollectedRedirects( const allowedToPaths = pluginContext.relativeRoutesPaths; const toPaths = redirects.map((redirect) => redirect.to); - const illegalToPaths = _.difference(toPaths, allowedToPaths); - if (illegalToPaths.length > 0) { - throw new Error( - `You are trying to create client-side redirections to paths that do not exist: -- ${illegalToPaths.join('\n- ')} + const trailingSlashConfig = pluginContext.siteConfig.trailingSlash; + // Key is the path, value is whether a valid toPath with a different trailing + // slash exists; if the key doesn't exist it means it's valid + const differByTrailSlash = new Map(toPaths.map((path) => [path, false])); + allowedToPaths.forEach((toPath) => { + if (differByTrailSlash.has(toPath)) { + differByTrailSlash.delete(toPath); + } else if (differByTrailSlash.has(removeTrailingSlash(toPath))) { + if (trailingSlashConfig === true) { + differByTrailSlash.set(removeTrailingSlash(toPath), true); + } else { + differByTrailSlash.delete(removeTrailingSlash(toPath)); + } + } else if (differByTrailSlash.has(addTrailingSlash(toPath))) { + if (trailingSlashConfig === false) { + differByTrailSlash.set(addTrailingSlash(toPath), true); + } else { + differByTrailSlash.delete(addTrailingSlash(toPath)); + } + } + }); + if (differByTrailSlash.size > 0) { + console.log(differByTrailSlash); + const errors = Array.from(differByTrailSlash.entries()); + + let message = + 'You are trying to create client-side redirections to invalid paths.\n'; + + const [trailingSlashIssues, invalidPaths] = _.partition( + errors, + ([, differ]) => differ, + ); + + if (trailingSlashIssues.length) { + message += ` +These paths do exist, but because you have explicitly set trailingSlash=${trailingSlashConfig}, you need to write the path ${ + trailingSlashConfig ? 'with trailing slash' : 'without trailing slash' + }: +- ${trailingSlashIssues.map(([p]) => p).join('\n- ')} +`; + } + + if (invalidPaths.length) { + message += ` +These paths are redirected to but do not exist: +- ${invalidPaths.map(([p]) => p).join('\n- ')} Valid paths you can redirect to: - ${allowedToPaths.join('\n- ')} -`, - ); +`; + } + + throw new Error(message); } } diff --git a/packages/docusaurus-plugin-client-redirects/src/templates/redirectPage.template.html.ts b/packages/docusaurus-plugin-client-redirects/src/templates/redirectPage.template.html.ts index 0ac3b4920d11..beb4579fbf79 100644 --- a/packages/docusaurus-plugin-client-redirects/src/templates/redirectPage.template.html.ts +++ b/packages/docusaurus-plugin-client-redirects/src/templates/redirectPage.template.html.ts @@ -14,7 +14,7 @@ export default ` `; diff --git a/packages/docusaurus-plugin-content-blog/package.json b/packages/docusaurus-plugin-content-blog/package.json index 46096fe728f4..adb9ab6d012b 100644 --- a/packages/docusaurus-plugin-content-blog/package.json +++ b/packages/docusaurus-plugin-content-blog/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-content-blog", - "version": "2.1.0", + "version": "2.2.0", "description": "Blog plugin for Docusaurus.", "main": "lib/index.js", "types": "src/plugin-content-blog.d.ts", @@ -18,13 +18,13 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/logger": "2.1.0", - "@docusaurus/mdx-loader": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils": "2.1.0", - "@docusaurus/utils-common": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/mdx-loader": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils": "2.2.0", + "@docusaurus/utils-common": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "cheerio": "^1.0.0-rc.12", "feed": "^4.2.2", "fs-extra": "^10.1.0", diff --git a/packages/docusaurus-plugin-content-blog/src/index.ts b/packages/docusaurus-plugin-content-blog/src/index.ts index 315c87e6a792..51bdf7516c32 100644 --- a/packages/docusaurus-plugin-content-blog/src/index.ts +++ b/packages/docusaurus-plugin-content-blog/src/index.ts @@ -455,6 +455,7 @@ export default async function pluginContentBlog( (author) => author.imageURL, ), }), + markdownConfig: siteConfig.markdown, }, }, { diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index 0332ba6f49ad..c5a43d6537bd 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -1,10 +1,11 @@ { "name": "@docusaurus/plugin-content-docs", - "version": "2.1.0", + "version": "2.2.0", "description": "Docs plugin for Docusaurus.", "main": "lib/index.js", "sideEffects": false, "exports": { + "./lib/*": "./lib/*", "./src/*": "./src/*", "./client": { "type": "./lib/client/index.d.ts", @@ -34,13 +35,13 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/logger": "2.1.0", - "@docusaurus/mdx-loader": "2.1.0", - "@docusaurus/module-type-aliases": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/mdx-loader": "2.2.0", + "@docusaurus/module-type-aliases": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "@types/react-router-config": "^5.0.6", "combine-promises": "^1.1.0", "fs-extra": "^10.1.0", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts index 4ccff773817c..39a762f714ca 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts @@ -93,6 +93,18 @@ function createTestUtils({ }); } + // Makes it easier to assert failure cases + async function getProcessDocFileError( + docFileArg: DocFile | string, + ): Promise { + try { + await processDocFile(docFileArg); + return new Error("unexpected: getProcessDocFileError didn't crash"); + } catch (e) { + return e as Error; + } + } + async function testMeta( docFileSource: string, expectedMetadata: Optional< @@ -172,7 +184,13 @@ function createTestUtils({ }; } - return {processDocFile, testMeta, testSlug, generateNavigation}; + return { + processDocFile, + getProcessDocFileError, + testMeta, + testSlug, + generateNavigation, + }; } describe('simple site', () => { @@ -683,16 +701,21 @@ describe('simple site', () => { it('docs with invalid id', async () => { const {defaultTestUtils} = await loadSite(); - await expect(async () => - defaultTestUtils.processDocFile( - createFakeDocFile({ - source: 'some/fake/path', - frontMatter: { - id: 'Hello/world', - }, - }), - ), - ).rejects.toThrowErrorMatchingInlineSnapshot( + + const error = await defaultTestUtils.getProcessDocFileError( + createFakeDocFile({ + source: 'some/fake/path', + frontMatter: { + id: 'Hello/world', + }, + }), + ); + + expect(error.message).toMatchInlineSnapshot( + `"Can't process doc metadata for doc at path path=some/fake/path in version name=current"`, + ); + expect(error.cause).toBeDefined(); + expect(error.cause!.message).toMatchInlineSnapshot( `"Document id "Hello/world" cannot include slash."`, ); }); diff --git a/packages/docusaurus-plugin-content-docs/src/docs.ts b/packages/docusaurus-plugin-content-docs/src/docs.ts index 7d13e40eb8cd..40fe33eb52da 100644 --- a/packages/docusaurus-plugin-content-docs/src/docs.ts +++ b/packages/docusaurus-plugin-content-docs/src/docs.ts @@ -316,7 +316,7 @@ async function doProcessDocMetadata({ }; } -export function processDocMetadata(args: { +export async function processDocMetadata(args: { docFile: DocFile; versionMetadata: VersionMetadata; context: LoadContext; @@ -324,10 +324,12 @@ export function processDocMetadata(args: { env: DocEnv; }): Promise { try { - return doProcessDocMetadata(args); + return await doProcessDocMetadata(args); } catch (err) { - logger.error`Can't process doc metadata for doc at path path=${args.docFile.filePath} in version name=${args.versionMetadata.versionName}`; - throw err; + throw new Error( + `Can't process doc metadata for doc at path path=${args.docFile.filePath} in version name=${args.versionMetadata.versionName}`, + {cause: err as Error}, + ); } } diff --git a/packages/docusaurus-plugin-content-docs/src/index.ts b/packages/docusaurus-plugin-content-docs/src/index.ts index 0b03d48a0542..2b53c960c8f1 100644 --- a/packages/docusaurus-plugin-content-docs/src/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/index.ts @@ -375,6 +375,7 @@ export default async function pluginContentDocs( }) => ({ image: frontMatter.image, }), + markdownConfig: siteConfig.markdown, }, }, { diff --git a/packages/docusaurus-plugin-content-pages/package.json b/packages/docusaurus-plugin-content-pages/package.json index 191b43c3de4f..ba50c4f6a31f 100644 --- a/packages/docusaurus-plugin-content-pages/package.json +++ b/packages/docusaurus-plugin-content-pages/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-content-pages", - "version": "2.1.0", + "version": "2.2.0", "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.1.0", - "@docusaurus/mdx-loader": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/mdx-loader": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "fs-extra": "^10.1.0", "tslib": "^2.4.0", "webpack": "^5.73.0" diff --git a/packages/docusaurus-plugin-content-pages/src/index.ts b/packages/docusaurus-plugin-content-pages/src/index.ts index bf6b0c73041b..c3c51b883283 100644 --- a/packages/docusaurus-plugin-content-pages/src/index.ts +++ b/packages/docusaurus-plugin-content-pages/src/index.ts @@ -211,6 +211,7 @@ export default function pluginContentPages( `${docuHash(aliasedSource)}.json`, ); }, + markdownConfig: siteConfig.markdown, }, }, { diff --git a/packages/docusaurus-plugin-debug/package.json b/packages/docusaurus-plugin-debug/package.json index 02ff163f5575..8553d40ac3f0 100644 --- a/packages/docusaurus-plugin-debug/package.json +++ b/packages/docusaurus-plugin-debug/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-debug", - "version": "2.1.0", + "version": "2.2.0", "description": "Debug plugin for Docusaurus.", "main": "lib/index.js", "types": "src/plugin-debug.d.ts", @@ -20,9 +20,9 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils": "2.2.0", "fs-extra": "^10.1.0", "react-json-view": "^1.21.3", "tslib": "^2.4.0" diff --git a/packages/docusaurus-plugin-google-analytics/package.json b/packages/docusaurus-plugin-google-analytics/package.json index 03914060c9c5..ed92e424eeca 100644 --- a/packages/docusaurus-plugin-google-analytics/package.json +++ b/packages/docusaurus-plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-google-analytics", - "version": "2.1.0", + "version": "2.2.0", "description": "Global analytics (analytics.js) plugin for Docusaurus.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -18,9 +18,9 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "tslib": "^2.4.0" }, "peerDependencies": { diff --git a/packages/docusaurus-plugin-google-gtag/package.json b/packages/docusaurus-plugin-google-gtag/package.json index a363fd1f14f4..a9f2c4330671 100644 --- a/packages/docusaurus-plugin-google-gtag/package.json +++ b/packages/docusaurus-plugin-google-gtag/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-google-gtag", - "version": "2.1.0", + "version": "2.2.0", "description": "Global Site Tag (gtag.js) plugin for Docusaurus.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -18,9 +18,9 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "tslib": "^2.4.0" }, "peerDependencies": { diff --git a/packages/docusaurus-plugin-ideal-image/package.json b/packages/docusaurus-plugin-ideal-image/package.json index 74fa5a4efacb..639b28e7f8c4 100644 --- a/packages/docusaurus-plugin-ideal-image/package.json +++ b/packages/docusaurus-plugin-ideal-image/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/plugin-ideal-image", - "version": "2.1.0", + "version": "2.2.0", "description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).", "main": "lib/index.js", "types": "src/plugin-ideal-image.d.ts", @@ -20,12 +20,12 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/lqip-loader": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/lqip-loader": "2.2.0", "@docusaurus/responsive-loader": "^1.7.0", - "@docusaurus/theme-translations": "2.1.0", - "@docusaurus/types": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/theme-translations": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "@endiliey/react-ideal-image": "^0.0.11", "react-waypoint": "^10.3.0", "sharp": "^0.30.7", @@ -33,7 +33,7 @@ "webpack": "^5.73.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "2.1.0", + "@docusaurus/module-type-aliases": "2.2.0", "fs-extra": "^10.1.0" }, "peerDependencies": { diff --git a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx index fbf2d3278a9b..8886a6e7992e 100644 --- a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx +++ b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx @@ -81,25 +81,19 @@ function getMessage(icon: IconKey, state: State) { } export default function IdealImage(props: Props): JSX.Element { - const {alt, className, img} = props; + const {img, ...propsRest} = props; // In dev env just use regular img with original file if (typeof img === 'string' || 'default' in img) { return ( - {alt} + // eslint-disable-next-line jsx-a11y/alt-text + ); } return ( ) => JSX.Element; readonly h6: (props: ComponentProps<'h6'>) => JSX.Element; readonly admonition: typeof Admonition; + readonly mermaid: typeof Mermaid; // eslint-disable-next-line @typescript-eslint/no-explicit-any [tagName: string]: ComponentType; }; @@ -1112,6 +1114,14 @@ declare module '@theme/SearchBar' { export default function SearchBar(): JSX.Element; } +declare module '@theme/Mermaid' { + export interface Props { + value: string; + } + + export default function Mermaid(props: Props): JSX.Element; +} + declare module '@theme/TabItem' { import type {ReactNode} from 'react'; diff --git a/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/styles.module.css b/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/styles.module.css index f81f61ea8770..b09a21721ff7 100644 --- a/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/styles.module.css @@ -15,8 +15,16 @@ height: var(--docusaurus-announcement-bar-height); background-color: var(--ifm-color-white); color: var(--ifm-color-black); + + /* + Unfortunately we can't make announcement bar render above the navbar + IE need to use border-bottom instead of shadow + See https://github.com/facebookincubator/infima/issues/275 + box-shadow: var(--ifm-global-shadow-lw); - z-index: calc(var(--ifm-z-index-fixed) + 1); /* just above the navbar */ + z-index: calc(var(--ifm-z-index-fixed) + 1); + */ + border-bottom: 1px solid var(--ifm-color-emphasis-100); } html[data-announcement-bar-initially-dismissed='true'] .announcementBar { diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx index 3b6a8a306b0a..3d8fca58fdcc 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx @@ -39,11 +39,9 @@ export default function CodeBlockLine({ {lineTokens} ) : ( - <> - {lineTokens} -
- + lineTokens )} +
); } diff --git a/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx b/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx index d6f5f2f9f088..fe939a9d9a1d 100644 --- a/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx @@ -52,7 +52,8 @@ function ColorModeToggle({className, value, onChange}: Props): JSX.Element { onClick={() => onChange(value === 'dark' ? 'light' : 'dark')} disabled={!isBrowser} title={title} - aria-label={title}> + aria-label={title} + aria-live="polite"> diff --git a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx index 26308f7eb26c..cf460364766f 100644 --- a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx @@ -8,7 +8,11 @@ import React from 'react'; import clsx from 'clsx'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; -import {PageMetadata, ThemeClassNames} from '@docusaurus/theme-common'; +import { + PageMetadata, + SkipToContentFallbackId, + ThemeClassNames, +} from '@docusaurus/theme-common'; import {useKeyboardNavigation} from '@docusaurus/theme-common/internal'; import SkipToContent from '@theme/SkipToContent'; import AnnouncementBar from '@theme/AnnouncementBar'; @@ -42,6 +46,7 @@ export default function Layout(props: Props): JSX.Element {
diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx index 8b6141f5e2bc..13931951950a 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx @@ -15,6 +15,7 @@ import MDXHeading from '@theme/MDXComponents/Heading'; import MDXUl from '@theme/MDXComponents/Ul'; import MDXImg from '@theme/MDXComponents/Img'; import Admonition from '@theme/Admonition'; +import Mermaid from '@theme/Mermaid'; import type {MDXComponentsObject} from '@theme/MDXComponents'; @@ -33,6 +34,7 @@ const MDXComponents: MDXComponentsObject = { h5: (props) => , h6: (props) => , admonition: Admonition, + mermaid: Mermaid, }; export default MDXComponents; diff --git a/packages/docusaurus-theme-classic/src/theme/Mermaid.tsx b/packages/docusaurus-theme-classic/src/theme/Mermaid.tsx new file mode 100644 index 000000000000..1c326bb04fb6 --- /dev/null +++ b/packages/docusaurus-theme-classic/src/theme/Mermaid.tsx @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This component is meant to be implemented by a Mermaid renderer theme +// It is notable created to be overridden by docusaurus-theme-mermaid + +// By default, the classic theme does not provide any Mermaid implementation +// Yet we declare it there so that we can register it in MDX +// TODO later the mermaid theme should be able to register its MDX component +// see https://github.com/facebook/docusaurus/pull/7490#issuecomment-1279117288 + +export {default} from '@docusaurus/Noop'; diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx index dfaaee227fa6..0eb7ca2b511b 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx @@ -7,6 +7,7 @@ import React from 'react'; import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal'; +import {translate} from '@docusaurus/Translate'; import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle'; import IconClose from '@theme/Icon/Close'; import NavbarLogo from '@theme/Navbar/Logo'; @@ -16,6 +17,11 @@ function CloseButton() { return ( ); diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx index 1b4d7018308d..b6ef8e95f229 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx @@ -13,6 +13,7 @@ import { import {useDocsPreferredVersion} from '@docusaurus/theme-common'; import {useDocsVersionCandidates} from '@docusaurus/theme-common/internal'; import {translate} from '@docusaurus/Translate'; +import {useLocation} from '@docusaurus/router'; import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; import type {Props} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem'; @@ -29,6 +30,7 @@ export default function DocsVersionDropdownNavbarItem({ dropdownItemsAfter, ...props }: Props): JSX.Element { + const {search, hash} = useLocation(); const activeDocContext = useActiveDocContext(docsPluginId); const versions = useVersions(docsPluginId); const {savePreferredVersionName} = useDocsPreferredVersion(docsPluginId); @@ -40,7 +42,8 @@ export default function DocsVersionDropdownNavbarItem({ getVersionMainDoc(version); return { label: version.label, - to: versionDoc.path, + // preserve ?search#hash suffix on version switches + to: `${versionDoc.path}${search}${hash}`, isActive: () => version === activeDocContext.activeVersion, onClick: () => savePreferredVersionName(version.name), }; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx index 53f887789c3c..57cd4b72d45f 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx @@ -9,6 +9,7 @@ import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import {useAlternatePageUtils} from '@docusaurus/theme-common/internal'; import {translate} from '@docusaurus/Translate'; +import {useLocation} from '@docusaurus/router'; import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; import IconLanguage from '@theme/Icon/Language'; import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem'; @@ -26,12 +27,15 @@ export default function LocaleDropdownNavbarItem({ i18n: {currentLocale, locales, localeConfigs}, } = useDocusaurusContext(); const alternatePageUtils = useAlternatePageUtils(); + const {search, hash} = useLocation(); const localeItems = locales.map((locale): LinkLikeNavbarItemProps => { - const to = `pathname://${alternatePageUtils.createUrl({ + const baseTo = `pathname://${alternatePageUtils.createUrl({ locale, fullyQualified: false, })}`; + // preserve ?search#hash suffix on locale switches + const to = `${baseTo}${search}${hash}`; return { label: localeConfigs[locale]!.label, lang: localeConfigs[locale]!.htmlLang, diff --git a/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx b/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx index 174f813a3ae8..0ae5c02a559e 100644 --- a/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx @@ -6,26 +6,10 @@ */ import React from 'react'; -import Translate, {translate} from '@docusaurus/Translate'; -import {useSkipToContent} from '@docusaurus/theme-common/internal'; +import {SkipToContentLink} from '@docusaurus/theme-common'; import styles from './styles.module.css'; export default function SkipToContent(): JSX.Element { - const {containerRef, handleSkip} = useSkipToContent(); - return ( -
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - - - Skip to main content - - -
- ); + return ; } diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx index 029eec193a28..54843fa48ade 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx @@ -104,7 +104,10 @@ function TabsComponent(props: Props): JSX.Element { } const handleTabChange = ( - event: React.FocusEvent | React.MouseEvent, + event: + | React.FocusEvent + | React.MouseEvent + | React.KeyboardEvent, ) => { const newTab = event.currentTarget; const newTabIndex = tabRefs.indexOf(newTab); @@ -124,6 +127,10 @@ function TabsComponent(props: Props): JSX.Element { let focusElement: HTMLLIElement | null = null; switch (event.key) { + case 'Enter': { + handleTabChange(event); + break; + } case 'ArrowRight': { const nextTab = tabRefs.indexOf(event.currentTarget) + 1; focusElement = tabRefs[nextTab] ?? tabRefs[0]!; @@ -161,7 +168,6 @@ function TabsComponent(props: Props): JSX.Element { key={value} ref={(tabControl) => tabRefs.push(tabControl)} onKeyDown={handleKeydown} - onFocus={handleTabChange} onClick={handleTabChange} {...attributes} className={clsx( diff --git a/packages/docusaurus-theme-classic/src/theme/Tag/styles.module.css b/packages/docusaurus-theme-classic/src/theme/Tag/styles.module.css index 00e5ee62adba..491676783022 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tag/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/Tag/styles.module.css @@ -20,7 +20,7 @@ } .tagRegular { - border-radius: 0.5rem; + border-radius: var(--ifm-global-radius); padding: 0.2rem 0.5rem 0.3rem; font-size: 90%; } diff --git a/packages/docusaurus-theme-common/package.json b/packages/docusaurus-theme-common/package.json index bc6ad0900919..aab6392e825a 100644 --- a/packages/docusaurus-theme-common/package.json +++ b/packages/docusaurus-theme-common/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/theme-common", - "version": "2.1.0", + "version": "2.2.0", "description": "Common code for Docusaurus themes.", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -30,12 +30,12 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/mdx-loader": "2.1.0", - "@docusaurus/module-type-aliases": "2.1.0", - "@docusaurus/plugin-content-blog": "2.1.0", - "@docusaurus/plugin-content-docs": "2.1.0", - "@docusaurus/plugin-content-pages": "2.1.0", - "@docusaurus/utils": "2.1.0", + "@docusaurus/mdx-loader": "2.2.0", + "@docusaurus/module-type-aliases": "2.2.0", + "@docusaurus/plugin-content-blog": "2.2.0", + "@docusaurus/plugin-content-docs": "2.2.0", + "@docusaurus/plugin-content-pages": "2.2.0", + "@docusaurus/utils": "2.2.0", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", @@ -46,8 +46,8 @@ "utility-types": "^3.10.0" }, "devDependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/types": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/types": "2.2.0", "fs-extra": "^10.1.0", "lodash": "^4.17.21" }, diff --git a/packages/docusaurus-theme-common/src/hooks/useHideableNavbar.ts b/packages/docusaurus-theme-common/src/hooks/useHideableNavbar.ts index 70ef84e3d10b..275652cff213 100644 --- a/packages/docusaurus-theme-common/src/hooks/useHideableNavbar.ts +++ b/packages/docusaurus-theme-common/src/hooks/useHideableNavbar.ts @@ -62,7 +62,13 @@ export function useHideableNavbar(hideOnScroll: boolean): { return; } - if (locationChangeEvent.location.hash) { + // See https://github.com/facebook/docusaurus/pull/8059#issuecomment-1239639480 + const currentHash = locationChangeEvent.location.hash; + const currentHashAnchor = currentHash + ? document.getElementById(currentHash.substring(1)) + : undefined; + + if (currentHashAnchor) { isFocusedAnchor.current = true; setIsNavbarVisible(false); return; diff --git a/packages/docusaurus-theme-common/src/hooks/useSkipToContent.ts b/packages/docusaurus-theme-common/src/hooks/useSkipToContent.ts deleted file mode 100644 index bdcac465d487..000000000000 --- a/packages/docusaurus-theme-common/src/hooks/useSkipToContent.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import type React from 'react'; -import {useCallback, useRef} from 'react'; -import {useHistory} from '@docusaurus/router'; -import {useLocationChange} from '../utils/useLocationChange'; -import {ThemeClassNames} from '../utils/ThemeClassNames'; - -function programmaticFocus(el: HTMLElement) { - el.setAttribute('tabindex', '-1'); - el.focus(); - el.removeAttribute('tabindex'); -} - -/** This hook wires the logic for a skip-to-content link. */ -export function useSkipToContent(): { - /** - * The ref to the container. On page transition, the container will be focused - * so that keyboard navigators can instantly interact with the link and jump - * to content. **Note:** the type is `RefObject` only because - * the typing for refs don't reflect that the `ref` prop is contravariant, so - * using `HTMLElement` causes type-checking to fail. You can plug the ref into - * any HTML element, as long as it can be focused. - */ - containerRef: React.RefObject; - /** - * Callback fired when the skip to content link has been interacted with. It - * will programmatically focus the main content. - */ - handleSkip: (e: React.MouseEvent) => void; -} { - const containerRef = useRef(null); - const {action} = useHistory(); - const handleSkip = useCallback((e: React.MouseEvent) => { - e.preventDefault(); - - const targetElement: HTMLElement | null = - document.querySelector('main:first-of-type') ?? - document.querySelector(`.${ThemeClassNames.wrapper.main}`); - - if (targetElement) { - programmaticFocus(targetElement); - } - }, []); - - useLocationChange(({location}) => { - if (containerRef.current && !location.hash && action === 'PUSH') { - programmaticFocus(containerRef.current); - } - }); - - return {containerRef, handleSkip}; -} diff --git a/packages/docusaurus-theme-common/src/index.ts b/packages/docusaurus-theme-common/src/index.ts index 7f7427c41409..844fa25cfd0c 100644 --- a/packages/docusaurus-theme-common/src/index.ts +++ b/packages/docusaurus-theme-common/src/index.ts @@ -78,3 +78,10 @@ export {duplicates, uniq} from './utils/jsUtils'; export {usePrismTheme} from './hooks/usePrismTheme'; export {useDocsPreferredVersion} from './contexts/docsPreferredVersion'; + +export {processAdmonitionProps} from './utils/admonitionUtils'; + +export { + SkipToContentFallbackId, + SkipToContentLink, +} from './utils/skipToContentUtils'; diff --git a/packages/docusaurus-theme-common/src/internal.ts b/packages/docusaurus-theme-common/src/internal.ts index 79812c968634..a503fab9837e 100644 --- a/packages/docusaurus-theme-common/src/internal.ts +++ b/packages/docusaurus-theme-common/src/internal.ts @@ -117,6 +117,5 @@ export { export {useLockBodyScroll} from './hooks/useLockBodyScroll'; export {useSearchPage} from './hooks/useSearchPage'; export {useCodeWordWrap} from './hooks/useCodeWordWrap'; -export {useSkipToContent} from './hooks/useSkipToContent'; export {getPrismCssVariables} from './utils/codeBlockUtils'; export {useBackToTopButton} from './hooks/useBackToTopButton'; diff --git a/packages/docusaurus-theme-common/src/utils/admonitionUtils.tsx b/packages/docusaurus-theme-common/src/utils/admonitionUtils.tsx new file mode 100644 index 000000000000..2c58477cd14c --- /dev/null +++ b/packages/docusaurus-theme-common/src/utils/admonitionUtils.tsx @@ -0,0 +1,43 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, {type ReactNode} from 'react'; + +// Workaround because it's difficult in MDX v1 to provide a MDX title as props +// See https://github.com/facebook/docusaurus/pull/7152#issuecomment-1145779682 +function extractMDXAdmonitionTitle(children: ReactNode): { + mdxAdmonitionTitle: ReactNode | undefined; + rest: ReactNode; +} { + const items = React.Children.toArray(children); + const mdxAdmonitionTitle = items.find( + (item) => + React.isValidElement(item) && + (item.props as {mdxType: string} | null)?.mdxType === + 'mdxAdmonitionTitle', + ) as JSX.Element | undefined; + const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}; + return { + mdxAdmonitionTitle: mdxAdmonitionTitle?.props.children, + rest, + }; +} + +export function processAdmonitionProps< + Props extends {readonly children: ReactNode; readonly title?: ReactNode}, +>(props: Props): Props { + const {mdxAdmonitionTitle, rest} = extractMDXAdmonitionTitle(props.children); + const title = props.title ?? mdxAdmonitionTitle; + return { + ...props, + // Do not return "title: undefined" prop + // this might create unwanted props overrides when merging props + // For example: {...default,...props} + ...(title && {title}), + children: rest, + }; +} diff --git a/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx b/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx new file mode 100644 index 000000000000..fbdf862a8c89 --- /dev/null +++ b/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx @@ -0,0 +1,103 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, {useCallback, useRef, type ComponentProps} from 'react'; +import {useHistory} from '@docusaurus/router'; +import {translate} from '@docusaurus/Translate'; +import {useLocationChange} from './useLocationChange'; + +/** + * The id of the element that should become focused on a page + * that does not have a
html tag. + * Focusing the Docusaurus Layout children is a reasonable fallback. + */ +export const SkipToContentFallbackId = 'docusaurus_skipToContent_fallback'; + +/** + * Returns the skip to content element to focus when the link is clicked. + */ +function getSkipToContentTarget(): HTMLElement | null { + return ( + // Try to focus the
in priority + // Note: this will only work if JS is enabled + // See https://github.com/facebook/docusaurus/issues/6411#issuecomment-1284136069 + document.querySelector('main:first-of-type') ?? + // Then try to focus the fallback element (usually the Layout children) + document.getElementById(SkipToContentFallbackId) + ); +} + +function programmaticFocus(el: HTMLElement) { + el.setAttribute('tabindex', '-1'); + el.focus(); + el.removeAttribute('tabindex'); +} + +/** This hook wires the logic for a skip-to-content link. */ +function useSkipToContent(): { + /** + * The ref to the container. On page transition, the container will be focused + * so that keyboard navigators can instantly interact with the link and jump + * to content. + */ + containerRef: React.RefObject; + /** + * Callback fired when the skip to content link has been clicked. + * It will programmatically focus the main content. + */ + onClick: (e: React.MouseEvent) => void; +} { + const containerRef = useRef(null); + const {action} = useHistory(); + + const onClick = useCallback((e: React.MouseEvent) => { + e.preventDefault(); + const targetElement = getSkipToContentTarget(); + if (targetElement) { + programmaticFocus(targetElement); + } + }, []); + + // "Reset" focus when navigating. + // See https://github.com/facebook/docusaurus/pull/8204#issuecomment-1276547558 + useLocationChange(({location}) => { + if (containerRef.current && !location.hash && action === 'PUSH') { + programmaticFocus(containerRef.current); + } + }); + + return {containerRef, onClick}; +} + +const DefaultSkipToContentLabel = translate({ + id: 'theme.common.skipToMainContent', + description: + 'The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation', + message: 'Skip to main content', +}); + +type SkipToContentLinkProps = Omit, 'href' | 'onClick'>; + +export function SkipToContentLink(props: SkipToContentLinkProps): JSX.Element { + const linkLabel = props.children ?? DefaultSkipToContentLabel; + const {containerRef, onClick} = useSkipToContent(); + return ( + + ); +} diff --git a/packages/docusaurus-theme-live-codeblock/package.json b/packages/docusaurus-theme-live-codeblock/package.json index eda8bf8ae891..c23ad0fcd7bd 100644 --- a/packages/docusaurus-theme-live-codeblock/package.json +++ b/packages/docusaurus-theme-live-codeblock/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/theme-live-codeblock", - "version": "2.1.0", + "version": "2.2.0", "description": "Docusaurus live code block component.", "main": "lib/index.js", "types": "src/theme-live-codeblock.d.ts", @@ -23,10 +23,10 @@ }, "license": "MIT", "dependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/theme-common": "2.1.0", - "@docusaurus/theme-translations": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/theme-common": "2.2.0", + "@docusaurus/theme-translations": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "@philpl/buble": "^0.19.7", "clsx": "^1.2.1", "fs-extra": "^10.1.0", @@ -34,7 +34,7 @@ "tslib": "^2.4.0" }, "devDependencies": { - "@docusaurus/types": "2.1.0", + "@docusaurus/types": "2.2.0", "@types/buble": "^0.20.1" }, "peerDependencies": { diff --git a/packages/docusaurus-theme-mermaid/.npmignore b/packages/docusaurus-theme-mermaid/.npmignore new file mode 100644 index 000000000000..03c9ae1e1b54 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/.npmignore @@ -0,0 +1,3 @@ +.tsbuildinfo* +tsconfig* +__tests__ diff --git a/packages/docusaurus-theme-mermaid/README.md b/packages/docusaurus-theme-mermaid/README.md new file mode 100644 index 000000000000..ec903286aad8 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/README.md @@ -0,0 +1,21 @@ +# Docusaurus Theme Mermaid + +The mermaid components for Docusaurus. + +## Installation + +Add `docusaurus/theme-mermaid` to your package: + +```bash +npm i @docusaurus/theme-mermaid +# or +yarn add @docusaurus/theme-mermaid +``` + +## Swizzling components + +```bash +$ npm swizzle @docusaurus/theme-mermaid [component name] +``` + +All components used by this theme can be found [here](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-mermaid/src/theme) diff --git a/packages/docusaurus-theme-mermaid/package.json b/packages/docusaurus-theme-mermaid/package.json new file mode 100644 index 000000000000..546ac9f78a93 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/package.json @@ -0,0 +1,57 @@ +{ + "name": "@docusaurus/theme-mermaid", + "version": "2.2.0", + "description": "Mermaid components for Docusaurus.", + "main": "lib/index.js", + "types": "src/theme-mermaid.d.ts", + "sideEffects": false, + "exports": { + "./lib/*": "./lib/*", + "./src/*": "./src/*", + "./client": { + "type": "./lib/client/index.d.ts", + "default": "./lib/client/index.js" + }, + ".": { + "types": "./src/theme-mermaid.d.ts", + "default": "./lib/index.js" + } + }, + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-theme-mermaid" + }, + "license": "MIT", + "scripts": { + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch" + }, + "dependencies": { + "@docusaurus/core": "2.2.0", + "@docusaurus/module-type-aliases": "2.2.0", + "@docusaurus/theme-common": "2.2.0", + "@docusaurus/types": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", + "@mdx-js/react": "^1.6.22", + "mermaid": "^9.1.1", + "tslib": "^2.4.0" + }, + "devDependencies": { + "@types/mdx-js__react": "^1.5.5", + "@types/mermaid": "^8.2.9", + "react-test-renderer": "^17.0.2" + }, + "peerDependencies": { + "react": "^16.8.4 || ^17.0.0", + "react-dom": "^16.8.4 || ^17.0.0" + }, + "engines": { + "node": ">=16.14" + } +} diff --git a/packages/docusaurus-theme-mermaid/src/__tests__/validateThemeConfig.test.ts b/packages/docusaurus-theme-mermaid/src/__tests__/validateThemeConfig.test.ts new file mode 100644 index 000000000000..dc71a9c49c25 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/__tests__/validateThemeConfig.test.ts @@ -0,0 +1,75 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { + validateThemeConfig, + DEFAULT_THEME_CONFIG, +} from '../validateThemeConfig'; +import type {Joi} from '@docusaurus/utils-validation'; +import type {ThemeConfig, UserThemeConfig} from '@docusaurus/theme-mermaid'; + +function testValidateThemeConfig(themeConfig: UserThemeConfig) { + function validate( + schema: Joi.ObjectSchema, + cfg: UserThemeConfig, + ) { + const {value, error} = schema.validate(cfg, { + convert: false, + }); + if (error) { + throw error; + } + return value; + } + + return validateThemeConfig({validate, themeConfig}); +} + +describe('validateThemeConfig', () => { + it('undefined config', () => { + const mermaid = undefined; + expect(testValidateThemeConfig({mermaid})).toEqual(DEFAULT_THEME_CONFIG); + }); + + it('nonexistent config', () => { + expect(testValidateThemeConfig({})).toEqual(DEFAULT_THEME_CONFIG); + }); + + it('empty config', () => { + const mermaid = {}; + expect(testValidateThemeConfig({mermaid})).toEqual(DEFAULT_THEME_CONFIG); + }); + + it('theme', () => { + const mermaid = { + theme: { + light: 'light', + dark: 'dark', + }, + }; + expect(testValidateThemeConfig({mermaid})).toEqual({ + mermaid: { + ...DEFAULT_THEME_CONFIG.mermaid, + ...mermaid, + }, + }); + }); + + it('mermaid options', () => { + const mermaid = { + options: { + fontFamily: 'Ariel', + }, + }; + expect(testValidateThemeConfig({mermaid})).toEqual({ + mermaid: { + ...DEFAULT_THEME_CONFIG.mermaid, + ...mermaid, + }, + }); + }); +}); diff --git a/packages/docusaurus-theme-mermaid/src/client/index.ts b/packages/docusaurus-theme-mermaid/src/client/index.ts new file mode 100644 index 000000000000..e432d6a81a99 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/client/index.ts @@ -0,0 +1,78 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {useMemo} from 'react'; +import {useColorMode, useThemeConfig} from '@docusaurus/theme-common'; +import mermaid from 'mermaid'; +import type mermaidAPI from 'mermaid/mermaidAPI'; +import type {ThemeConfig} from '@docusaurus/theme-mermaid'; + +// Stable className to allow users to easily target with CSS +export const MermaidContainerClassName = 'docusaurus-mermaid-container'; + +export function useMermaidThemeConfig(): ThemeConfig['mermaid'] { + return (useThemeConfig() as unknown as ThemeConfig).mermaid; +} + +export function useMermaidConfig(): mermaidAPI.Config { + const {colorMode} = useColorMode(); + const mermaidThemeConfig = useMermaidThemeConfig(); + + const theme = mermaidThemeConfig.theme[colorMode]; + const {options} = mermaidThemeConfig; + + return useMemo( + () => ({startOnLoad: false, ...options, theme}), + [theme, options], + ); +} + +export function useMermaidSvg( + txt: string, + mermaidConfigParam?: mermaidAPI.Config, +): string { + /* + For flexibility, we allow the hook to receive a custom Mermaid config + The user could inject a modified version of the default config for example + */ + const defaultMermaidConfig = useMermaidConfig(); + const mermaidConfig = mermaidConfigParam ?? defaultMermaidConfig; + + return useMemo(() => { + /* + Mermaid API is really weird :s + It is a big mutable singleton with multiple config levels + Note: most recent API type definitions are missing + + There are 2 kind of configs: + + - siteConfig: some kind of global/protected shared config + you can only set with "initialize" + + - config/currentConfig + the config the renderer will use + it is reset to siteConfig before each render + but it can be altered by the mermaid txt content itself through directives + + To use a new mermaid config (on colorMode change for example) we should + update siteConfig, and it can only be done with initialize() + */ + mermaid.mermaidAPI.initialize(mermaidConfig); + + /* + Random client-only id, we don't care much about it + But mermaid want an id so... + */ + const mermaidId = `mermaid-svg-${Math.round(Math.random() * 10000000)}`; + + /* + Not even documented: mermaid.render returns the svg string + Using the documented form is un-necessary + */ + return mermaid.render(mermaidId, txt); + }, [txt, mermaidConfig]); +} diff --git a/packages/docusaurus-theme-mermaid/src/index.ts b/packages/docusaurus-theme-mermaid/src/index.ts new file mode 100644 index 000000000000..82b1636c598d --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/index.ts @@ -0,0 +1,23 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import type {Plugin} from '@docusaurus/types'; + +export default function themeMermaid(): Plugin { + return { + name: 'docusaurus-theme-mermaid', + + getThemePath() { + return '../lib/theme'; + }, + getTypeScriptThemePath() { + return '../src/theme'; + }, + }; +} + +export {validateThemeConfig} from './validateThemeConfig'; diff --git a/packages/docusaurus-theme-mermaid/src/theme-mermaid.d.ts b/packages/docusaurus-theme-mermaid/src/theme-mermaid.d.ts new file mode 100644 index 000000000000..9b605341a517 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/theme-mermaid.d.ts @@ -0,0 +1,35 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/// + +declare module '@docusaurus/theme-mermaid' { + import type {DeepPartial} from 'utility-types'; + import type mermaidAPI from 'mermaid/mermaidAPI'; + import type {Plugin} from '@docusaurus/types'; + + export type ThemeConfig = { + mermaid: { + theme: { + light: mermaidAPI.Theme; + dark: mermaidAPI.Theme; + }; + options: mermaidAPI.Config; + }; + }; + export type UserThemeConfig = DeepPartial; + + export default function themeMermaid(): Plugin; +} + +declare module '@theme/Mermaid' { + export interface Props { + value: string; + } + + export default function Mermaid(props: Props): JSX.Element; +} diff --git a/packages/docusaurus-theme-mermaid/src/theme/Mermaid/index.tsx b/packages/docusaurus-theme-mermaid/src/theme/Mermaid/index.tsx new file mode 100644 index 000000000000..26a882e6ddaf --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/theme/Mermaid/index.tsx @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +import { + MermaidContainerClassName, + useMermaidSvg, +} from '@docusaurus/theme-mermaid/client'; + +import type {Props} from '@theme/Mermaid'; + +import styles from './styles.module.css'; + +function MermaidDiagram({value}: Props): JSX.Element { + const svg = useMermaidSvg(value); + return ( +
+ ); +} + +export default function Mermaid(props: Props): JSX.Element { + return {() => }; +} diff --git a/packages/docusaurus-theme-mermaid/src/theme/Mermaid/styles.module.css b/packages/docusaurus-theme-mermaid/src/theme/Mermaid/styles.module.css new file mode 100644 index 000000000000..fa19d80d927e --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/theme/Mermaid/styles.module.css @@ -0,0 +1,14 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +.container { + max-width: 100%; +} + +.container > svg { + max-width: 100%; +} diff --git a/packages/docusaurus-theme-mermaid/src/validateThemeConfig.ts b/packages/docusaurus-theme-mermaid/src/validateThemeConfig.ts new file mode 100644 index 000000000000..c68201f225dd --- /dev/null +++ b/packages/docusaurus-theme-mermaid/src/validateThemeConfig.ts @@ -0,0 +1,38 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {Joi} from '@docusaurus/utils-validation'; +import type {ThemeConfig} from '@docusaurus/theme-mermaid'; +import type mermaidAPI from 'mermaid/mermaidAPI'; +import type {ThemeConfigValidationContext} from '@docusaurus/types'; + +export const DEFAULT_THEME_CONFIG: ThemeConfig = { + mermaid: { + theme: { + dark: 'dark' as mermaidAPI.Theme, + light: 'default' as mermaidAPI.Theme, + }, + options: {}, + }, +}; + +export const Schema = Joi.object({ + mermaid: Joi.object({ + theme: Joi.object({ + dark: Joi.string().default(DEFAULT_THEME_CONFIG.mermaid.theme.dark), + light: Joi.string().default(DEFAULT_THEME_CONFIG.mermaid.theme.light), + }).default(DEFAULT_THEME_CONFIG.mermaid.theme), + options: Joi.object().default(DEFAULT_THEME_CONFIG.mermaid.options), + }).default(DEFAULT_THEME_CONFIG.mermaid), +}); + +export function validateThemeConfig({ + validate, + themeConfig, +}: ThemeConfigValidationContext): ThemeConfig { + return validate(Schema, themeConfig); +} diff --git a/packages/docusaurus-theme-mermaid/tsconfig.client.json b/packages/docusaurus-theme-mermaid/tsconfig.client.json new file mode 100644 index 000000000000..1f0c48f14b25 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/tsconfig.client.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "rootDir": "src", + "outDir": "lib", + "module": "esnext", + "target": "esnext" + }, + "include": ["src/theme", "src/*.d.ts"], + "exclude": ["**/__tests__/**"] +} diff --git a/packages/docusaurus-theme-mermaid/tsconfig.json b/packages/docusaurus-theme-mermaid/tsconfig.json new file mode 100644 index 000000000000..7c1bb85ac462 --- /dev/null +++ b/packages/docusaurus-theme-mermaid/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "references": [{"path": "./tsconfig.client.json"}], + "compilerOptions": { + "noEmit": false, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/theme", "**/__tests__/**"] +} diff --git a/packages/docusaurus-theme-search-algolia/package.json b/packages/docusaurus-theme-search-algolia/package.json index bea9720b1ffa..025290df626b 100644 --- a/packages/docusaurus-theme-search-algolia/package.json +++ b/packages/docusaurus-theme-search-algolia/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/theme-search-algolia", - "version": "2.1.0", + "version": "2.2.0", "description": "Algolia search component for Docusaurus.", "main": "lib/index.js", "sideEffects": [ @@ -34,13 +34,13 @@ }, "dependencies": { "@docsearch/react": "^3.1.1", - "@docusaurus/core": "2.1.0", - "@docusaurus/logger": "2.1.0", - "@docusaurus/plugin-content-docs": "2.1.0", - "@docusaurus/theme-common": "2.1.0", - "@docusaurus/theme-translations": "2.1.0", - "@docusaurus/utils": "2.1.0", - "@docusaurus/utils-validation": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/logger": "2.2.0", + "@docusaurus/plugin-content-docs": "2.2.0", + "@docusaurus/theme-common": "2.2.0", + "@docusaurus/theme-translations": "2.2.0", + "@docusaurus/utils": "2.2.0", + "@docusaurus/utils-validation": "2.2.0", "algoliasearch": "^4.13.1", "algoliasearch-helper": "^3.10.0", "clsx": "^1.2.1", @@ -51,7 +51,7 @@ "utility-types": "^3.10.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "2.1.0" + "@docusaurus/module-type-aliases": "2.2.0" }, "peerDependencies": { "react": "^16.8.4 || ^17.0.0", diff --git a/packages/docusaurus-theme-translations/locales/ar/theme-common.json b/packages/docusaurus-theme-translations/locales/ar/theme-common.json index dd009b469598..af8ccb27bb4c 100644 --- a/packages/docusaurus-theme-translations/locales/ar/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/ar/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "التنقل بين صفحات الددات", "theme.docs.paginator.next": "التالى", "theme.docs.paginator.previous": "السابق", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "طي الشريط الجانبي", "theme.docs.sidebar.collapseButtonTitle": "طي الشريط الجانبي", "theme.docs.sidebar.expandButtonAriaLabel": "توسيع الشريط الجانبي", "theme.docs.sidebar.expandButtonTitle": "توسيع الشريط الجانبي", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} مستند موسوم بـ \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "مستند موسوم واحد|{count} مستندات موسومة", "theme.docs.versionBadge.label": "الأصدار: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/base/theme-common.json b/packages/docusaurus-theme-translations/locales/base/theme-common.json index 95743ca04339..695c5fff430e 100644 --- a/packages/docusaurus-theme-translations/locales/base/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/base/theme-common.json @@ -87,6 +87,8 @@ "theme.docs.paginator.next___DESCRIPTION": "The label used to navigate to the next doc", "theme.docs.paginator.previous": "Previous", "theme.docs.paginator.previous___DESCRIPTION": "The label used to navigate to the previous doc", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", + "theme.docs.sidebar.closeSidebarButtonAriaLabel___DESCRIPTION": "The ARIA label for close button of mobile sidebar", "theme.docs.sidebar.collapseButtonAriaLabel": "Collapse sidebar", "theme.docs.sidebar.collapseButtonAriaLabel___DESCRIPTION": "The title attribute for collapse button of doc sidebar", "theme.docs.sidebar.collapseButtonTitle": "Collapse sidebar", @@ -95,6 +97,8 @@ "theme.docs.sidebar.expandButtonAriaLabel___DESCRIPTION": "The ARIA label and title attribute for expand button of doc sidebar", "theme.docs.sidebar.expandButtonTitle": "Expand sidebar", "theme.docs.sidebar.expandButtonTitle___DESCRIPTION": "The ARIA label and title attribute for expand button of doc sidebar", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel___DESCRIPTION": "The ARIA label for hamburger menu button of mobile navigation", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle___DESCRIPTION": "The title of the page for a docs tag", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", diff --git a/packages/docusaurus-theme-translations/locales/bn/theme-common.json b/packages/docusaurus-theme-translations/locales/bn/theme-common.json index 9db8b9de8c09..f77d613d1788 100644 --- a/packages/docusaurus-theme-translations/locales/bn/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/bn/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "ডক্স পৃষ্টাগুলির নেভিগেশন", "theme.docs.paginator.next": "পরবর্তী", "theme.docs.paginator.previous": "পূর্ববর্তী", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "সাইডবারটি সঙ্কুচিত করুন", "theme.docs.sidebar.collapseButtonTitle": "সাইডবারটি সঙ্কুচিত করুন", "theme.docs.sidebar.expandButtonAriaLabel": "সাইডবারটি প্রসারিত করুন", "theme.docs.sidebar.expandButtonTitle": "সাইডবারটি প্রসারিত করুন", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/cs/theme-common.json b/packages/docusaurus-theme-translations/locales/cs/theme-common.json index 2256473958d4..c5e85314faad 100644 --- a/packages/docusaurus-theme-translations/locales/cs/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/cs/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Stránkování dokumentace", "theme.docs.paginator.next": "Další", "theme.docs.paginator.previous": "Předchozí", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Zavřít postranní lištu", "theme.docs.sidebar.collapseButtonTitle": "Zavřít postranní lištu", "theme.docs.sidebar.expandButtonAriaLabel": "Otevřít postranní lištu", "theme.docs.sidebar.expandButtonTitle": "Otevřít postranní lištu", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/da/theme-common.json b/packages/docusaurus-theme-translations/locales/da/theme-common.json index a96ad330cde4..adbe3e6eace9 100644 --- a/packages/docusaurus-theme-translations/locales/da/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/da/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Dokumentside navigation", "theme.docs.paginator.next": "Næste", "theme.docs.paginator.previous": "Tidligere", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Sammenlæg sidenavigation", "theme.docs.sidebar.collapseButtonTitle": "Sammenlæg sidenavigation", "theme.docs.sidebar.expandButtonAriaLabel": "Udvid sidenavigation", "theme.docs.sidebar.expandButtonTitle": "Udvid sidenavigation", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/de/theme-common.json b/packages/docusaurus-theme-translations/locales/de/theme-common.json index d302ecd4a0f6..ada97df4c8af 100644 --- a/packages/docusaurus-theme-translations/locales/de/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/de/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Dokumentation Seiten Navigation", "theme.docs.paginator.next": "Weiter", "theme.docs.paginator.previous": "Zurück", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Seitenleiste einklappen", "theme.docs.sidebar.collapseButtonTitle": "Seitenleiste einklappen", "theme.docs.sidebar.expandButtonAriaLabel": "Seitenleiste ausklappen", "theme.docs.sidebar.expandButtonTitle": "Seitenleiste ausklappen", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} mit \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Ein doc getaggt|{count} docs getaggt", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/es/theme-common.json b/packages/docusaurus-theme-translations/locales/es/theme-common.json index a90504a2e1b9..a8662c60ec2a 100644 --- a/packages/docusaurus-theme-translations/locales/es/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/es/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Navegación de páginas de documentos", "theme.docs.paginator.next": "Siguiente", "theme.docs.paginator.previous": "Anterior", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Colapsar barra lateral", "theme.docs.sidebar.collapseButtonTitle": "Colapsar barra lateral", "theme.docs.sidebar.expandButtonAriaLabel": "Expandir barra lateral", "theme.docs.sidebar.expandButtonTitle": "Expandir barra lateral", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} con \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Un documento etiquetado|{count} documentos etiquetados", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/fa/theme-common.json b/packages/docusaurus-theme-translations/locales/fa/theme-common.json index 7f5783d75a4a..38aa636cd480 100644 --- a/packages/docusaurus-theme-translations/locales/fa/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/fa/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "کنترل صفحات مطالب", "theme.docs.paginator.next": "بعدی", "theme.docs.paginator.previous": "قبلی", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "بستن نوار کناری", "theme.docs.sidebar.collapseButtonTitle": "بستن نوار کناری", "theme.docs.sidebar.expandButtonAriaLabel": "باز کردن نوار کناری", "theme.docs.sidebar.expandButtonTitle": "باز کردن نوار کناری", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} با \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "یک مطلب برچسب شده|{count} مطلب برچسب شده", "theme.docs.versionBadge.label": "نسخه: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/fil/theme-common.json b/packages/docusaurus-theme-translations/locales/fil/theme-common.json index 49cb94da5ac9..11aa9d25f4f6 100644 --- a/packages/docusaurus-theme-translations/locales/fil/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/fil/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Nabegasyón para sa mga pahinang docs.", "theme.docs.paginator.next": "Sumunod", "theme.docs.paginator.previous": "Naraaan", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Itupî ang sidebar", "theme.docs.sidebar.collapseButtonTitle": "Itupî ang sidebar", "theme.docs.sidebar.expandButtonAriaLabel": "Palakihin ang sidebar", "theme.docs.sidebar.expandButtonTitle": "Palakihin ang sidebar", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/fr/theme-common.json b/packages/docusaurus-theme-translations/locales/fr/theme-common.json index 2154533905dd..a4dceac65713 100644 --- a/packages/docusaurus-theme-translations/locales/fr/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/fr/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Pagination des documents", "theme.docs.paginator.next": "Suivant", "theme.docs.paginator.previous": "Précédent", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Fermer la barre de navigation", "theme.docs.sidebar.collapseButtonAriaLabel": "Réduire le menu latéral", "theme.docs.sidebar.collapseButtonTitle": "Réduire le menu latéral", "theme.docs.sidebar.expandButtonAriaLabel": "Déplier le menu latéral", "theme.docs.sidebar.expandButtonTitle": "Déplier le menu latéral", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Ouvrir/fermer la barre de navigation", "theme.docs.tagDocListPageTitle": "{nDocsTagged} avec \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Un document tagué|{count} documents tagués", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/he/theme-common.json b/packages/docusaurus-theme-translations/locales/he/theme-common.json index f658c83b6534..4082c802805b 100644 --- a/packages/docusaurus-theme-translations/locales/he/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/he/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "רשימת דוקומנטאציה", "theme.docs.paginator.next": "הבא", "theme.docs.paginator.previous": "הקודם", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "סגור", "theme.docs.sidebar.collapseButtonTitle": "סגור", "theme.docs.sidebar.expandButtonAriaLabel": "פתח", "theme.docs.sidebar.expandButtonTitle": "פתח", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/hi/theme-common.json b/packages/docusaurus-theme-translations/locales/hi/theme-common.json index ff35a0df2af5..3113ac239e2b 100644 --- a/packages/docusaurus-theme-translations/locales/hi/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/hi/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "डॉक्स पेज नेविगेशन", "theme.docs.paginator.next": "अगला", "theme.docs.paginator.previous": "पिछ्ला", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "साइडबार बंद करें", "theme.docs.sidebar.collapseButtonTitle": "साइडबार बंद करें", "theme.docs.sidebar.expandButtonAriaLabel": "साइडबार खोलें", "theme.docs.sidebar.expandButtonTitle": "साइडबार खोलें", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/it/theme-common.json b/packages/docusaurus-theme-translations/locales/it/theme-common.json index 4c69f66091fd..f3ca7df138b1 100644 --- a/packages/docusaurus-theme-translations/locales/it/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/it/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Navigazione delle pagine dei documenti", "theme.docs.paginator.next": "Successivo", "theme.docs.paginator.previous": "Precedente", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Collassa la barra laterale", "theme.docs.sidebar.collapseButtonTitle": "Collassa la barra laterale", "theme.docs.sidebar.expandButtonAriaLabel": "Espandi la barra laterale", "theme.docs.sidebar.expandButtonTitle": "Espandi la barra laterale", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} con \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Un documento etichettato|{count} documenti etichettati", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/ja/plugin-ideal-image.json b/packages/docusaurus-theme-translations/locales/ja/plugin-ideal-image.json index 3576b692c08d..035530785367 100644 --- a/packages/docusaurus-theme-translations/locales/ja/plugin-ideal-image.json +++ b/packages/docusaurus-theme-translations/locales/ja/plugin-ideal-image.json @@ -1,7 +1,7 @@ { - "theme.IdealImageMessage.404error": "404. Image not found", - "theme.IdealImageMessage.error": "Error. Click to reload", - "theme.IdealImageMessage.load": "Click to load{sizeMessage}", - "theme.IdealImageMessage.loading": "Loading...", - "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded" + "theme.IdealImageMessage.404error": "画像が存在しません", + "theme.IdealImageMessage.error": "画像の読み込みに失敗しました", + "theme.IdealImageMessage.load": "クリックして読み込む{sizeMessage}", + "theme.IdealImageMessage.loading": "読み込み中...", + "theme.IdealImageMessage.offline": "オフライン中は画像は読み込まれません" } diff --git a/packages/docusaurus-theme-translations/locales/ja/theme-common.json b/packages/docusaurus-theme-translations/locales/ja/theme-common.json index 42a6a06af877..4ae84260dc9e 100644 --- a/packages/docusaurus-theme-translations/locales/ja/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/ja/theme-common.json @@ -1,24 +1,24 @@ { "theme.AnnouncementBar.closeButtonAriaLabel": "閉じる", - "theme.BackToTopButton.buttonAriaLabel": "Scroll back to top", + "theme.BackToTopButton.buttonAriaLabel": "先頭へ戻る", "theme.CodeBlock.copied": "コピーしました", "theme.CodeBlock.copy": "コピー", "theme.CodeBlock.copyButtonAriaLabel": "クリップボードにコードをコピー", - "theme.CodeBlock.wordWrapToggle": "Toggle word wrap", - "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": "Toggle the collapsible sidebar category '{label}'", - "theme.ErrorPageContent.title": "This page crashed.", - "theme.ErrorPageContent.tryAgain": "Try again", - "theme.NotFound.p1": "お探しのページが見つかりませんでした。", - "theme.NotFound.p2": "このページにリンクしているサイトの所有者に連絡をしてリンクが壊れていることを伝えてください。", + "theme.CodeBlock.wordWrapToggle": "折り返し", + "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": "サイドバーのカテゴリー「{label}」を開く・閉じる", + "theme.ErrorPageContent.title": "エラーが発生しました", + "theme.ErrorPageContent.tryAgain": "もう一度試してください", + "theme.NotFound.p1": "お探しのページが見つかりませんでした", + "theme.NotFound.p2": "このページにリンクしているサイトの所有者にリンクが壊れていることを伝えてください", "theme.NotFound.title": "ページが見つかりません", - "theme.TOCCollapsible.toggleButtonLabel": "On this page", - "theme.admonition.caution": "caution", - "theme.admonition.danger": "danger", - "theme.admonition.info": "info", - "theme.admonition.note": "note", - "theme.admonition.tip": "tip", - "theme.blog.archive.description": "Archive", - "theme.blog.archive.title": "Archive", + "theme.TOCCollapsible.toggleButtonLabel": "このページの見出し", + "theme.admonition.caution": "注意", + "theme.admonition.danger": "危険", + "theme.admonition.info": "備考", + "theme.admonition.note": "注記", + "theme.admonition.tip": "ヒント", + "theme.blog.archive.description": "アーカイブ", + "theme.blog.archive.title": "アーカイブ", "theme.blog.paginator.navAriaLabel": "ブログ記事一覧のナビゲーション", "theme.blog.paginator.newerEntries": "新しい記事", "theme.blog.paginator.olderEntries": "過去の記事", @@ -27,39 +27,41 @@ "theme.blog.post.paginator.olderPost": "過去の記事", "theme.blog.post.plurals": "{count}件", "theme.blog.post.readMore": "もっと見る", - "theme.blog.post.readMoreLabel": "Read more about {title}", + "theme.blog.post.readMoreLabel": "{title}についてもっと見る", "theme.blog.post.readingTime.plurals": "約{readingTime}分", - "theme.blog.sidebar.navAriaLabel": "Blog recent posts navigation", - "theme.blog.tagTitle": "「{tagName}」タグの記事が{nPosts}あります", - "theme.colorToggle.ariaLabel": "Switch between dark and light mode (currently {mode})", - "theme.colorToggle.ariaLabel.mode.dark": "dark mode", - "theme.colorToggle.ariaLabel.mode.light": "light mode", + "theme.blog.sidebar.navAriaLabel": "最近のブログ記事のナビゲーション", + "theme.blog.tagTitle": "「{tagName}」タグの記事が{nPosts}件あります", + "theme.colorToggle.ariaLabel": "ダークモードを切り替える(現在は{mode})", + "theme.colorToggle.ariaLabel.mode.dark": "ダークモード", + "theme.colorToggle.ariaLabel.mode.light": "ライトモード", "theme.common.editThisPage": "このページを編集", - "theme.common.headingLinkTitle": "見出しへの直接リンク", + "theme.common.headingLinkTitle": "この見出しへのリンク", "theme.common.skipToMainContent": "メインコンテンツまでスキップ", - "theme.docs.DocCard.categoryDescription": "{count} items", - "theme.docs.breadcrumbs.home": "Home page", - "theme.docs.breadcrumbs.navAriaLabel": "Breadcrumbs", + "theme.docs.DocCard.categoryDescription": "{count}項目", + "theme.docs.breadcrumbs.home": "ホームページ", + "theme.docs.breadcrumbs.navAriaLabel": "パンくずリストのナビゲーション", "theme.docs.paginator.navAriaLabel": "ドキュメントのナビゲーション", "theme.docs.paginator.next": "次へ", "theme.docs.paginator.previous": "前へ", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "サイドバーを隠す", "theme.docs.sidebar.collapseButtonTitle": "サイドバーを隠す", "theme.docs.sidebar.expandButtonAriaLabel": "サイドバーを開く", "theme.docs.sidebar.expandButtonTitle": "サイドバーを開く", - "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", - "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", - "theme.docs.versionBadge.label": "Version: {versionLabel}", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", + "theme.docs.tagDocListPageTitle": "「{tagName}」タグのついた{nDocsTagged}", + "theme.docs.tagDocListPageTitle.nDocsTagged": "{count}記事", + "theme.docs.versionBadge.label": "バージョン: {versionLabel}", "theme.docs.versions.latestVersionLinkLabel": "最新バージョン", - "theme.docs.versions.latestVersionSuggestionLabel": "最新のドキュメントは{latestVersionLink} ({versionLabel}) を見てください。", - "theme.docs.versions.unmaintainedVersionLabel": "これは{siteTitle} {versionLabel}のドキュメントで現在はアクティブにメンテナンスされていません。", - "theme.docs.versions.unreleasedVersionLabel": "これはリリース前の{siteTitle} {versionLabel}のドキュメントです。", + "theme.docs.versions.latestVersionSuggestionLabel": "最新のドキュメントは{latestVersionLink} ({versionLabel}) を見てください", + "theme.docs.versions.unmaintainedVersionLabel": "これはバージョン{versionLabel}の{siteTitle}のドキュメントで現在はメンテナンスされていません", + "theme.docs.versions.unreleasedVersionLabel": "これはリリース前のバージョン{versionLabel}の{siteTitle}のドキュメントです。", "theme.lastUpdated.atDate": "{date}に", "theme.lastUpdated.byUser": "{user}が", "theme.lastUpdated.lastUpdatedAtBy": "{atDate}{byUser}最終更新", - "theme.navbar.mobileLanguageDropdown.label": "Languages", - "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": "← Back to main menu", - "theme.navbar.mobileVersionsDropdown.label": "Versions", + "theme.navbar.mobileLanguageDropdown.label": "他の言語", + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": "← メインメニューに戻る", + "theme.navbar.mobileVersionsDropdown.label": "他のバージョン", "theme.tags.tagsListLabel": "タグ:", "theme.tags.tagsPageLink": "全てのタグを見る", "theme.tags.tagsPageTitle": "タグ" diff --git a/packages/docusaurus-theme-translations/locales/ja/theme-live-codeblock.json b/packages/docusaurus-theme-translations/locales/ja/theme-live-codeblock.json index 4f4a503fe0e4..76a431d0c602 100644 --- a/packages/docusaurus-theme-translations/locales/ja/theme-live-codeblock.json +++ b/packages/docusaurus-theme-translations/locales/ja/theme-live-codeblock.json @@ -1,4 +1,4 @@ { - "theme.Playground.liveEditor": "Live Editor", - "theme.Playground.result": "Result" + "theme.Playground.liveEditor": "ライブエディター", + "theme.Playground.result": "結果" } diff --git a/packages/docusaurus-theme-translations/locales/ja/theme-search-algolia.json b/packages/docusaurus-theme-translations/locales/ja/theme-search-algolia.json index ca381283d01c..fa0ffbacdca7 100644 --- a/packages/docusaurus-theme-translations/locales/ja/theme-search-algolia.json +++ b/packages/docusaurus-theme-translations/locales/ja/theme-search-algolia.json @@ -1,35 +1,35 @@ { "theme.SearchBar.label": "検索", - "theme.SearchBar.seeAll": "See all {count} results", - "theme.SearchModal.errorScreen.helpText": "You might want to check your network connection.", - "theme.SearchModal.errorScreen.titleText": "Unable to fetch results", - "theme.SearchModal.footer.closeKeyAriaLabel": "Escape key", - "theme.SearchModal.footer.closeText": "to close", - "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Arrow down", - "theme.SearchModal.footer.navigateText": "to navigate", - "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Arrow up", - "theme.SearchModal.footer.searchByText": "Search by", - "theme.SearchModal.footer.selectKeyAriaLabel": "Enter key", - "theme.SearchModal.footer.selectText": "to select", - "theme.SearchModal.noResultsScreen.noResultsText": "No results for", - "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Let us know.", - "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Believe this query should return results?", - "theme.SearchModal.noResultsScreen.suggestedQueryText": "Try searching for", - "theme.SearchModal.placeholder": "Search docs", - "theme.SearchModal.searchBox.cancelButtonText": "Cancel", - "theme.SearchModal.searchBox.resetButtonTitle": "Clear the query", - "theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorite", - "theme.SearchModal.startScreen.noRecentSearchesText": "No recent searches", - "theme.SearchModal.startScreen.recentSearchesTitle": "Recent", - "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites", - "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remove this search from history", - "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Save this search", + "theme.SearchBar.seeAll": "検索結果{count}件をすべて見る", + "theme.SearchModal.errorScreen.helpText": "ネットワーク接続を確認してください", + "theme.SearchModal.errorScreen.titleText": "検索結果の取得に失敗しました", + "theme.SearchModal.footer.closeKeyAriaLabel": "エスケープキー", + "theme.SearchModal.footer.closeText": "閉じる", + "theme.SearchModal.footer.navigateDownKeyAriaLabel": "下矢印キー", + "theme.SearchModal.footer.navigateText": "移動", + "theme.SearchModal.footer.navigateUpKeyAriaLabel": "上矢印キー", + "theme.SearchModal.footer.searchByText": "検索", + "theme.SearchModal.footer.selectKeyAriaLabel": "エンターキー", + "theme.SearchModal.footer.selectText": "選ぶ", + "theme.SearchModal.noResultsScreen.noResultsText": "見つかりませんでした", + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "報告する", + "theme.SearchModal.noResultsScreen.reportMissingResultsText": "よりよい検索結果がありますか?", + "theme.SearchModal.noResultsScreen.suggestedQueryText": "次の検索を試す:", + "theme.SearchModal.placeholder": "ドキュメントを検索", + "theme.SearchModal.searchBox.cancelButtonText": "キャンセル", + "theme.SearchModal.searchBox.resetButtonTitle": "クリア", + "theme.SearchModal.startScreen.favoriteSearchesTitle": "お気に入り", + "theme.SearchModal.startScreen.noRecentSearchesText": "最近の検索履歴はありません", + "theme.SearchModal.startScreen.recentSearchesTitle": "最近の検索", + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "この検索をお気に入りから削除", + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "この検索を履歴から削除", + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "この検索をお気に入りに追加", "theme.SearchPage.algoliaLabel": "Algoliaで検索", "theme.SearchPage.documentsFound.plurals": "{count}件のドキュメントが見つかりました", "theme.SearchPage.emptyResultsTitle": "ドキュメントを検索", "theme.SearchPage.existingResultsTitle": "『{query}』の検索結果", "theme.SearchPage.fetchingNewResults": "新しい検索結果を取得しています...", "theme.SearchPage.inputLabel": "検索", - "theme.SearchPage.inputPlaceholder": "ここに検索するキーワードを入力してください", + "theme.SearchPage.inputPlaceholder": "検索するキーワードを入力してください", "theme.SearchPage.noResultsText": "検索結果が見つかりませんでした" } diff --git a/packages/docusaurus-theme-translations/locales/ko/theme-common.json b/packages/docusaurus-theme-translations/locales/ko/theme-common.json index 4b4f50e8bd81..18567774be7f 100644 --- a/packages/docusaurus-theme-translations/locales/ko/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/ko/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "문서 탐색", "theme.docs.paginator.next": "다음", "theme.docs.paginator.previous": "이전", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "사이드바 숨기기", "theme.docs.sidebar.collapseButtonTitle": "사이드바 숨기기", "theme.docs.sidebar.expandButtonAriaLabel": "사이드바 열기", "theme.docs.sidebar.expandButtonTitle": "사이드바 열기", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} \"{tagName}\" 태그에 분류되었습니다", "theme.docs.tagDocListPageTitle.nDocsTagged": "{count}개 문서가", "theme.docs.versionBadge.label": "버전: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/nl/theme-common.json b/packages/docusaurus-theme-translations/locales/nl/theme-common.json index 8c2fe4672857..9970dcb85cbd 100644 --- a/packages/docusaurus-theme-translations/locales/nl/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/nl/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Paginanavigatie documentatie", "theme.docs.paginator.next": "Volgende", "theme.docs.paginator.previous": "Vorige", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Zijbalk inklappen", "theme.docs.sidebar.collapseButtonTitle": "Zijbalk inklappen", "theme.docs.sidebar.expandButtonAriaLabel": "Zijbalk uitklappen", "theme.docs.sidebar.expandButtonTitle": "Zijbalk uitklappen", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} met \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Een artikel getagd|{count} artikelen getagd", "theme.docs.versionBadge.label": "Versie: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/pl/theme-common.json b/packages/docusaurus-theme-translations/locales/pl/theme-common.json index a28dedf0c9f5..9cd009cd3e18 100644 --- a/packages/docusaurus-theme-translations/locales/pl/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/pl/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Nawigacja na stronie dokumentacji", "theme.docs.paginator.next": "Następna strona", "theme.docs.paginator.previous": "Poprzednia strona", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Zwiń boczny panel", "theme.docs.sidebar.collapseButtonTitle": "Zwiń boczny panel", "theme.docs.sidebar.expandButtonAriaLabel": "Rozszerz boczny panel", "theme.docs.sidebar.expandButtonTitle": "Rozszerz boczny panel", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Jedna strona dokumentacji otagowana|{count} strony dokumentacji otagowane|{count} stron dokumentacji otagowanych", "theme.docs.versionBadge.label": "Wersja: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/pt-BR/theme-common.json b/packages/docusaurus-theme-translations/locales/pt-BR/theme-common.json index 7f9ec716fedd..65ad133049ea 100644 --- a/packages/docusaurus-theme-translations/locales/pt-BR/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/pt-BR/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Navigação das páginas de documentação", "theme.docs.paginator.next": "Próxima", "theme.docs.paginator.previous": "Anterior", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Fechar painel lateral", "theme.docs.sidebar.collapseButtonTitle": "Fechar painel lateral", "theme.docs.sidebar.expandButtonAriaLabel": "Expandir painel lateral", "theme.docs.sidebar.expandButtonTitle": "Expandir painel lateral", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} com \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Um documento selecionado|{count} documentos selecionados", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/pt-PT/theme-common.json b/packages/docusaurus-theme-translations/locales/pt-PT/theme-common.json index 11788c591cb4..81a2e2fc142d 100644 --- a/packages/docusaurus-theme-translations/locales/pt-PT/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/pt-PT/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Navigação das páginas de documentação", "theme.docs.paginator.next": "Próxima", "theme.docs.paginator.previous": "Anterior", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Colapsar barra lateral", "theme.docs.sidebar.collapseButtonTitle": "Colapsar barra lateral", "theme.docs.sidebar.expandButtonAriaLabel": "Expandir barra lateral", "theme.docs.sidebar.expandButtonTitle": "Expandir barra lateral", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} with \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "One doc tagged|{count} docs tagged", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/ru/theme-common.json b/packages/docusaurus-theme-translations/locales/ru/theme-common.json index 97b38b8532dc..6a2feed11ad7 100644 --- a/packages/docusaurus-theme-translations/locales/ru/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/ru/theme-common.json @@ -4,7 +4,7 @@ "theme.CodeBlock.copied": "Скопировано", "theme.CodeBlock.copy": "Скопировать", "theme.CodeBlock.copyButtonAriaLabel": "Скопировать в буфер обмена", - "theme.CodeBlock.wordWrapToggle": "Toggle word wrap", + "theme.CodeBlock.wordWrapToggle": "Переключить перенос по строкам", "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": "Свернуть/развернуть категорию '{label}'", "theme.ErrorPageContent.title": "На странице произошёл сбой.", "theme.ErrorPageContent.tryAgain": "Попробуйте ещё раз", @@ -12,11 +12,11 @@ "theme.NotFound.p2": "Пожалуйста, обратитесь к владельцу сайта, с которого вы перешли на эту ссылку, чтобы сообщить ему, что ссылка не работает.", "theme.NotFound.title": "Страница не найдена", "theme.TOCCollapsible.toggleButtonLabel": "Содержание этой страницы", - "theme.admonition.caution": "caution", - "theme.admonition.danger": "danger", - "theme.admonition.info": "info", - "theme.admonition.note": "note", - "theme.admonition.tip": "tip", + "theme.admonition.caution": "предупреждение", + "theme.admonition.danger": "осторожно", + "theme.admonition.info": "к сведению", + "theme.admonition.note": "примечание", + "theme.admonition.tip": "подсказка", "theme.blog.archive.description": "Архив", "theme.blog.archive.title": "Архив", "theme.blog.paginator.navAriaLabel": "Навигация по странице списка блогов", @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Навигация по странице документации", "theme.docs.paginator.next": "Следующая страница", "theme.docs.paginator.previous": "Предыдущая страница", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Закрыть панель навигации", "theme.docs.sidebar.collapseButtonAriaLabel": "Свернуть сайдбар", "theme.docs.sidebar.collapseButtonTitle": "Свернуть сайдбар", "theme.docs.sidebar.expandButtonAriaLabel": "Развернуть сайдбар", "theme.docs.sidebar.expandButtonTitle": "Развернуть сайдбар", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Переключить навигационную панель", "theme.docs.tagDocListPageTitle": "{nDocsTagged} с тегом \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Одна страница|{count} страницы|{count} страниц", "theme.docs.versionBadge.label": "Версия: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/ru/theme-search-algolia.json b/packages/docusaurus-theme-translations/locales/ru/theme-search-algolia.json index 36152fa3e810..39005aee5c24 100644 --- a/packages/docusaurus-theme-translations/locales/ru/theme-search-algolia.json +++ b/packages/docusaurus-theme-translations/locales/ru/theme-search-algolia.json @@ -1,29 +1,29 @@ { "theme.SearchBar.label": "Поиск", "theme.SearchBar.seeAll": "Посмотреть все результаты ({count})", - "theme.SearchModal.errorScreen.helpText": "You might want to check your network connection.", - "theme.SearchModal.errorScreen.titleText": "Unable to fetch results", - "theme.SearchModal.footer.closeKeyAriaLabel": "Escape key", - "theme.SearchModal.footer.closeText": "to close", - "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Arrow down", - "theme.SearchModal.footer.navigateText": "to navigate", - "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Arrow up", - "theme.SearchModal.footer.searchByText": "Search by", - "theme.SearchModal.footer.selectKeyAriaLabel": "Enter key", - "theme.SearchModal.footer.selectText": "to select", - "theme.SearchModal.noResultsScreen.noResultsText": "No results for", - "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Let us know.", - "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Believe this query should return results?", - "theme.SearchModal.noResultsScreen.suggestedQueryText": "Try searching for", - "theme.SearchModal.placeholder": "Search docs", - "theme.SearchModal.searchBox.cancelButtonText": "Cancel", - "theme.SearchModal.searchBox.resetButtonTitle": "Clear the query", - "theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorite", - "theme.SearchModal.startScreen.noRecentSearchesText": "No recent searches", - "theme.SearchModal.startScreen.recentSearchesTitle": "Recent", - "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites", - "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remove this search from history", - "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Save this search", + "theme.SearchModal.errorScreen.helpText": "Проверьте подключение к интернету.", + "theme.SearchModal.errorScreen.titleText": "Невозможно загрузить результаты поиска", + "theme.SearchModal.footer.closeKeyAriaLabel": "Клавиша Escape", + "theme.SearchModal.footer.closeText": "закрыть", + "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Клавиша стрелка вниз", + "theme.SearchModal.footer.navigateText": "навигация", + "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Клавиша стрелка вверх", + "theme.SearchModal.footer.searchByText": "Поиск от", + "theme.SearchModal.footer.selectKeyAriaLabel": "Клавиша Enter", + "theme.SearchModal.footer.selectText": "выбрать", + "theme.SearchModal.noResultsScreen.noResultsText": "Нет результатов по запросу", + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Сообщите нам.", + "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Нет подходящего результата поиска?", + "theme.SearchModal.noResultsScreen.suggestedQueryText": "Попробуйте", + "theme.SearchModal.placeholder": "Поиск", + "theme.SearchModal.searchBox.cancelButtonText": "Отменить", + "theme.SearchModal.searchBox.resetButtonTitle": "Очистить", + "theme.SearchModal.startScreen.favoriteSearchesTitle": "Избранное", + "theme.SearchModal.startScreen.noRecentSearchesText": "Нет истории поиска", + "theme.SearchModal.startScreen.recentSearchesTitle": "Недавнее", + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Удалить запись из избранное", + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Удалить запись из историю", + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Сохранить поисковый запрос", "theme.SearchPage.algoliaLabel": "Поиск от Algolia", "theme.SearchPage.documentsFound.plurals": "{count} документ|{count} документа|{count} документов", "theme.SearchPage.emptyResultsTitle": "Поиск по сайту", diff --git a/packages/docusaurus-theme-translations/locales/sr/theme-common.json b/packages/docusaurus-theme-translations/locales/sr/theme-common.json index 152b345efef0..8d9931f67d17 100644 --- a/packages/docusaurus-theme-translations/locales/sr/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/sr/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Навигација по документима", "theme.docs.paginator.next": "Даље", "theme.docs.paginator.previous": "Назад", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Сакриј бочну листу", "theme.docs.sidebar.collapseButtonTitle": "Сакриј бочну листу", "theme.docs.sidebar.expandButtonAriaLabel": "Прошири бочну листу", "theme.docs.sidebar.expandButtonTitle": "Прошири бочну листу", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} означени са \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Један документ означен|{count} означених докумената", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/sv/theme-common.json b/packages/docusaurus-theme-translations/locales/sv/theme-common.json index a18c99c7b125..b8e1a8df50b5 100644 --- a/packages/docusaurus-theme-translations/locales/sv/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/sv/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Navigation av dokument", "theme.docs.paginator.next": "Nästa", "theme.docs.paginator.previous": "Föregående", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Stäng sidofältet", "theme.docs.sidebar.collapseButtonTitle": "Stäng sidofältet", "theme.docs.sidebar.expandButtonAriaLabel": "Expandera sidofältet", "theme.docs.sidebar.expandButtonTitle": "Expandera sidofältet", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} med \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Ett dokument taggat|{count} dokument taggade", "theme.docs.versionBadge.label": "Version: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/sv/theme-search-algolia.json b/packages/docusaurus-theme-translations/locales/sv/theme-search-algolia.json index 16fd9f49d282..34c29f8cc781 100644 --- a/packages/docusaurus-theme-translations/locales/sv/theme-search-algolia.json +++ b/packages/docusaurus-theme-translations/locales/sv/theme-search-algolia.json @@ -1,6 +1,29 @@ { "theme.SearchBar.label": "Sök", "theme.SearchBar.seeAll": "Se alla {count} resultat", + "theme.SearchModal.errorScreen.helpText": "You might want to check your network connection.", + "theme.SearchModal.errorScreen.titleText": "Unable to fetch results", + "theme.SearchModal.footer.closeKeyAriaLabel": "Escape key", + "theme.SearchModal.footer.closeText": "to close", + "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Arrow down", + "theme.SearchModal.footer.navigateText": "to navigate", + "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Arrow up", + "theme.SearchModal.footer.searchByText": "Search by", + "theme.SearchModal.footer.selectKeyAriaLabel": "Enter key", + "theme.SearchModal.footer.selectText": "to select", + "theme.SearchModal.noResultsScreen.noResultsText": "No results for", + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Let us know.", + "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Believe this query should return results?", + "theme.SearchModal.noResultsScreen.suggestedQueryText": "Try searching for", + "theme.SearchModal.placeholder": "Search docs", + "theme.SearchModal.searchBox.cancelButtonText": "Cancel", + "theme.SearchModal.searchBox.resetButtonTitle": "Clear the query", + "theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorite", + "theme.SearchModal.startScreen.noRecentSearchesText": "No recent searches", + "theme.SearchModal.startScreen.recentSearchesTitle": "Recent", + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites", + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remove this search from history", + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Save this search", "theme.SearchPage.algoliaLabel": "Search by Algolia", "theme.SearchPage.documentsFound.plurals": "Ett dokument hittades|{count} dokument hittades", "theme.SearchPage.emptyResultsTitle": "Sök genom dokumentationen", diff --git a/packages/docusaurus-theme-translations/locales/tr/plugin-ideal-image.json b/packages/docusaurus-theme-translations/locales/tr/plugin-ideal-image.json index 3576b692c08d..5e9f0565c332 100644 --- a/packages/docusaurus-theme-translations/locales/tr/plugin-ideal-image.json +++ b/packages/docusaurus-theme-translations/locales/tr/plugin-ideal-image.json @@ -1,7 +1,7 @@ { - "theme.IdealImageMessage.404error": "404. Image not found", - "theme.IdealImageMessage.error": "Error. Click to reload", - "theme.IdealImageMessage.load": "Click to load{sizeMessage}", - "theme.IdealImageMessage.loading": "Loading...", - "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded" + "theme.IdealImageMessage.404error": "404. Resim Bulunamadı!", + "theme.IdealImageMessage.error": "Hata. Yeniden yüklemek için tıklayın", + "theme.IdealImageMessage.load": "Yüklemek için tıklayın{sizeMessage}", + "theme.IdealImageMessage.loading": "Yükleniyor...", + "theme.IdealImageMessage.offline": "Tarayıcınız çevrimdışı. Resim yüklenemedi" } diff --git a/packages/docusaurus-theme-translations/locales/tr/theme-common.json b/packages/docusaurus-theme-translations/locales/tr/theme-common.json index 2131b5f45bca..69c5647f151d 100644 --- a/packages/docusaurus-theme-translations/locales/tr/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/tr/theme-common.json @@ -6,8 +6,8 @@ "theme.CodeBlock.copyButtonAriaLabel": "Kodu panoya kopyala", "theme.CodeBlock.wordWrapToggle": "Toggle word wrap", "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": "Toggle the collapsible sidebar category '{label}'", - "theme.ErrorPageContent.title": "This page crashed.", - "theme.ErrorPageContent.tryAgain": "Try again", + "theme.ErrorPageContent.title": "Bu sayfa çöktü.", + "theme.ErrorPageContent.tryAgain": "Tekrar deneyin", "theme.NotFound.p1": "Aradığınız şeyi bulamadık.", "theme.NotFound.p2": "Lütfen sizi orijinal URL'ye yönlendiren sitenin sahibiyle iletişime geçin ve bağlantısının bozuk olduğunu bildirin.", "theme.NotFound.title": "Sayfa Bulunamadı", @@ -27,26 +27,28 @@ "theme.blog.post.paginator.olderPost": "Daha Eski Gönderi", "theme.blog.post.plurals": "Bir gönderi|{count} gönderi", "theme.blog.post.readMore": "Daha Fazla", - "theme.blog.post.readMoreLabel": "Read more about {title}", + "theme.blog.post.readMoreLabel": "{title} hakkında daha fazla bilgi edinin", "theme.blog.post.readingTime.plurals": "{readingTime} dakikalık okuma|{readingTime} dakikalık okuma", "theme.blog.sidebar.navAriaLabel": "Blog son gönderiler navigasyonu", "theme.blog.tagTitle": "\"{tagName}\" ile etiketlenmiş {nPosts}", - "theme.colorToggle.ariaLabel": "Switch between dark and light mode (currently {mode})", - "theme.colorToggle.ariaLabel.mode.dark": "dark mode", - "theme.colorToggle.ariaLabel.mode.light": "light mode", + "theme.colorToggle.ariaLabel": "Karanlık ve aydınlık mod arasında geçiş yapın (şu anda {mode})", + "theme.colorToggle.ariaLabel.mode.dark": "Karanlık mod", + "theme.colorToggle.ariaLabel.mode.light": "Aydınlık mod", "theme.common.editThisPage": "Bu sayfayı düzenle", "theme.common.headingLinkTitle": "Başlığa doğrudan bağlantı", "theme.common.skipToMainContent": "Ana içeriğe geç", "theme.docs.DocCard.categoryDescription": "{count} items", - "theme.docs.breadcrumbs.home": "Home page", + "theme.docs.breadcrumbs.home": "Ana sayfa", "theme.docs.breadcrumbs.navAriaLabel": "Breadcrumbs", "theme.docs.paginator.navAriaLabel": "Dokümanlar sayfası navigasyonu", "theme.docs.paginator.next": "Sonraki", "theme.docs.paginator.previous": "Önceki", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Kenar çubuğunu daralt", "theme.docs.sidebar.collapseButtonTitle": "Kenar çubuğunu daralt", "theme.docs.sidebar.expandButtonAriaLabel": "Kenar çubuğunu genişlet", "theme.docs.sidebar.expandButtonTitle": "Kenar çubuğunu genişlet", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "\"{tagName}\" ile etiketlenmiş {nDocsTagged}", "theme.docs.tagDocListPageTitle.nDocsTagged": "Bir doküman etiketlendi|{count} doküman etiketlendi", "theme.docs.versionBadge.label": "Version: {versionLabel}", @@ -56,7 +58,7 @@ "theme.docs.versions.unreleasedVersionLabel": "Bu, {siteTitle} {versionLabel} sürümü için yayınlanmamış dokümantasyondur.", "theme.lastUpdated.atDate": " {date} tarihinde", "theme.lastUpdated.byUser": " {user} tarafından", - "theme.lastUpdated.lastUpdatedAtBy": "En son{atDate}{byUser} güncellendi", + "theme.lastUpdated.lastUpdatedAtBy": "En son {atDate} {byUser} güncellendi", "theme.navbar.mobileLanguageDropdown.label": "Languages", "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": "← Ana menüye dön", "theme.navbar.mobileVersionsDropdown.label": "Versiyonlar", diff --git a/packages/docusaurus-theme-translations/locales/tr/theme-search-algolia.json b/packages/docusaurus-theme-translations/locales/tr/theme-search-algolia.json index 743d2072ddae..ba00e4591913 100644 --- a/packages/docusaurus-theme-translations/locales/tr/theme-search-algolia.json +++ b/packages/docusaurus-theme-translations/locales/tr/theme-search-algolia.json @@ -1,29 +1,29 @@ { "theme.SearchBar.label": "Ara", - "theme.SearchBar.seeAll": "See all {count} results", - "theme.SearchModal.errorScreen.helpText": "You might want to check your network connection.", - "theme.SearchModal.errorScreen.titleText": "Unable to fetch results", - "theme.SearchModal.footer.closeKeyAriaLabel": "Escape key", - "theme.SearchModal.footer.closeText": "to close", - "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Arrow down", - "theme.SearchModal.footer.navigateText": "to navigate", - "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Arrow up", - "theme.SearchModal.footer.searchByText": "Search by", + "theme.SearchBar.seeAll": "{count} sonucun tümünü görün", + "theme.SearchModal.errorScreen.helpText": "Ağ bağlantınızı kontrol etmek isteyebilirsiniz.", + "theme.SearchModal.errorScreen.titleText": "Sonuçlar alınamadı", + "theme.SearchModal.footer.closeKeyAriaLabel": "ESC Tuşu", + "theme.SearchModal.footer.closeText": "Kapat", + "theme.SearchModal.footer.navigateDownKeyAriaLabel": "Aşağı ok", + "theme.SearchModal.footer.navigateText": "yönlendir", + "theme.SearchModal.footer.navigateUpKeyAriaLabel": "Yukarı ok", + "theme.SearchModal.footer.searchByText": "Şuna göre ara:", "theme.SearchModal.footer.selectKeyAriaLabel": "Enter key", - "theme.SearchModal.footer.selectText": "to select", - "theme.SearchModal.noResultsScreen.noResultsText": "No results for", - "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Let us know.", - "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Believe this query should return results?", - "theme.SearchModal.noResultsScreen.suggestedQueryText": "Try searching for", - "theme.SearchModal.placeholder": "Search docs", - "theme.SearchModal.searchBox.cancelButtonText": "Cancel", - "theme.SearchModal.searchBox.resetButtonTitle": "Clear the query", - "theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorite", - "theme.SearchModal.startScreen.noRecentSearchesText": "No recent searches", - "theme.SearchModal.startScreen.recentSearchesTitle": "Recent", - "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites", - "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remove this search from history", - "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Save this search", + "theme.SearchModal.footer.selectText": "Seç", + "theme.SearchModal.noResultsScreen.noResultsText": "için sonuç yok", + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Bilmemize izin ver.", + "theme.SearchModal.noResultsScreen.reportMissingResultsText": "Bu sorgunun sonuç döndürmesi gerektiğine inanıyor musunuz?", + "theme.SearchModal.noResultsScreen.suggestedQueryText": "Aramayı deneyin", + "theme.SearchModal.placeholder": "Dokümanlarda ara", + "theme.SearchModal.searchBox.cancelButtonText": "İptal", + "theme.SearchModal.searchBox.resetButtonTitle": "Sorguyu temizle", + "theme.SearchModal.startScreen.favoriteSearchesTitle": "Favori", + "theme.SearchModal.startScreen.noRecentSearchesText": "Son arama yok", + "theme.SearchModal.startScreen.recentSearchesTitle": "Son", + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Bu aramayı favorilerden kaldır", + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Bu aramayı geçmişten kaldır", + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Bu aramayı kaydet", "theme.SearchPage.algoliaLabel": "Algolia ile Ara", "theme.SearchPage.documentsFound.plurals": "Bir döküman bulundu|{count} döküman bulundu", "theme.SearchPage.emptyResultsTitle": "Dokümanlarda ara", diff --git a/packages/docusaurus-theme-translations/locales/uk/theme-common.json b/packages/docusaurus-theme-translations/locales/uk/theme-common.json index 67663024c8d4..0a838bd2682f 100644 --- a/packages/docusaurus-theme-translations/locales/uk/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/uk/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "Навігація по сторінці документації", "theme.docs.paginator.next": "Наступна сторінка", "theme.docs.paginator.previous": "Попередня сторінка", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Згорнути сайдбар", "theme.docs.sidebar.collapseButtonTitle": "Згорнути сайдбар", "theme.docs.sidebar.expandButtonAriaLabel": "Розгорнути сайдбар", "theme.docs.sidebar.expandButtonTitle": "Розгорнути сайдбар", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} з тегом \"{tagName}\"", "theme.docs.tagDocListPageTitle.nDocsTagged": "Одна сторінка|{count} сторінки|{count} сторінок", "theme.docs.versionBadge.label": "Версія: {versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/vi/theme-common.json b/packages/docusaurus-theme-translations/locales/vi/theme-common.json index 0b16ebc9e6f5..4784d3e47b77 100644 --- a/packages/docusaurus-theme-translations/locales/vi/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/vi/theme-common.json @@ -25,10 +25,10 @@ "theme.blog.post.paginator.navAriaLabel": "Thanh điều hướng của trang bài viết", "theme.blog.post.paginator.newerPost": "Bài mới hơn", "theme.blog.post.paginator.olderPost": "Bài cũ hơn", - "theme.blog.post.plurals": "Một bài viết|{count} bài viết", + "theme.blog.post.plurals": "{count} bài viết", "theme.blog.post.readMore": "Đọc tiếp", "theme.blog.post.readMoreLabel": "Đọc thêm về {title}", - "theme.blog.post.readingTime.plurals": "Một phút để đọc|{readingTime} phút để đọc", + "theme.blog.post.readingTime.plurals": "{readingTime} phút để đọc", "theme.blog.sidebar.navAriaLabel": "Điều hướng các bài viết gần đây trên blog", "theme.blog.tagTitle": "{nPosts} được gắn thẻ \"{tagName}\"", "theme.colorToggle.ariaLabel": "Chuyển đổi chế độ sáng và tối (hiện tại {mode})", @@ -43,12 +43,14 @@ "theme.docs.paginator.navAriaLabel": "Thanh điều hướng của trang tài liệu", "theme.docs.paginator.next": "Kế tiếp", "theme.docs.paginator.previous": "Trước", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "Thu gọn thanh bên", "theme.docs.sidebar.collapseButtonTitle": "Thu gọn thanh bên", "theme.docs.sidebar.expandButtonAriaLabel": "Mở rộng thanh bên", "theme.docs.sidebar.expandButtonTitle": "Mở rộng thanh bên", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged} với \"{tagName}\"", - "theme.docs.tagDocListPageTitle.nDocsTagged": "Một tài liệu đã gắn thẻ|{count} tài liệu đã gắn thẻ", + "theme.docs.tagDocListPageTitle.nDocsTagged": "{count} tài liệu đã gắn thẻ", "theme.docs.versionBadge.label": "Phiên bản: {versionLabel}", "theme.docs.versions.latestVersionLinkLabel": "phiên bản mới nhất", "theme.docs.versions.latestVersionSuggestionLabel": "Để xem các cập nhật mới nhất, vui lòng xem phiên bản {latestVersionLink} ({versionLabel}).", diff --git a/packages/docusaurus-theme-translations/locales/zh-Hans/theme-common.json b/packages/docusaurus-theme-translations/locales/zh-Hans/theme-common.json index 327a56faee75..6aebc6c4ac6c 100644 --- a/packages/docusaurus-theme-translations/locales/zh-Hans/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/zh-Hans/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "文档分页导航", "theme.docs.paginator.next": "下一页", "theme.docs.paginator.previous": "上一页", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "收起侧边栏", "theme.docs.sidebar.collapseButtonTitle": "收起侧边栏", "theme.docs.sidebar.expandButtonAriaLabel": "展开侧边栏", "theme.docs.sidebar.expandButtonTitle": "展开侧边栏", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged}「{tagName}」", "theme.docs.tagDocListPageTitle.nDocsTagged": "{count} 篇文档带有标签", "theme.docs.versionBadge.label": "版本:{versionLabel}", diff --git a/packages/docusaurus-theme-translations/locales/zh-Hant/theme-common.json b/packages/docusaurus-theme-translations/locales/zh-Hant/theme-common.json index a90342715415..84a509608978 100644 --- a/packages/docusaurus-theme-translations/locales/zh-Hant/theme-common.json +++ b/packages/docusaurus-theme-translations/locales/zh-Hant/theme-common.json @@ -43,10 +43,12 @@ "theme.docs.paginator.navAriaLabel": "文件分頁導覽", "theme.docs.paginator.next": "下一頁", "theme.docs.paginator.previous": "上一頁", + "theme.docs.sidebar.closeSidebarButtonAriaLabel": "Close navigation bar", "theme.docs.sidebar.collapseButtonAriaLabel": "收起側邊欄", "theme.docs.sidebar.collapseButtonTitle": "收起側邊欄", "theme.docs.sidebar.expandButtonAriaLabel": "展開側邊欄", "theme.docs.sidebar.expandButtonTitle": "展開側邊欄", + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Toggle navigation bar", "theme.docs.tagDocListPageTitle": "{nDocsTagged}「{tagName}」", "theme.docs.tagDocListPageTitle.nDocsTagged": "{count} 篇文件帶有標籤", "theme.docs.versionBadge.label": "版本:{versionLabel}", diff --git a/packages/docusaurus-theme-translations/package.json b/packages/docusaurus-theme-translations/package.json index 519ff73d0c50..8ee9a4928a47 100644 --- a/packages/docusaurus-theme-translations/package.json +++ b/packages/docusaurus-theme-translations/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/theme-translations", - "version": "2.1.0", + "version": "2.2.0", "description": "Docusaurus theme translations.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -23,8 +23,8 @@ "tslib": "^2.4.0" }, "devDependencies": { - "@docusaurus/core": "2.1.0", - "@docusaurus/logger": "2.1.0", + "@docusaurus/core": "2.2.0", + "@docusaurus/logger": "2.2.0", "lodash": "^4.17.21" }, "engines": { diff --git a/packages/docusaurus-types/package.json b/packages/docusaurus-types/package.json index 3b61877c3056..96a735b192c9 100644 --- a/packages/docusaurus-types/package.json +++ b/packages/docusaurus-types/package.json @@ -1,6 +1,6 @@ { "name": "@docusaurus/types", - "version": "2.1.0", + "version": "2.2.0", "description": "Common types for Docusaurus packages.", "types": "./src/index.d.ts", "publishConfig": { diff --git a/packages/docusaurus-types/src/config.d.ts b/packages/docusaurus-types/src/config.d.ts index 77fd2126bed9..fa8fe1a190ea 100644 --- a/packages/docusaurus-types/src/config.d.ts +++ b/packages/docusaurus-types/src/config.d.ts @@ -8,7 +8,7 @@ import type {RuleSetRule} from 'webpack'; import type {Required as RequireKeys, DeepPartial} from 'utility-types'; import type {I18nConfig} from './i18n'; -import type {PluginConfig, PresetConfig} from './plugin'; +import type {PluginConfig, PresetConfig, HtmlTagObject} from './plugin'; export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'throw'; @@ -16,6 +16,20 @@ export type ThemeConfig = { [key: string]: unknown; }; +export type MarkdownConfig = { + /** + * Allow mermaid language code blocks to be rendered into Mermaid diagrams: + * + * - `true`: code blocks with language mermaid will be rendered. + * - `false` | `undefined` (default): code blocks with language mermaid + * will be left as code blocks. + * + * @see https://docusaurus.io/docs/markdown-features/diagrams/ + * @default false + */ + mermaid?: boolean; +}; + /** * Docusaurus config, after validation/normalization. */ @@ -192,6 +206,13 @@ export type DocusaurusConfig = { * @default ["static"] */ staticDirectories: string[]; + /** + * An array of tags that will be inserted in the HTML ``. + * + * @see https://docusaurus.io/docs/api/docusaurus-config#head + * @default [] + */ + headTags: HtmlTagObject[]; /** * An array of scripts to load. The values can be either strings or plain * objects of attribute-value maps. The `