@docusaurus/theme-classic 3.7.0-canary-6197 → 3.7.0-canary-6200
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.
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
parseCodeBlockTitle,
|
|
12
12
|
parseLanguage,
|
|
13
13
|
parseLines,
|
|
14
|
-
|
|
14
|
+
getLineNumbersStart,
|
|
15
15
|
useCodeWordWrap,
|
|
16
16
|
} from '@docusaurus/theme-common/internal';
|
|
17
17
|
import {Highlight} from 'prism-react-renderer';
|
|
@@ -51,8 +51,10 @@ export default function CodeBlockString({
|
|
|
51
51
|
language,
|
|
52
52
|
magicComments,
|
|
53
53
|
});
|
|
54
|
-
const
|
|
55
|
-
showLineNumbersProp
|
|
54
|
+
const lineNumbersStart = getLineNumbersStart({
|
|
55
|
+
showLineNumbers: showLineNumbersProp,
|
|
56
|
+
metastring,
|
|
57
|
+
});
|
|
56
58
|
return (
|
|
57
59
|
<Container
|
|
58
60
|
as="div"
|
|
@@ -75,8 +77,14 @@ export default function CodeBlockString({
|
|
|
75
77
|
<code
|
|
76
78
|
className={clsx(
|
|
77
79
|
styles.codeBlockLines,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
lineNumbersStart !== undefined &&
|
|
81
|
+
styles.codeBlockLinesWithNumbering,
|
|
82
|
+
)}
|
|
83
|
+
style={
|
|
84
|
+
lineNumbersStart === undefined
|
|
85
|
+
? undefined
|
|
86
|
+
: {counterReset: `line-count ${lineNumbersStart - 1}`}
|
|
87
|
+
}>
|
|
80
88
|
{tokens.map((line, i) => (
|
|
81
89
|
<Line
|
|
82
90
|
key={i}
|
|
@@ -84,7 +92,7 @@ export default function CodeBlockString({
|
|
|
84
92
|
getLineProps={getLineProps}
|
|
85
93
|
getTokenProps={getTokenProps}
|
|
86
94
|
classNames={lineClassNames[i]}
|
|
87
|
-
showLineNumbers={
|
|
95
|
+
showLineNumbers={lineNumbersStart !== undefined}
|
|
88
96
|
/>
|
|
89
97
|
))}
|
|
90
98
|
</code>
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
useCurrentSidebarSiblings,
|
|
11
11
|
filterDocCardListItems,
|
|
12
12
|
} from '@docusaurus/plugin-content-docs/client';
|
|
13
13
|
import DocCard from '@theme/DocCard';
|
|
14
14
|
function DocCardListForCurrentSidebarCategory({className}) {
|
|
15
|
-
const
|
|
16
|
-
return <DocCardList items={
|
|
15
|
+
const items = useCurrentSidebarSiblings();
|
|
16
|
+
return <DocCardList items={items} className={className} />;
|
|
17
17
|
}
|
|
18
18
|
export default function DocCardList(props) {
|
|
19
19
|
const {items, className} = props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "3.7.0-canary-
|
|
3
|
+
"version": "3.7.0-canary-6200",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "3.7.0-canary-
|
|
24
|
-
"@docusaurus/logger": "3.7.0-canary-
|
|
25
|
-
"@docusaurus/mdx-loader": "3.7.0-canary-
|
|
26
|
-
"@docusaurus/module-type-aliases": "3.7.0-canary-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "3.7.0-canary-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "3.7.0-canary-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "3.7.0-canary-
|
|
30
|
-
"@docusaurus/theme-common": "3.7.0-canary-
|
|
31
|
-
"@docusaurus/theme-translations": "3.7.0-canary-
|
|
32
|
-
"@docusaurus/types": "3.7.0-canary-
|
|
33
|
-
"@docusaurus/utils": "3.7.0-canary-
|
|
34
|
-
"@docusaurus/utils-common": "3.7.0-canary-
|
|
35
|
-
"@docusaurus/utils-validation": "3.7.0-canary-
|
|
23
|
+
"@docusaurus/core": "3.7.0-canary-6200",
|
|
24
|
+
"@docusaurus/logger": "3.7.0-canary-6200",
|
|
25
|
+
"@docusaurus/mdx-loader": "3.7.0-canary-6200",
|
|
26
|
+
"@docusaurus/module-type-aliases": "3.7.0-canary-6200",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "3.7.0-canary-6200",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "3.7.0-canary-6200",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "3.7.0-canary-6200",
|
|
30
|
+
"@docusaurus/theme-common": "3.7.0-canary-6200",
|
|
31
|
+
"@docusaurus/theme-translations": "3.7.0-canary-6200",
|
|
32
|
+
"@docusaurus/types": "3.7.0-canary-6200",
|
|
33
|
+
"@docusaurus/utils": "3.7.0-canary-6200",
|
|
34
|
+
"@docusaurus/utils-common": "3.7.0-canary-6200",
|
|
35
|
+
"@docusaurus/utils-validation": "3.7.0-canary-6200",
|
|
36
36
|
"@mdx-js/react": "^3.0.0",
|
|
37
37
|
"clsx": "^2.0.0",
|
|
38
38
|
"copy-text-to-clipboard": "^3.2.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=18.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "0fcaaf4f7747ba0367cf5474089365fd0ec0455f"
|
|
66
66
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
parseCodeBlockTitle,
|
|
13
13
|
parseLanguage,
|
|
14
14
|
parseLines,
|
|
15
|
-
|
|
15
|
+
getLineNumbersStart,
|
|
16
16
|
useCodeWordWrap,
|
|
17
17
|
} from '@docusaurus/theme-common/internal';
|
|
18
18
|
import {Highlight, type Language} from 'prism-react-renderer';
|
|
@@ -59,8 +59,10 @@ export default function CodeBlockString({
|
|
|
59
59
|
language,
|
|
60
60
|
magicComments,
|
|
61
61
|
});
|
|
62
|
-
const
|
|
63
|
-
showLineNumbersProp
|
|
62
|
+
const lineNumbersStart = getLineNumbersStart({
|
|
63
|
+
showLineNumbers: showLineNumbersProp,
|
|
64
|
+
metastring,
|
|
65
|
+
});
|
|
64
66
|
|
|
65
67
|
return (
|
|
66
68
|
<Container
|
|
@@ -87,8 +89,14 @@ export default function CodeBlockString({
|
|
|
87
89
|
<code
|
|
88
90
|
className={clsx(
|
|
89
91
|
styles.codeBlockLines,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
lineNumbersStart !== undefined &&
|
|
93
|
+
styles.codeBlockLinesWithNumbering,
|
|
94
|
+
)}
|
|
95
|
+
style={
|
|
96
|
+
lineNumbersStart === undefined
|
|
97
|
+
? undefined
|
|
98
|
+
: {counterReset: `line-count ${lineNumbersStart - 1}`}
|
|
99
|
+
}>
|
|
92
100
|
{tokens.map((line, i) => (
|
|
93
101
|
<Line
|
|
94
102
|
key={i}
|
|
@@ -96,7 +104,7 @@ export default function CodeBlockString({
|
|
|
96
104
|
getLineProps={getLineProps}
|
|
97
105
|
getTokenProps={getTokenProps}
|
|
98
106
|
classNames={lineClassNames[i]}
|
|
99
|
-
showLineNumbers={
|
|
107
|
+
showLineNumbers={lineNumbersStart !== undefined}
|
|
100
108
|
/>
|
|
101
109
|
))}
|
|
102
110
|
</code>
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
import React, {type ReactNode} from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
useCurrentSidebarSiblings,
|
|
12
12
|
filterDocCardListItems,
|
|
13
13
|
} from '@docusaurus/plugin-content-docs/client';
|
|
14
14
|
import DocCard from '@theme/DocCard';
|
|
15
15
|
import type {Props} from '@theme/DocCardList';
|
|
16
16
|
|
|
17
17
|
function DocCardListForCurrentSidebarCategory({className}: Props) {
|
|
18
|
-
const
|
|
19
|
-
return <DocCardList items={
|
|
18
|
+
const items = useCurrentSidebarSiblings();
|
|
19
|
+
return <DocCardList items={items} className={className} />;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default function DocCardList(props: Props): ReactNode {
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -412,7 +412,7 @@ declare module '@theme/CodeBlock' {
|
|
|
412
412
|
readonly metastring?: string;
|
|
413
413
|
readonly title?: string;
|
|
414
414
|
readonly language?: string;
|
|
415
|
-
readonly showLineNumbers?: boolean;
|
|
415
|
+
readonly showLineNumbers?: boolean | number;
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
export default function CodeBlock(props: Props): ReactNode;
|