@docusaurus/theme-live-codeblock 3.0.1 → 3.1.1
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.
|
@@ -86,6 +86,9 @@ function EditorWithHeader() {
|
|
|
86
86
|
</>
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
+
// this should rather be a stable function
|
|
90
|
+
// see https://github.com/facebook/docusaurus/issues/9630#issuecomment-1855682643
|
|
91
|
+
const DEFAULT_TRANSFORM_CODE = (code) => `${code};`;
|
|
89
92
|
export default function Playground({children, transformCode, ...props}) {
|
|
90
93
|
const {
|
|
91
94
|
siteConfig: {themeConfig},
|
|
@@ -98,9 +101,9 @@ export default function Playground({children, transformCode, ...props}) {
|
|
|
98
101
|
return (
|
|
99
102
|
<div className={styles.playgroundContainer}>
|
|
100
103
|
<LiveProvider
|
|
101
|
-
code={children
|
|
104
|
+
code={children?.replace(/\n$/, '')}
|
|
102
105
|
noInline={noInline}
|
|
103
|
-
transformCode={transformCode ??
|
|
106
|
+
transformCode={transformCode ?? DEFAULT_TRANSFORM_CODE}
|
|
104
107
|
theme={prismTheme}
|
|
105
108
|
{...props}>
|
|
106
109
|
{playgroundPosition === 'top' ? (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-live-codeblock",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Docusaurus live code block component.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-live-codeblock.d.ts",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "3.
|
|
27
|
-
"@docusaurus/theme-common": "3.
|
|
28
|
-
"@docusaurus/theme-translations": "3.
|
|
29
|
-
"@docusaurus/utils-validation": "3.
|
|
26
|
+
"@docusaurus/core": "3.1.1",
|
|
27
|
+
"@docusaurus/theme-common": "3.1.1",
|
|
28
|
+
"@docusaurus/theme-translations": "3.1.1",
|
|
29
|
+
"@docusaurus/utils-validation": "3.1.1",
|
|
30
30
|
"@philpl/buble": "^0.19.7",
|
|
31
31
|
"clsx": "^2.0.0",
|
|
32
32
|
"fs-extra": "^11.1.1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"tslib": "^2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@docusaurus/types": "3.
|
|
37
|
+
"@docusaurus/types": "3.1.1",
|
|
38
38
|
"@types/buble": "^0.20.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "8017f6a6776ba1bd7065e630a52fe2c2654e2f1b"
|
|
48
48
|
}
|
|
@@ -98,6 +98,10 @@ function EditorWithHeader() {
|
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// this should rather be a stable function
|
|
102
|
+
// see https://github.com/facebook/docusaurus/issues/9630#issuecomment-1855682643
|
|
103
|
+
const DEFAULT_TRANSFORM_CODE = (code: string) => `${code};`;
|
|
104
|
+
|
|
101
105
|
export default function Playground({
|
|
102
106
|
children,
|
|
103
107
|
transformCode,
|
|
@@ -116,9 +120,9 @@ export default function Playground({
|
|
|
116
120
|
return (
|
|
117
121
|
<div className={styles.playgroundContainer}>
|
|
118
122
|
<LiveProvider
|
|
119
|
-
code={children
|
|
123
|
+
code={children?.replace(/\n$/, '')}
|
|
120
124
|
noInline={noInline}
|
|
121
|
-
transformCode={transformCode ??
|
|
125
|
+
transformCode={transformCode ?? DEFAULT_TRANSFORM_CODE}
|
|
122
126
|
theme={prismTheme}
|
|
123
127
|
{...props}>
|
|
124
128
|
{playgroundPosition === 'top' ? (
|
|
@@ -24,7 +24,8 @@ declare module '@theme/Playground' {
|
|
|
24
24
|
type LiveProviderProps = React.ComponentProps<typeof LiveProvider>;
|
|
25
25
|
|
|
26
26
|
export interface Props extends CodeBlockProps, LiveProviderProps {
|
|
27
|
-
|
|
27
|
+
// Allow empty live playgrounds
|
|
28
|
+
children?: string;
|
|
28
29
|
}
|
|
29
30
|
export default function Playground(props: LiveProviderProps): JSX.Element;
|
|
30
31
|
}
|