mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-17 02:56:57 +02:00
chore: backport retro compatible commits for the Docusaurus v2.2 release (#8264)
Co-authored-by: Jan Peer Stoecklmair <jan.peer.stoecklmair@dynatrace.com> Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: LittleboyHarry <littleboyharry@qq.com> Co-authored-by: Mikey O'Toole <mikey@homotechsual.dev> Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com> Co-authored-by: Nguyễn Thành Nam <namnguyenthanh.work@gmail.com> Co-authored-by: Sanjaiyan Parthipan <parthipankalayini@gmail.com> Co-authored-by: Ramazan SANCAR <ramazansancar4545@gmail.com> Co-authored-by: mturoci <64769322+mturoci@users.noreply.github.com> Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com> Co-authored-by: Pranav Joglekar <pranav2000joglekar@gmail.com> Co-authored-by: forgeRW <20483211+forgeRW@users.noreply.github.com> Co-authored-by: Masahiko Hara <pasora@sfc.wide.ad.jp> Co-authored-by: Johan Fagerberg <johanringmann@gmail.com> Co-authored-by: John Reilly <johnny_reilly@hotmail.com> Co-authored-by: Sam Wall <oss@samuelwall.co.uk> Co-authored-by: Jeferson S. Brito <30840709+jeferson-sb@users.noreply.github.com> Co-authored-by: evan <evanmccarthy@outlook.com> Co-authored-by: Xabier Lahuerta Vazquez <xlahuerta@protonmail.com> Co-authored-by: Forresst <forresst17@gmail.com> Co-authored-by: Shanmughapriyan S <priyanshan03@gmail.com> Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
This commit is contained in:
parent
7743aa6307
commit
de972142a8
155 changed files with 2822 additions and 563 deletions
|
@ -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"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"changelog": {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -456,8 +456,10 @@ export default async function init(
|
|||
reqTemplate?: string,
|
||||
cliOptions: CLIOptions = {},
|
||||
): Promise<void> {
|
||||
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);
|
||||
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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": [
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<MDXOptions> & {
|
||||
markdownConfig: MarkdownConfig;
|
||||
staticDirs: string[];
|
||||
siteDir: string;
|
||||
isMDXPartial?: (filePath: string) => boolean;
|
||||
|
@ -71,7 +74,6 @@ export type Options = Partial<MDXOptions> & {
|
|||
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,
|
||||
{
|
||||
|
|
|
@ -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 <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
|
||||
<h1>{\`Heading 1\`}</h1>
|
||||
<p>{\`No Mermaid diagram :(\`}</p>
|
||||
<pre><code parentName="pre" {...{
|
||||
"className": "language-js"
|
||||
}}>{\`this is not mermaid
|
||||
\`}</code></pre>
|
||||
</MDXLayout>;
|
||||
}
|
||||
|
||||
;
|
||||
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 <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
|
||||
<h1>{\`Heading 1\`}</h1>
|
||||
<mermaid {...{
|
||||
"value": "graph TD;/n A-->B;/n A-->C;/n B-->D;/n C-->D;"
|
||||
}}></mermaid>
|
||||
</MDXLayout>;
|
||||
}
|
||||
|
||||
;
|
||||
MDXContent.isMDXComponent = true;"
|
||||
`;
|
|
@ -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();
|
||||
});
|
||||
});
|
32
packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts
Normal file
32
packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts
Normal file
|
@ -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,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -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": "*",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@ exports[`createRedirectPageContent encodes uri special chars 1`] = `
|
|||
<link rel="canonical" href="https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/';
|
||||
window.location.href = 'https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>"
|
||||
`;
|
||||
|
@ -23,7 +23,7 @@ exports[`createRedirectPageContent works 1`] = `
|
|||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
window.location.href = 'https://docusaurus.io/' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>"
|
||||
`;
|
||||
|
|
|
@ -10,7 +10,7 @@ exports[`toRedirectFiles creates appropriate metadata for empty baseUrl: fileCon
|
|||
<link rel="canonical" href="/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = '/abc';
|
||||
window.location.href = '/abc' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
]
|
||||
|
@ -26,7 +26,7 @@ exports[`toRedirectFiles creates appropriate metadata for root baseUrl: fileCont
|
|||
<link rel="canonical" href="/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = '/abc';
|
||||
window.location.href = '/abc' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
]
|
||||
|
@ -42,7 +42,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC
|
|||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
window.location.href = 'https://docusaurus.io/abc' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -53,7 +53,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC
|
|||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
window.location.href = 'https://docusaurus.io/def.html' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -64,7 +64,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=false: fileC
|
|||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
window.location.href = 'https://docusaurus.io/' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
]
|
||||
|
@ -80,7 +80,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo
|
|||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
window.location.href = 'https://docusaurus.io/abc' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -91,7 +91,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo
|
|||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
window.location.href = 'https://docusaurus.io/def.html' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -102,7 +102,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=true: fileCo
|
|||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
window.location.href = 'https://docusaurus.io/' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
]
|
||||
|
@ -118,7 +118,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f
|
|||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
window.location.href = 'https://docusaurus.io/abc' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -129,7 +129,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f
|
|||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
window.location.href = 'https://docusaurus.io/def.html' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
"<!DOCTYPE html>
|
||||
|
@ -140,7 +140,7 @@ exports[`toRedirectFiles creates appropriate metadata trailingSlash=undefined: f
|
|||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
window.location.href = 'https://docusaurus.io/' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>",
|
||||
]
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export default `
|
|||
<link rel="canonical" href="<%= it.toUrl %>" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = '<%= it.toUrl %>';
|
||||
window.location.href = '<%= it.toUrl %>' + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</html>
|
||||
`;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -455,6 +455,7 @@ export default async function pluginContentBlog(
|
|||
(author) => author.imageURL,
|
||||
),
|
||||
}),
|
||||
markdownConfig: siteConfig.markdown,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -93,6 +93,18 @@ function createTestUtils({
|
|||
});
|
||||
}
|
||||
|
||||
// Makes it easier to assert failure cases
|
||||
async function getProcessDocFileError(
|
||||
docFileArg: DocFile | string,
|
||||
): Promise<Error> {
|
||||
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."`,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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<DocMetadataBase> {
|
||||
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},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -375,6 +375,7 @@ export default async function pluginContentDocs(
|
|||
}) => ({
|
||||
image: frontMatter.image,
|
||||
}),
|
||||
markdownConfig: siteConfig.markdown,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -211,6 +211,7 @@ export default function pluginContentPages(
|
|||
`${docuHash(aliasedSource)}.json`,
|
||||
);
|
||||
},
|
||||
markdownConfig: siteConfig.markdown,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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 (
|
||||
<img
|
||||
src={typeof img === 'string' ? img : img.default}
|
||||
className={className}
|
||||
alt={alt}
|
||||
{...props}
|
||||
/>
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
<img src={typeof img === 'string' ? img : img.default} {...propsRest} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ReactIdealImage
|
||||
{...props}
|
||||
alt={alt}
|
||||
className={className}
|
||||
{...propsRest}
|
||||
height={img.src.height ?? 100}
|
||||
width={img.src.width ?? 100}
|
||||
placeholder={{lqip: img.preSrc}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-pwa",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Docusaurus Plugin to add PWA support.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-pwa.d.ts",
|
||||
|
@ -22,12 +22,12 @@
|
|||
"dependencies": {
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/preset-env": "^7.18.6",
|
||||
"@docusaurus/core": "2.1.0",
|
||||
"@docusaurus/theme-common": "2.1.0",
|
||||
"@docusaurus/theme-translations": "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/theme-common": "2.2.0",
|
||||
"@docusaurus/theme-translations": "2.2.0",
|
||||
"@docusaurus/types": "2.2.0",
|
||||
"@docusaurus/utils": "2.2.0",
|
||||
"@docusaurus/utils-validation": "2.2.0",
|
||||
"babel-loader": "^8.2.5",
|
||||
"clsx": "^1.2.1",
|
||||
"core-js": "^3.23.3",
|
||||
|
@ -40,7 +40,7 @@
|
|||
"workbox-window": "^6.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.1.0",
|
||||
"@docusaurus/module-type-aliases": "2.2.0",
|
||||
"fs-extra": "^10.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-sitemap",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Simple sitemap generation plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,12 +18,12 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.1.0",
|
||||
"@docusaurus/logger": "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/types": "2.2.0",
|
||||
"@docusaurus/utils": "2.2.0",
|
||||
"@docusaurus/utils-common": "2.2.0",
|
||||
"@docusaurus/utils-validation": "2.2.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"sitemap": "^7.1.1",
|
||||
"tslib": "^2.4.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/preset-classic",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Classic preset for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,18 +18,18 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "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/plugin-debug": "2.1.0",
|
||||
"@docusaurus/plugin-google-analytics": "2.1.0",
|
||||
"@docusaurus/plugin-google-gtag": "2.1.0",
|
||||
"@docusaurus/plugin-sitemap": "2.1.0",
|
||||
"@docusaurus/theme-classic": "2.1.0",
|
||||
"@docusaurus/theme-common": "2.1.0",
|
||||
"@docusaurus/theme-search-algolia": "2.1.0",
|
||||
"@docusaurus/types": "2.1.0"
|
||||
"@docusaurus/core": "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/plugin-debug": "2.2.0",
|
||||
"@docusaurus/plugin-google-analytics": "2.2.0",
|
||||
"@docusaurus/plugin-google-gtag": "2.2.0",
|
||||
"@docusaurus/plugin-sitemap": "2.2.0",
|
||||
"@docusaurus/theme-classic": "2.2.0",
|
||||
"@docusaurus/theme-common": "2.2.0",
|
||||
"@docusaurus/theme-search-algolia": "2.2.0",
|
||||
"@docusaurus/types": "2.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/remark-plugin-npm2yarn",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Remark plugin for converting npm commands to Yarn commands as tabs.",
|
||||
"main": "lib/index.js",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-classic",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Classic theme for Docusaurus",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme-classic.d.ts",
|
||||
|
@ -20,18 +20,18 @@
|
|||
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.1.0",
|
||||
"@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/theme-common": "2.1.0",
|
||||
"@docusaurus/theme-translations": "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/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/theme-common": "2.2.0",
|
||||
"@docusaurus/theme-translations": "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",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.2.1",
|
||||
"copy-text-to-clipboard": "^3.0.1",
|
||||
|
|
|
@ -240,6 +240,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|||
description:
|
||||
'The search bar component of your site, appearing in the navbar.',
|
||||
},
|
||||
SkipToContent: {
|
||||
actions: {
|
||||
eject: 'safe',
|
||||
wrap: 'safe',
|
||||
},
|
||||
description:
|
||||
'The component responsible for implementing the accessibility "skip to content" link (https://www.w3.org/TR/WCAG20-TECHS/G1.html)',
|
||||
},
|
||||
'prism-include-languages': {
|
||||
actions: {
|
||||
eject: 'safe',
|
||||
|
|
|
@ -788,6 +788,7 @@ declare module '@theme/MDXComponents' {
|
|||
import type MDXUl from '@theme/MDXComponents/Ul';
|
||||
import type MDXImg from '@theme/MDXComponents/Img';
|
||||
import type Admonition from '@theme/Admonition';
|
||||
import type Mermaid from '@theme/Mermaid';
|
||||
|
||||
export type MDXComponentsObject = {
|
||||
readonly head: typeof MDXHead;
|
||||
|
@ -804,6 +805,7 @@ declare module '@theme/MDXComponents' {
|
|||
readonly h5: (props: ComponentProps<'h5'>) => 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<any>;
|
||||
};
|
||||
|
@ -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';
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -39,11 +39,9 @@ export default function CodeBlockLine({
|
|||
<span className={styles.codeLineContent}>{lineTokens}</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{lineTokens}
|
||||
<br />
|
||||
</>
|
||||
lineTokens
|
||||
)}
|
||||
<br />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
<IconLightMode
|
||||
className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
|
||||
/>
|
||||
|
|
|
@ -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 {
|
|||
<Navbar />
|
||||
|
||||
<div
|
||||
id={SkipToContentFallbackId}
|
||||
className={clsx(
|
||||
ThemeClassNames.wrapper.main,
|
||||
styles.mainWrapper,
|
||||
|
|
|
@ -13,15 +13,35 @@ import type {Props} from '@theme/MDXComponents/Code';
|
|||
export default function MDXCode(props: Props): JSX.Element {
|
||||
const inlineElements: (string | undefined)[] = [
|
||||
'a',
|
||||
'abbr',
|
||||
'b',
|
||||
'big',
|
||||
'i',
|
||||
'span',
|
||||
'br',
|
||||
'button',
|
||||
'cite',
|
||||
'code',
|
||||
'del',
|
||||
'dfn',
|
||||
'em',
|
||||
'strong',
|
||||
'sup',
|
||||
'sub',
|
||||
'i',
|
||||
'img',
|
||||
'input',
|
||||
'ins',
|
||||
'kbd',
|
||||
'label',
|
||||
'object',
|
||||
'output',
|
||||
'q',
|
||||
'ruby',
|
||||
's',
|
||||
'small',
|
||||
'span',
|
||||
'strong',
|
||||
'sub',
|
||||
'sup',
|
||||
'time',
|
||||
'u',
|
||||
'var',
|
||||
'wbr',
|
||||
];
|
||||
const shouldBeInline = React.Children.toArray(props.children).every(
|
||||
(el) =>
|
||||
|
|
|
@ -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) => <MDXHeading as="h5" {...props} />,
|
||||
h6: (props) => <MDXHeading as="h6" {...props} />,
|
||||
admonition: Admonition,
|
||||
mermaid: Mermaid,
|
||||
};
|
||||
|
||||
export default MDXComponents;
|
||||
|
|
16
packages/docusaurus-theme-classic/src/theme/Mermaid.tsx
Normal file
16
packages/docusaurus-theme-classic/src/theme/Mermaid.tsx
Normal file
|
@ -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';
|
|
@ -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 (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={translate({
|
||||
id: 'theme.docs.sidebar.closeSidebarButtonAriaLabel',
|
||||
message: 'Close navigation bar',
|
||||
description: 'The ARIA label for close button of mobile sidebar',
|
||||
})}
|
||||
className="clean-btn navbar-sidebar__close"
|
||||
onClick={() => mobileSidebar.toggle()}>
|
||||
<IconClose color="var(--ifm-color-emphasis-600)" />
|
||||
|
|
|
@ -7,18 +7,23 @@
|
|||
|
||||
import React from 'react';
|
||||
import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
import IconMenu from '@theme/Icon/Menu';
|
||||
|
||||
export default function MobileSidebarToggle(): JSX.Element {
|
||||
const mobileSidebar = useNavbarMobileSidebar();
|
||||
const {toggle, shown} = useNavbarMobileSidebar();
|
||||
return (
|
||||
<button
|
||||
onClick={mobileSidebar.toggle}
|
||||
onKeyDown={mobileSidebar.toggle}
|
||||
aria-label="Navigation bar toggle"
|
||||
onClick={toggle}
|
||||
aria-label={translate({
|
||||
id: 'theme.docs.sidebar.toggleSidebarButtonAriaLabel',
|
||||
message: 'Toggle navigation bar',
|
||||
description:
|
||||
'The ARIA label for hamburger menu button of mobile navigation',
|
||||
})}
|
||||
aria-expanded={shown}
|
||||
className="navbar__toggle clean-btn"
|
||||
type="button"
|
||||
tabIndex={0}>
|
||||
type="button">
|
||||
<IconMenu />
|
||||
</button>
|
||||
);
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 (
|
||||
<div
|
||||
ref={containerRef}
|
||||
role="region"
|
||||
aria-label={translate({id: 'theme.common.skipToMainContent'})}>
|
||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
||||
<a href="#" className={styles.skipToContent} onClick={handleSkip}>
|
||||
<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">
|
||||
Skip to main content
|
||||
</Translate>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
return <SkipToContentLink className={styles.skipToContent} />;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,10 @@ function TabsComponent(props: Props): JSX.Element {
|
|||
}
|
||||
|
||||
const handleTabChange = (
|
||||
event: React.FocusEvent<HTMLLIElement> | React.MouseEvent<HTMLLIElement>,
|
||||
event:
|
||||
| React.FocusEvent<HTMLLIElement>
|
||||
| React.MouseEvent<HTMLLIElement>
|
||||
| React.KeyboardEvent<HTMLLIElement>,
|
||||
) => {
|
||||
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(
|
||||
|
|
|
@ -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%;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<HTMLDivElement>` 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<HTMLDivElement>;
|
||||
/**
|
||||
* Callback fired when the skip to content link has been interacted with. It
|
||||
* will programmatically focus the main content.
|
||||
*/
|
||||
handleSkip: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
||||
} {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const {action} = useHistory();
|
||||
const handleSkip = useCallback((e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
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};
|
||||
}
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
}
|
|
@ -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 <main> 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 <main> 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<HTMLDivElement>;
|
||||
/**
|
||||
* Callback fired when the skip to content link has been clicked.
|
||||
* It will programmatically focus the main content.
|
||||
*/
|
||||
onClick: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
||||
} {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const {action} = useHistory();
|
||||
|
||||
const onClick = useCallback((e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
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<ComponentProps<'a'>, 'href' | 'onClick'>;
|
||||
|
||||
export function SkipToContentLink(props: SkipToContentLinkProps): JSX.Element {
|
||||
const linkLabel = props.children ?? DefaultSkipToContentLabel;
|
||||
const {containerRef, onClick} = useSkipToContent();
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
role="region"
|
||||
aria-label={DefaultSkipToContentLabel}>
|
||||
<a
|
||||
{...props}
|
||||
// Note this is a fallback href in case JS is disabled
|
||||
// It has limitations, see https://github.com/facebook/docusaurus/issues/6411#issuecomment-1284136069
|
||||
href={`#${SkipToContentFallbackId}`}
|
||||
onClick={onClick}>
|
||||
{linkLabel}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -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": {
|
||||
|
|
3
packages/docusaurus-theme-mermaid/.npmignore
Normal file
3
packages/docusaurus-theme-mermaid/.npmignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
21
packages/docusaurus-theme-mermaid/README.md
Normal file
21
packages/docusaurus-theme-mermaid/README.md
Normal file
|
@ -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)
|
57
packages/docusaurus-theme-mermaid/package.json
Normal file
57
packages/docusaurus-theme-mermaid/package.json
Normal file
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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<ThemeConfig>,
|
||||
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,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
78
packages/docusaurus-theme-mermaid/src/client/index.ts
Normal file
78
packages/docusaurus-theme-mermaid/src/client/index.ts
Normal file
|
@ -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]);
|
||||
}
|
23
packages/docusaurus-theme-mermaid/src/index.ts
Normal file
23
packages/docusaurus-theme-mermaid/src/index.ts
Normal file
|
@ -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<void> {
|
||||
return {
|
||||
name: 'docusaurus-theme-mermaid',
|
||||
|
||||
getThemePath() {
|
||||
return '../lib/theme';
|
||||
},
|
||||
getTypeScriptThemePath() {
|
||||
return '../src/theme';
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export {validateThemeConfig} from './validateThemeConfig';
|
35
packages/docusaurus-theme-mermaid/src/theme-mermaid.d.ts
vendored
Normal file
35
packages/docusaurus-theme-mermaid/src/theme-mermaid.d.ts
vendored
Normal file
|
@ -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.
|
||||
*/
|
||||
|
||||
/// <reference types="@docusaurus/module-type-aliases" />
|
||||
|
||||
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<ThemeConfig>;
|
||||
|
||||
export default function themeMermaid(): Plugin<undefined>;
|
||||
}
|
||||
|
||||
declare module '@theme/Mermaid' {
|
||||
export interface Props {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export default function Mermaid(props: Props): JSX.Element;
|
||||
}
|
|
@ -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 (
|
||||
<div
|
||||
className={`${MermaidContainerClassName} ${styles.container}`}
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{__html: svg}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Mermaid(props: Props): JSX.Element {
|
||||
return <BrowserOnly>{() => <MermaidDiagram {...props} />}</BrowserOnly>;
|
||||
}
|
|
@ -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%;
|
||||
}
|
38
packages/docusaurus-theme-mermaid/src/validateThemeConfig.ts
Normal file
38
packages/docusaurus-theme-mermaid/src/validateThemeConfig.ts
Normal file
|
@ -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<ThemeConfig>({
|
||||
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>): ThemeConfig {
|
||||
return validate(Schema, themeConfig);
|
||||
}
|
15
packages/docusaurus-theme-mermaid/tsconfig.client.json
Normal file
15
packages/docusaurus-theme-mermaid/tsconfig.client.json
Normal file
|
@ -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__/**"]
|
||||
}
|
14
packages/docusaurus-theme-mermaid/tsconfig.json
Normal file
14
packages/docusaurus-theme-mermaid/tsconfig.json
Normal file
|
@ -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__/**"]
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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": "オフライン中は画像は読み込まれません"
|
||||
}
|
||||
|
|
|
@ -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": "タグ"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"theme.Playground.liveEditor": "Live Editor",
|
||||
"theme.Playground.result": "Result"
|
||||
"theme.Playground.liveEditor": "ライブエディター",
|
||||
"theme.Playground.result": "結果"
|
||||
}
|
||||
|
|
|
@ -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": "検索結果が見つかりませんでした"
|
||||
}
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue