Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e302df6
fix(theme): preserve url ?search#hash on navbar version/locale dropdo…
slorber Sep 7, 2022
42ba857
fix(theme): preserve line breaks when copying code with showLineNumbe…
Sep 8, 2022
00b2d6c
fix(redirect): tolerate trailing slash difference if config is undefi…
Josh-Cena Sep 8, 2022
c7301f5
fix(core): normalize slashes for url/baseUrl instead of throwing (#8066)
Josh-Cena Sep 8, 2022
d0feba0
refactor(theme): remove hard-coded tag border-radius (#8062)
homotechsual Sep 8, 2022
1163514
chore(plugin-docs): expose all lib files through exports (#7962)
JPeer264 Aug 18, 2022
f387099
fix(theme-translations): remove extra vi translations (#8087)
namnguyenthanhwork Sep 12, 2022
5e072f0
perf(create): run async tasks concurrently (#8080)
sanjaiyan-dev Sep 11, 2022
9063488
feat(core): prefetch on mobile touchstart (#8109)
sanjaiyan-dev Sep 28, 2022
55c0abc
fix(theme-translations): complete turkish theme default translations …
ramazansancar Sep 28, 2022
08b4caa
fix(theme): do not show tab content when tabbing over it; show after …
mturoci Oct 5, 2022
64601a9
fix(theme): mobile navbar & skipToContent should cover announcementBa…
adnanhashmi09 Oct 6, 2022
6d405a6
fix(content-blog): make RSS feed generation work with slugs with .htm…
Pranav2612000 Oct 6, 2022
da01da1
fix(core): throw error for invalid URL in config file (#8159)
forgeRW Oct 2, 2022
086906d
fix(theme-translation): complete Japanese theme default translation (…
pasora Sep 29, 2022
824a0f3
fix(utils): remove non-ASCII limitation for path normalization (#8137)
birjj Oct 7, 2022
38e65f4
feat(core): siteConfig.headTags API to render extra tags in document …
johnnyreilly Oct 12, 2022
d1bf80e
fix(theme): add more tag names to inline element set (#8190)
Josh-Cena Oct 12, 2022
6f5e669
fix(theme): announce theme switches when using screen reader. #7667 (…
mturoci Oct 5, 2022
a990a5e
fix(core): throw error for invalid URL in config file (#8192)
forgeRW Oct 13, 2022
433f08b
feat: support mermaid code blocks in Markdown (#7490)
sjwall Oct 14, 2022
e5fb257
fix(theme-classic): fix SkipToContent without JS , refactor, make it …
mturoci Oct 19, 2022
a9b622b
fix(theme-classic): hamburger menu control navigation by keyboard (#8…
jeferson-sb Oct 19, 2022
7dd225a
feat(core): add --config param to swizzle command (#8210)
e-im Oct 20, 2022
324440a
feat(plugin-client-redirects): keep the query string + hash (#8227)
xlahuerta Oct 20, 2022
828d711
chore: fix tree-node-cli license (#8248)
slorber Oct 26, 2022
51ba455
chore(theme-translations): complete French translations (#8243)
forresst Oct 26, 2022
2fb7cff
fix(plugin-content-docs): fix error message context (error cause) whe…
shanpriyan Oct 26, 2022
31c9920
fix(mdx-loader): properly unwrap mdxAdmonitionTitle placeholder (#8246)
Josh-Cena Oct 26, 2022
4c964c6
fix(ideal-image): do not pass down `img` prop (#8250)
lex111 Oct 26, 2022
a5c11f7
chore(theme-translations): complete ru translations (#8253)
lex111 Oct 27, 2022
3deaceb
fix litte issues after cherry pick
slorber Oct 28, 2022
0d15422
revert too aggressive yarn.lock upgrade
slorber Oct 28, 2022
a308fb7
v2.2.0
slorber Oct 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/new.docusaurus.io/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.0",
"version": "2.2.0",
"npmClient": "yarn",
"useWorkspaces": true,
"changelog": {
Expand Down
6 changes: 3 additions & 3 deletions packages/create-docusaurus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-docusaurus",
"version": "2.1.0",
"version": "2.2.0",
"description": "Create Docusaurus apps easily.",
"type": "module",
"repository": {
Expand All @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions packages/create-docusaurus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-typescript-template",
"version": "2.1.0",
"version": "2.2.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand All @@ -15,16 +15,16 @@
"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",
"react": "^17.0.2",
"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"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/create-docusaurus/templates/classic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-2-classic-template",
"version": "2.1.0",
"version": "2.2.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand All @@ -14,16 +14,16 @@
"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",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.1.0"
"@docusaurus/module-type-aliases": "2.2.0"
},
"browserslist": {
"production": [
Expand Down
6 changes: 3 additions & 3 deletions packages/create-docusaurus/templates/facebook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-2-facebook-template",
"version": "2.1.0",
"version": "2.2.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-cssnano-preset/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-logger/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 5 additions & 4 deletions packages/docusaurus-mdx-loader/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus-mdx-loader/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -61,6 +63,7 @@ export type MDXOptions = {
};

export type Options = Partial<MDXOptions> & {
markdownConfig: MarkdownConfig;
staticDirs: string[];
siteDir: string;
isMDXPartial?: (filePath: string) => boolean;
Expand All @@ -71,7 +74,6 @@ export type Options = Partial<MDXOptions> & {
frontMatter: {[key: string]: unknown};
metadata: {[key: string]: unknown};
}) => {[key: string]: unknown};
filepath: string;
};

/**
Expand Down Expand Up @@ -171,6 +173,7 @@ export async function mdxLoader(
...(reqOptions.beforeDefaultRemarkPlugins ?? []),
...getAdmonitionsPlugins(reqOptions.admonitions ?? false),
...DEFAULT_OPTIONS.remarkPlugins,
...(reqOptions.markdownConfig.mermaid ? [mermaid] : []),
[
transformImage,
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;"
`;
Original file line number Diff line number Diff line change
@@ -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 changes: 32 additions & 0 deletions packages/docusaurus-mdx-loader/src/remark/mermaid/index.ts
Original file line number Diff line number Diff line change
@@ -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,
},
},
});
}
});
};
}
6 changes: 3 additions & 3 deletions packages/docusaurus-migrate/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-module-type-aliases/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": "*",
Expand Down
Loading