docusaurus-theme-openapi-docs 0.0.0-690 → 0.0.0-691
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.
|
@@ -23,6 +23,7 @@ const FormTextInput_1 = __importDefault(
|
|
|
23
23
|
);
|
|
24
24
|
const LiveEditor_1 = __importDefault(require("@theme/ApiExplorer/LiveEditor"));
|
|
25
25
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
26
|
+
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
26
27
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
27
28
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
28
29
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
@@ -296,6 +297,10 @@ function Body({
|
|
|
296
297
|
react_1.default.createElement(
|
|
297
298
|
TabItem_1.default,
|
|
298
299
|
{ label: "Example", value: "example" },
|
|
300
|
+
example.summary &&
|
|
301
|
+
react_1.default.createElement(Markdown_1.default, {
|
|
302
|
+
children: example.summary,
|
|
303
|
+
}),
|
|
299
304
|
exampleBody &&
|
|
300
305
|
react_1.default.createElement(
|
|
301
306
|
LiveEditor_1.default,
|
|
@@ -337,7 +342,9 @@ function Body({
|
|
|
337
342
|
key: example.label,
|
|
338
343
|
},
|
|
339
344
|
example.summary &&
|
|
340
|
-
react_1.default.createElement(
|
|
345
|
+
react_1.default.createElement(Markdown_1.default, {
|
|
346
|
+
children: example.summary,
|
|
347
|
+
}),
|
|
341
348
|
example.body &&
|
|
342
349
|
react_1.default.createElement(
|
|
343
350
|
LiveEditor_1.default,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
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
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import CodeBlock from "@theme/CodeBlock";
|
|
11
|
+
import ReactMarkdown from "react-markdown";
|
|
12
|
+
import rehypeRaw from "rehype-raw";
|
|
13
|
+
|
|
14
|
+
function Markdown({ children }) {
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<ReactMarkdown
|
|
18
|
+
children={children}
|
|
19
|
+
rehypePlugins={[rehypeRaw]}
|
|
20
|
+
components={{
|
|
21
|
+
pre: "div",
|
|
22
|
+
code({ node, inline, className, children, ...props }) {
|
|
23
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
24
|
+
if (inline) return <code>{children}</code>;
|
|
25
|
+
return !inline && match ? (
|
|
26
|
+
<CodeBlock className={className}>{children}</CodeBlock>
|
|
27
|
+
) : (
|
|
28
|
+
<CodeBlock>{children}</CodeBlock>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Markdown;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-691",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"clsx": "^1.1.1",
|
|
44
44
|
"copy-text-to-clipboard": "^3.1.0",
|
|
45
45
|
"crypto-js": "^4.1.1",
|
|
46
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
46
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-691",
|
|
47
47
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
48
48
|
"file-saver": "^2.0.5",
|
|
49
49
|
"lodash": "^4.17.20",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=14"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "0efa8b9103c85f438c102118dcb9b6a701a0c375"
|
|
72
72
|
}
|
|
@@ -14,6 +14,7 @@ import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
|
14
14
|
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
15
15
|
import LiveApp from "@theme/ApiExplorer/LiveEditor";
|
|
16
16
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
17
|
+
import Markdown from "@theme/Markdown";
|
|
17
18
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
18
19
|
import TabItem from "@theme/TabItem";
|
|
19
20
|
import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
@@ -303,6 +304,7 @@ function Body({
|
|
|
303
304
|
</TabItem>
|
|
304
305
|
{/* @ts-ignore */}
|
|
305
306
|
<TabItem label="Example" value="example">
|
|
307
|
+
{example.summary && <Markdown children={example.summary} />}
|
|
306
308
|
{exampleBody && (
|
|
307
309
|
<LiveApp
|
|
308
310
|
action={dispatch}
|
|
@@ -340,7 +342,7 @@ function Body({
|
|
|
340
342
|
value={example.label}
|
|
341
343
|
key={example.label}
|
|
342
344
|
>
|
|
343
|
-
{example.summary && <
|
|
345
|
+
{example.summary && <Markdown children={example.summary} />}
|
|
344
346
|
{example.body && (
|
|
345
347
|
<LiveApp action={dispatch} language={language}>
|
|
346
348
|
{example.body}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
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
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import CodeBlock from "@theme/CodeBlock";
|
|
11
|
+
import ReactMarkdown from "react-markdown";
|
|
12
|
+
import rehypeRaw from "rehype-raw";
|
|
13
|
+
|
|
14
|
+
function Markdown({ children }) {
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<ReactMarkdown
|
|
18
|
+
children={children}
|
|
19
|
+
rehypePlugins={[rehypeRaw]}
|
|
20
|
+
components={{
|
|
21
|
+
pre: "div",
|
|
22
|
+
code({ node, inline, className, children, ...props }) {
|
|
23
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
24
|
+
if (inline) return <code>{children}</code>;
|
|
25
|
+
return !inline && match ? (
|
|
26
|
+
<CodeBlock className={className}>{children}</CodeBlock>
|
|
27
|
+
) : (
|
|
28
|
+
<CodeBlock>{children}</CodeBlock>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Markdown;
|
package/src/theme-openapi.d.ts
CHANGED
|
@@ -63,6 +63,10 @@ declare module "@theme/SchemaTabs" {
|
|
|
63
63
|
export default function SchemaTabs(props: any): JSX.Element;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
declare module "@theme/Markdown" {
|
|
67
|
+
export default function Markdown(props: any): JSX.Element;
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
declare module "@theme/ApiExplorer/Accept" {
|
|
67
71
|
export default function Accept(): JSX.Element;
|
|
68
72
|
}
|