@docusaurus/theme-classic 4.0.0-canary-6952 → 4.0.0-canary-6958
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getSwizzleConfig.js +1 -1
- package/lib/options.js +0 -31
- package/lib/theme/Blog/Pages/BlogAuthorsListPage/index.js +1 -1
- package/lib/theme/Blog/Pages/BlogAuthorsPostsPage/index.js +3 -3
- package/lib/theme/BlogTagsPostsPage/index.js +1 -1
- package/lib/theme/CodeBlock/Content/styles.module.css +0 -4
- package/lib/theme/CodeBlock/{Content/Element.d.ts → Element/index.d.ts} +2 -2
- package/lib/theme/CodeBlock/{Content/Element.js → Element/index.js} +1 -2
- package/lib/theme/CodeBlock/Element/styles.module.css +24 -0
- package/lib/theme/CodeBlock/{Content/String.d.ts → String/index.d.ts} +1 -1
- package/lib/theme/CodeBlock/{Content/String.js → String/index.js} +0 -1
- package/lib/theme/CodeBlock/index.js +3 -3
- package/lib/theme/DocCard/index.js +2 -4
- package/package.json +13 -13
- package/src/getSwizzleConfig.ts +1 -1
- package/src/options.ts +0 -38
- package/src/theme/Blog/Pages/BlogAuthorsListPage/index.tsx +1 -1
- package/src/theme/Blog/Pages/BlogAuthorsPostsPage/index.tsx +3 -3
- package/src/theme/BlogTagsPostsPage/index.tsx +1 -1
- package/src/theme/CodeBlock/Content/styles.module.css +0 -4
- package/src/theme/CodeBlock/{Content/Element.tsx → Element/index.tsx} +5 -3
- package/src/theme/CodeBlock/Element/styles.module.css +24 -0
- package/src/theme/CodeBlock/{Content/String.tsx → String/index.tsx} +1 -2
- package/src/theme/CodeBlock/index.tsx +3 -3
- package/src/theme/DocCard/index.tsx +2 -4
- package/src/theme-classic.d.ts +4 -4
package/lib/getSwizzleConfig.js
CHANGED
|
@@ -143,7 +143,7 @@ function getSwizzleConfig() {
|
|
|
143
143
|
eject: 'unsafe',
|
|
144
144
|
wrap: 'unsafe',
|
|
145
145
|
},
|
|
146
|
-
description: 'The
|
|
146
|
+
description: 'The component responsible for rendering the syntax-highlighted code lines of a CodeBlock.',
|
|
147
147
|
},
|
|
148
148
|
ColorModeToggle: {
|
|
149
149
|
actions: {
|
package/lib/options.js
CHANGED
|
@@ -260,9 +260,6 @@ const ColorModeSchema = utils_validation_1.Joi.object({
|
|
|
260
260
|
.default(DEFAULT_COLOR_MODE_CONFIG.defaultMode),
|
|
261
261
|
disableSwitch: utils_validation_1.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.disableSwitch),
|
|
262
262
|
respectPrefersColorScheme: utils_validation_1.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme),
|
|
263
|
-
switchConfig: utils_validation_1.Joi.any().forbidden().messages({
|
|
264
|
-
'any.unknown': 'colorMode.switchConfig is deprecated. If you want to customize the icons for light and dark mode, swizzle IconLightMode, IconDarkMode, or ColorModeToggle instead.',
|
|
265
|
-
}),
|
|
266
263
|
}).default(DEFAULT_COLOR_MODE_CONFIG);
|
|
267
264
|
const HtmlMetadataSchema = utils_validation_1.Joi.object({
|
|
268
265
|
id: utils_validation_1.Joi.string(),
|
|
@@ -305,15 +302,6 @@ const LogoSchema = utils_validation_1.Joi.object({
|
|
|
305
302
|
// See https://github.com/facebook/docusaurus/issues/9012
|
|
306
303
|
const PrismLanguage = utils_validation_1.Joi.string().custom((val) => val.toLowerCase());
|
|
307
304
|
exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
308
|
-
// TODO temporary (@alpha-58)
|
|
309
|
-
// @ts-expect-error: forbidden
|
|
310
|
-
disableDarkMode: utils_validation_1.Joi.any().forbidden().messages({
|
|
311
|
-
'any.unknown': 'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',
|
|
312
|
-
}),
|
|
313
|
-
// TODO temporary (@alpha-58)
|
|
314
|
-
defaultDarkMode: utils_validation_1.Joi.any().forbidden().messages({
|
|
315
|
-
'any.unknown': 'defaultDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.defaultMode = "dark"',
|
|
316
|
-
}),
|
|
317
305
|
colorMode: ColorModeSchema,
|
|
318
306
|
image: utils_validation_1.Joi.string(),
|
|
319
307
|
docs: DocsSchema,
|
|
@@ -321,12 +309,6 @@ exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
|
321
309
|
metadata: utils_validation_1.Joi.array()
|
|
322
310
|
.items(HtmlMetadataSchema)
|
|
323
311
|
.default(exports.DEFAULT_CONFIG.metadata),
|
|
324
|
-
// cSpell:ignore metadatas
|
|
325
|
-
metadatas: utils_validation_1.Joi.any().forbidden().messages({
|
|
326
|
-
'any.unknown':
|
|
327
|
-
// cSpell:ignore metadatas
|
|
328
|
-
'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871',
|
|
329
|
-
}),
|
|
330
312
|
announcementBar: utils_validation_1.Joi.object({
|
|
331
313
|
id: utils_validation_1.Joi.string().default('announcement-bar'),
|
|
332
314
|
content: utils_validation_1.Joi.string().required(),
|
|
@@ -337,10 +319,6 @@ exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
|
337
319
|
navbar: utils_validation_1.Joi.object({
|
|
338
320
|
style: utils_validation_1.Joi.string().equal('dark', 'primary'),
|
|
339
321
|
hideOnScroll: utils_validation_1.Joi.bool().default(exports.DEFAULT_CONFIG.navbar.hideOnScroll),
|
|
340
|
-
// TODO temporary (@alpha-58)
|
|
341
|
-
links: utils_validation_1.Joi.any().forbidden().messages({
|
|
342
|
-
'any.unknown': 'themeConfig.navbar.links has been renamed as themeConfig.navbar.items',
|
|
343
|
-
}),
|
|
344
322
|
items: utils_validation_1.Joi.array()
|
|
345
323
|
.items(NavbarItemSchema)
|
|
346
324
|
.default(exports.DEFAULT_CONFIG.navbar.items),
|
|
@@ -383,15 +361,6 @@ exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
|
383
361
|
})
|
|
384
362
|
.default(exports.DEFAULT_CONFIG.prism)
|
|
385
363
|
.unknown(),
|
|
386
|
-
hideableSidebar: utils_validation_1.Joi.forbidden().messages({
|
|
387
|
-
'any.unknown': 'themeConfig.hideableSidebar has been moved to themeConfig.docs.sidebar.hideable.',
|
|
388
|
-
}),
|
|
389
|
-
autoCollapseSidebarCategories: utils_validation_1.Joi.forbidden().messages({
|
|
390
|
-
'any.unknown': 'themeConfig.autoCollapseSidebarCategories has been moved to themeConfig.docs.sidebar.autoCollapseCategories.',
|
|
391
|
-
}),
|
|
392
|
-
sidebarCollapsible: utils_validation_1.Joi.forbidden().messages({
|
|
393
|
-
'any.unknown': 'The themeConfig.sidebarCollapsible has been moved to docs plugin options. See: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs',
|
|
394
|
-
}),
|
|
395
364
|
tableOfContents: utils_validation_1.Joi.object({
|
|
396
365
|
minHeadingLevel: utils_validation_1.Joi.number()
|
|
397
366
|
.default(exports.DEFAULT_CONFIG.tableOfContents.minHeadingLevel)
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
HtmlClassNameProvider,
|
|
11
11
|
ThemeClassNames,
|
|
12
12
|
} from '@docusaurus/theme-common';
|
|
13
|
-
import {translateBlogAuthorsListPageTitle} from '@docusaurus/
|
|
13
|
+
import {translateBlogAuthorsListPageTitle} from '@docusaurus/plugin-content-blog/client';
|
|
14
14
|
import BlogLayout from '@theme/BlogLayout';
|
|
15
15
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
16
16
|
import Heading from '@theme/Heading';
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
HtmlClassNameProvider,
|
|
11
11
|
ThemeClassNames,
|
|
12
12
|
} from '@docusaurus/theme-common';
|
|
13
|
+
import Link from '@docusaurus/Link';
|
|
13
14
|
import {
|
|
15
|
+
useBlogMetadata,
|
|
14
16
|
useBlogAuthorPageTitle,
|
|
15
17
|
BlogAuthorsListViewAllLabel,
|
|
16
18
|
BlogAuthorNoPostsLabel,
|
|
17
|
-
} from '@docusaurus/
|
|
18
|
-
import Link from '@docusaurus/Link';
|
|
19
|
-
import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
|
|
19
|
+
} from '@docusaurus/plugin-content-blog/client';
|
|
20
20
|
import BlogLayout from '@theme/BlogLayout';
|
|
21
21
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
22
22
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
TagsPageLinkLabel,
|
|
12
12
|
ThemeClassNames,
|
|
13
13
|
} from '@docusaurus/theme-common';
|
|
14
|
-
import {useBlogTagsPostsPageTitle} from '@docusaurus/
|
|
14
|
+
import {useBlogTagsPostsPageTitle} from '@docusaurus/plugin-content-blog/client';
|
|
15
15
|
import Link from '@docusaurus/Link';
|
|
16
16
|
import BlogLayout from '@theme/BlogLayout';
|
|
17
17
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { ReactNode } from 'react';
|
|
8
|
-
import type { Props } from '@theme/CodeBlock/
|
|
9
|
-
export default function
|
|
8
|
+
import type { Props } from '@theme/CodeBlock/Element';
|
|
9
|
+
export default function CodeBlockElement({ children, className, }: Props): ReactNode;
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import Container from '@theme/CodeBlock/Container';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
|
-
// TODO Docusaurus v4: move this component at the root?
|
|
11
10
|
// This component only handles a rare edge-case: <pre><MyComp/></pre> in MDX
|
|
12
11
|
// <pre> tags in markdown map to CodeBlocks. They may contain JSX children.
|
|
13
12
|
// When children is not a simple string, we just return a styled block without
|
|
14
13
|
// actually highlighting.
|
|
15
|
-
export default function
|
|
14
|
+
export default function CodeBlockElement({children, className}) {
|
|
16
15
|
return (
|
|
17
16
|
<Container
|
|
18
17
|
as="pre"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.codeBlockStandalone {
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.codeBlockLines {
|
|
13
|
+
font: inherit;
|
|
14
|
+
/* rtl:ignore */
|
|
15
|
+
float: left;
|
|
16
|
+
min-width: 100%;
|
|
17
|
+
padding: var(--ifm-pre-padding);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media print {
|
|
21
|
+
.codeBlockLines {
|
|
22
|
+
white-space: pre-wrap;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { ReactNode } from 'react';
|
|
8
|
-
import type { Props } from '@theme/CodeBlock/
|
|
8
|
+
import type { Props } from '@theme/CodeBlock/String';
|
|
9
9
|
export default function CodeBlockString(props: Props): ReactNode;
|
|
@@ -24,7 +24,6 @@ function useCodeBlockMetadata(props) {
|
|
|
24
24
|
showLineNumbers: props.showLineNumbers,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
// TODO Docusaurus v4: move this component at the root?
|
|
28
27
|
export default function CodeBlockString(props) {
|
|
29
28
|
const metadata = useCodeBlockMetadata(props);
|
|
30
29
|
const wordWrap = useCodeWordWrap();
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {isValidElement} from 'react';
|
|
8
8
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import CodeBlockElement from '@theme/CodeBlock/Element';
|
|
10
|
+
import CodeBlockString from '@theme/CodeBlock/String';
|
|
11
11
|
/**
|
|
12
12
|
* Best attempt to make the children a plain string so it is copyable. If there
|
|
13
13
|
* are react elements, we will not be able to copy the content, and it will
|
|
@@ -29,7 +29,7 @@ export default function CodeBlock({children: rawChildren, ...props}) {
|
|
|
29
29
|
const isBrowser = useIsBrowser();
|
|
30
30
|
const children = maybeStringifyChildren(rawChildren);
|
|
31
31
|
const CodeBlockComp =
|
|
32
|
-
typeof children === 'string' ?
|
|
32
|
+
typeof children === 'string' ? CodeBlockString : CodeBlockElement;
|
|
33
33
|
return (
|
|
34
34
|
<CodeBlockComp key={String(isBrowser)} {...props}>
|
|
35
35
|
{children}
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
import {
|
|
8
8
|
useDocById,
|
|
9
9
|
findFirstSidebarItemLink,
|
|
10
|
-
} from '@docusaurus/plugin-content-docs/client';
|
|
11
|
-
import {
|
|
12
|
-
extractLeadingEmoji,
|
|
13
10
|
useDocCardDescriptionCategoryItemsPlural,
|
|
14
|
-
} from '@docusaurus/
|
|
11
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
12
|
+
import {extractLeadingEmoji} from '@docusaurus/theme-common/internal';
|
|
15
13
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
16
14
|
import Layout from '@theme/DocCard/Layout';
|
|
17
15
|
function getFallbackEmojiIcon(item) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "4.0.0-canary-
|
|
3
|
+
"version": "4.0.0-canary-6958",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@docusaurus/core": "4.0.0-canary-
|
|
18
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
19
|
-
"@docusaurus/module-type-aliases": "4.0.0-canary-
|
|
20
|
-
"@docusaurus/plugin-content-blog": "4.0.0-canary-
|
|
21
|
-
"@docusaurus/plugin-content-docs": "4.0.0-canary-
|
|
22
|
-
"@docusaurus/plugin-content-pages": "4.0.0-canary-
|
|
23
|
-
"@docusaurus/theme-common": "4.0.0-canary-
|
|
24
|
-
"@docusaurus/theme-translations": "4.0.0-canary-
|
|
25
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
26
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
27
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
28
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
17
|
+
"@docusaurus/core": "4.0.0-canary-6958",
|
|
18
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6958",
|
|
19
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-6958",
|
|
20
|
+
"@docusaurus/plugin-content-blog": "4.0.0-canary-6958",
|
|
21
|
+
"@docusaurus/plugin-content-docs": "4.0.0-canary-6958",
|
|
22
|
+
"@docusaurus/plugin-content-pages": "4.0.0-canary-6958",
|
|
23
|
+
"@docusaurus/theme-common": "4.0.0-canary-6958",
|
|
24
|
+
"@docusaurus/theme-translations": "4.0.0-canary-6958",
|
|
25
|
+
"@docusaurus/types": "4.0.0-canary-6958",
|
|
26
|
+
"@docusaurus/utils": "4.0.0-canary-6958",
|
|
27
|
+
"@docusaurus/utils-common": "4.0.0-canary-6958",
|
|
28
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6958",
|
|
29
29
|
"@mdx-js/react": "^3.1.1",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"copy-text-to-clipboard": "^3.2.2",
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -154,7 +154,7 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
154
154
|
wrap: 'unsafe',
|
|
155
155
|
},
|
|
156
156
|
description:
|
|
157
|
-
'The
|
|
157
|
+
'The component responsible for rendering the syntax-highlighted code lines of a CodeBlock.',
|
|
158
158
|
},
|
|
159
159
|
ColorModeToggle: {
|
|
160
160
|
actions: {
|
package/src/options.ts
CHANGED
|
@@ -304,10 +304,6 @@ const ColorModeSchema = Joi.object({
|
|
|
304
304
|
respectPrefersColorScheme: Joi.bool().default(
|
|
305
305
|
DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme,
|
|
306
306
|
),
|
|
307
|
-
switchConfig: Joi.any().forbidden().messages({
|
|
308
|
-
'any.unknown':
|
|
309
|
-
'colorMode.switchConfig is deprecated. If you want to customize the icons for light and dark mode, swizzle IconLightMode, IconDarkMode, or ColorModeToggle instead.',
|
|
310
|
-
}),
|
|
311
307
|
}).default(DEFAULT_COLOR_MODE_CONFIG);
|
|
312
308
|
|
|
313
309
|
const HtmlMetadataSchema = Joi.object({
|
|
@@ -356,17 +352,6 @@ const LogoSchema = Joi.object({
|
|
|
356
352
|
const PrismLanguage = Joi.string().custom((val) => val.toLowerCase());
|
|
357
353
|
|
|
358
354
|
export const ThemeConfigSchema = Joi.object<ThemeConfig>({
|
|
359
|
-
// TODO temporary (@alpha-58)
|
|
360
|
-
// @ts-expect-error: forbidden
|
|
361
|
-
disableDarkMode: Joi.any().forbidden().messages({
|
|
362
|
-
'any.unknown':
|
|
363
|
-
'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',
|
|
364
|
-
}),
|
|
365
|
-
// TODO temporary (@alpha-58)
|
|
366
|
-
defaultDarkMode: Joi.any().forbidden().messages({
|
|
367
|
-
'any.unknown':
|
|
368
|
-
'defaultDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.defaultMode = "dark"',
|
|
369
|
-
}),
|
|
370
355
|
colorMode: ColorModeSchema,
|
|
371
356
|
image: Joi.string(),
|
|
372
357
|
docs: DocsSchema,
|
|
@@ -374,12 +359,6 @@ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
|
|
|
374
359
|
metadata: Joi.array()
|
|
375
360
|
.items(HtmlMetadataSchema)
|
|
376
361
|
.default(DEFAULT_CONFIG.metadata),
|
|
377
|
-
// cSpell:ignore metadatas
|
|
378
|
-
metadatas: Joi.any().forbidden().messages({
|
|
379
|
-
'any.unknown':
|
|
380
|
-
// cSpell:ignore metadatas
|
|
381
|
-
'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871',
|
|
382
|
-
}),
|
|
383
362
|
announcementBar: Joi.object({
|
|
384
363
|
id: Joi.string().default('announcement-bar'),
|
|
385
364
|
content: Joi.string().required(),
|
|
@@ -390,11 +369,6 @@ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
|
|
|
390
369
|
navbar: Joi.object({
|
|
391
370
|
style: Joi.string().equal('dark', 'primary'),
|
|
392
371
|
hideOnScroll: Joi.bool().default(DEFAULT_CONFIG.navbar.hideOnScroll),
|
|
393
|
-
// TODO temporary (@alpha-58)
|
|
394
|
-
links: Joi.any().forbidden().messages({
|
|
395
|
-
'any.unknown':
|
|
396
|
-
'themeConfig.navbar.links has been renamed as themeConfig.navbar.items',
|
|
397
|
-
}),
|
|
398
372
|
items: Joi.array()
|
|
399
373
|
.items(NavbarItemSchema)
|
|
400
374
|
.default(DEFAULT_CONFIG.navbar.items),
|
|
@@ -442,18 +416,6 @@ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
|
|
|
442
416
|
})
|
|
443
417
|
.default(DEFAULT_CONFIG.prism)
|
|
444
418
|
.unknown(),
|
|
445
|
-
hideableSidebar: Joi.forbidden().messages({
|
|
446
|
-
'any.unknown':
|
|
447
|
-
'themeConfig.hideableSidebar has been moved to themeConfig.docs.sidebar.hideable.',
|
|
448
|
-
}),
|
|
449
|
-
autoCollapseSidebarCategories: Joi.forbidden().messages({
|
|
450
|
-
'any.unknown':
|
|
451
|
-
'themeConfig.autoCollapseSidebarCategories has been moved to themeConfig.docs.sidebar.autoCollapseCategories.',
|
|
452
|
-
}),
|
|
453
|
-
sidebarCollapsible: Joi.forbidden().messages({
|
|
454
|
-
'any.unknown':
|
|
455
|
-
'The themeConfig.sidebarCollapsible has been moved to docs plugin options. See: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs',
|
|
456
|
-
}),
|
|
457
419
|
tableOfContents: Joi.object({
|
|
458
420
|
minHeadingLevel: Joi.number()
|
|
459
421
|
.default(DEFAULT_CONFIG.tableOfContents.minHeadingLevel)
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
HtmlClassNameProvider,
|
|
13
13
|
ThemeClassNames,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
|
-
import {translateBlogAuthorsListPageTitle} from '@docusaurus/
|
|
15
|
+
import {translateBlogAuthorsListPageTitle} from '@docusaurus/plugin-content-blog/client';
|
|
16
16
|
import BlogLayout from '@theme/BlogLayout';
|
|
17
17
|
import type {Props} from '@theme/Blog/Pages/BlogAuthorsListPage';
|
|
18
18
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
HtmlClassNameProvider,
|
|
13
13
|
ThemeClassNames,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
|
+
import Link from '@docusaurus/Link';
|
|
15
16
|
import {
|
|
17
|
+
useBlogMetadata,
|
|
16
18
|
useBlogAuthorPageTitle,
|
|
17
19
|
BlogAuthorsListViewAllLabel,
|
|
18
20
|
BlogAuthorNoPostsLabel,
|
|
19
|
-
} from '@docusaurus/
|
|
20
|
-
import Link from '@docusaurus/Link';
|
|
21
|
-
import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
|
|
21
|
+
} from '@docusaurus/plugin-content-blog/client';
|
|
22
22
|
import BlogLayout from '@theme/BlogLayout';
|
|
23
23
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
24
24
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
TagsPageLinkLabel,
|
|
14
14
|
ThemeClassNames,
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
|
-
import {useBlogTagsPostsPageTitle} from '@docusaurus/
|
|
16
|
+
import {useBlogTagsPostsPageTitle} from '@docusaurus/plugin-content-blog/client';
|
|
17
17
|
import Link from '@docusaurus/Link';
|
|
18
18
|
import BlogLayout from '@theme/BlogLayout';
|
|
19
19
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
@@ -8,16 +8,18 @@
|
|
|
8
8
|
import type {ReactNode} from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import Container from '@theme/CodeBlock/Container';
|
|
11
|
-
import type {Props} from '@theme/CodeBlock/
|
|
11
|
+
import type {Props} from '@theme/CodeBlock/Element';
|
|
12
12
|
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
|
|
15
|
-
// TODO Docusaurus v4: move this component at the root?
|
|
16
15
|
// This component only handles a rare edge-case: <pre><MyComp/></pre> in MDX
|
|
17
16
|
// <pre> tags in markdown map to CodeBlocks. They may contain JSX children.
|
|
18
17
|
// When children is not a simple string, we just return a styled block without
|
|
19
18
|
// actually highlighting.
|
|
20
|
-
export default function
|
|
19
|
+
export default function CodeBlockElement({
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
}: Props): ReactNode {
|
|
21
23
|
return (
|
|
22
24
|
<Container
|
|
23
25
|
as="pre"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.codeBlockStandalone {
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.codeBlockLines {
|
|
13
|
+
font: inherit;
|
|
14
|
+
/* rtl:ignore */
|
|
15
|
+
float: left;
|
|
16
|
+
min-width: 100%;
|
|
17
|
+
padding: var(--ifm-pre-padding);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media print {
|
|
21
|
+
.codeBlockLines {
|
|
22
|
+
white-space: pre-wrap;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createCodeBlockMetadata,
|
|
14
14
|
useCodeWordWrap,
|
|
15
15
|
} from '@docusaurus/theme-common/internal';
|
|
16
|
-
import type {Props} from '@theme/CodeBlock/
|
|
16
|
+
import type {Props} from '@theme/CodeBlock/String';
|
|
17
17
|
import CodeBlockLayout from '@theme/CodeBlock/Layout';
|
|
18
18
|
|
|
19
19
|
function useCodeBlockMetadata(props: Props): CodeBlockMetadata {
|
|
@@ -30,7 +30,6 @@ function useCodeBlockMetadata(props: Props): CodeBlockMetadata {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// TODO Docusaurus v4: move this component at the root?
|
|
34
33
|
export default function CodeBlockString(props: Props): ReactNode {
|
|
35
34
|
const metadata = useCodeBlockMetadata(props);
|
|
36
35
|
const wordWrap = useCodeWordWrap();
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import React, {isValidElement, type ReactNode} from 'react';
|
|
9
9
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import CodeBlockElement from '@theme/CodeBlock/Element';
|
|
11
|
+
import CodeBlockString from '@theme/CodeBlock/String';
|
|
12
12
|
import type {Props} from '@theme/CodeBlock';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -36,7 +36,7 @@ export default function CodeBlock({
|
|
|
36
36
|
const isBrowser = useIsBrowser();
|
|
37
37
|
const children = maybeStringifyChildren(rawChildren);
|
|
38
38
|
const CodeBlockComp =
|
|
39
|
-
typeof children === 'string' ?
|
|
39
|
+
typeof children === 'string' ? CodeBlockString : CodeBlockElement;
|
|
40
40
|
return (
|
|
41
41
|
<CodeBlockComp key={String(isBrowser)} {...props}>
|
|
42
42
|
{children as string}
|
|
@@ -9,11 +9,9 @@ import type {ReactNode} from 'react';
|
|
|
9
9
|
import {
|
|
10
10
|
useDocById,
|
|
11
11
|
findFirstSidebarItemLink,
|
|
12
|
-
} from '@docusaurus/plugin-content-docs/client';
|
|
13
|
-
import {
|
|
14
|
-
extractLeadingEmoji,
|
|
15
12
|
useDocCardDescriptionCategoryItemsPlural,
|
|
16
|
-
} from '@docusaurus/
|
|
13
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
14
|
+
import {extractLeadingEmoji} from '@docusaurus/theme-common/internal';
|
|
17
15
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
18
16
|
import Layout from '@theme/DocCard/Layout';
|
|
19
17
|
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -507,16 +507,16 @@ declare module '@theme/CodeBlock/Content' {
|
|
|
507
507
|
export default function CodeBlockContent(props: Props): ReactNode;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
declare module '@theme/CodeBlock/
|
|
510
|
+
declare module '@theme/CodeBlock/Element' {
|
|
511
511
|
import type {ReactNode} from 'react';
|
|
512
512
|
import type {Props} from '@theme/CodeBlock';
|
|
513
513
|
|
|
514
514
|
export type {Props};
|
|
515
515
|
|
|
516
|
-
export default function
|
|
516
|
+
export default function CodeBlockElement(props: Props): ReactNode;
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
declare module '@theme/CodeBlock/
|
|
519
|
+
declare module '@theme/CodeBlock/String' {
|
|
520
520
|
import type {ReactNode} from 'react';
|
|
521
521
|
import type {Props as CodeBlockProps} from '@theme/CodeBlock';
|
|
522
522
|
|
|
@@ -524,7 +524,7 @@ declare module '@theme/CodeBlock/Content/String' {
|
|
|
524
524
|
readonly children: string;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
export default function
|
|
527
|
+
export default function CodeBlockString(props: Props): ReactNode;
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
declare module '@theme/CodeBlock/Line' {
|