docusaurus-theme-openapi-docs 1.1.5 → 1.1.8

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.
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -33,7 +34,21 @@ function ParamsItem({
33
34
 
34
35
  const renderDescription = guard(description, (description) => (
35
36
  <div>
36
- <ReactMarkdown children={createDescription(description)} />
37
+ <ReactMarkdown
38
+ children={createDescription(description)}
39
+ components={{
40
+ pre: "div",
41
+ code({ node, inline, className, children, ...props }) {
42
+ const match = /language-(\w+)/.exec(className || "");
43
+ if (inline) return <code>{children}</code>;
44
+ return !inline && match ? (
45
+ <CodeBlock className={className}>{children}</CodeBlock>
46
+ ) : (
47
+ <CodeBlock>{children}</CodeBlock>
48
+ );
49
+ },
50
+ }}
51
+ />
37
52
  </div>
38
53
  ));
39
54
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -29,8 +30,22 @@ function SchemaItem({
29
30
  );
30
31
 
31
32
  const renderSchemaDescription = guard(schemaDescription, (description) => (
32
- <div className={styles.schemaDescription}>
33
- <ReactMarkdown children={createDescription(description)} />
33
+ <div>
34
+ <ReactMarkdown
35
+ children={createDescription(description)}
36
+ components={{
37
+ pre: "div",
38
+ code({ node, inline, className, children, ...props }) {
39
+ const match = /language-(\w+)/.exec(className || "");
40
+ if (inline) return <code>{children}</code>;
41
+ return !inline && match ? (
42
+ <CodeBlock className={className}>{children}</CodeBlock>
43
+ ) : (
44
+ <CodeBlock>{children}</CodeBlock>
45
+ );
46
+ },
47
+ }}
48
+ />
34
49
  </div>
35
50
  ));
36
51
 
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  .schemaTabsListContainer {
42
- padding: 0 0.25rem;
42
+ /* padding: 0 0.25rem; */
43
43
  overflow-y: hidden;
44
44
  overflow-x: scroll;
45
45
  scroll-behavior: smooth;
@@ -95,8 +95,4 @@
95
95
  .schemaTabsContainer {
96
96
  width: 100%;
97
97
  }
98
-
99
- .tabItem {
100
- height: 100%;
101
- }
102
98
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -33,7 +34,21 @@ function ParamsItem({
33
34
 
34
35
  const renderDescription = guard(description, (description) => (
35
36
  <div>
36
- <ReactMarkdown children={createDescription(description)} />
37
+ <ReactMarkdown
38
+ children={createDescription(description)}
39
+ components={{
40
+ pre: "div",
41
+ code({ node, inline, className, children, ...props }) {
42
+ const match = /language-(\w+)/.exec(className || "");
43
+ if (inline) return <code>{children}</code>;
44
+ return !inline && match ? (
45
+ <CodeBlock className={className}>{children}</CodeBlock>
46
+ ) : (
47
+ <CodeBlock>{children}</CodeBlock>
48
+ );
49
+ },
50
+ }}
51
+ />
37
52
  </div>
38
53
  ));
39
54
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -29,8 +30,22 @@ function SchemaItem({
29
30
  );
30
31
 
31
32
  const renderSchemaDescription = guard(schemaDescription, (description) => (
32
- <div className={styles.schemaDescription}>
33
- <ReactMarkdown children={createDescription(description)} />
33
+ <div>
34
+ <ReactMarkdown
35
+ children={createDescription(description)}
36
+ components={{
37
+ pre: "div",
38
+ code({ node, inline, className, children, ...props }) {
39
+ const match = /language-(\w+)/.exec(className || "");
40
+ if (inline) return <code>{children}</code>;
41
+ return !inline && match ? (
42
+ <CodeBlock className={className}>{children}</CodeBlock>
43
+ ) : (
44
+ <CodeBlock>{children}</CodeBlock>
45
+ );
46
+ },
47
+ }}
48
+ />
34
49
  </div>
35
50
  ));
36
51
 
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  .schemaTabsListContainer {
42
- padding: 0 0.25rem;
42
+ /* padding: 0 0.25rem; */
43
43
  overflow-y: hidden;
44
44
  overflow-x: scroll;
45
45
  scroll-behavior: smooth;
@@ -95,8 +95,4 @@
95
95
  .schemaTabsContainer {
96
96
  width: 100%;
97
97
  }
98
-
99
- .tabItem {
100
- height: 100%;
101
- }
102
98
  }
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": "1.1.5",
4
+ "version": "1.1.8",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -50,7 +50,7 @@
50
50
  "buffer": "^6.0.3",
51
51
  "clsx": "^1.1.1",
52
52
  "crypto-js": "^4.1.1",
53
- "docusaurus-plugin-openapi-docs": "^1.1.5",
53
+ "docusaurus-plugin-openapi-docs": "^1.1.8",
54
54
  "immer": "^9.0.7",
55
55
  "lodash": "^4.17.20",
56
56
  "process": "^0.11.10",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "21d33582a9fcac2ddd23443497af910982b36dae"
71
+ "gitHead": "619aa16c52e6de8fd752ff583681b0da093b679c"
72
72
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -33,7 +34,21 @@ function ParamsItem({
33
34
 
34
35
  const renderDescription = guard(description, (description) => (
35
36
  <div>
36
- <ReactMarkdown children={createDescription(description)} />
37
+ <ReactMarkdown
38
+ children={createDescription(description)}
39
+ components={{
40
+ pre: "div",
41
+ code({ node, inline, className, children, ...props }) {
42
+ const match = /language-(\w+)/.exec(className || "");
43
+ if (inline) return <code>{children}</code>;
44
+ return !inline && match ? (
45
+ <CodeBlock className={className}>{children}</CodeBlock>
46
+ ) : (
47
+ <CodeBlock>{children}</CodeBlock>
48
+ );
49
+ },
50
+ }}
51
+ />
37
52
  </div>
38
53
  ));
39
54
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import CodeBlock from "@theme/CodeBlock";
10
11
  import ReactMarkdown from "react-markdown";
11
12
 
12
13
  import { createDescription } from "../../markdown/createDescription";
@@ -29,8 +30,22 @@ function SchemaItem({
29
30
  );
30
31
 
31
32
  const renderSchemaDescription = guard(schemaDescription, (description) => (
32
- <div className={styles.schemaDescription}>
33
- <ReactMarkdown children={createDescription(description)} />
33
+ <div>
34
+ <ReactMarkdown
35
+ children={createDescription(description)}
36
+ components={{
37
+ pre: "div",
38
+ code({ node, inline, className, children, ...props }) {
39
+ const match = /language-(\w+)/.exec(className || "");
40
+ if (inline) return <code>{children}</code>;
41
+ return !inline && match ? (
42
+ <CodeBlock className={className}>{children}</CodeBlock>
43
+ ) : (
44
+ <CodeBlock>{children}</CodeBlock>
45
+ );
46
+ },
47
+ }}
48
+ />
34
49
  </div>
35
50
  ));
36
51
 
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  .schemaTabsListContainer {
42
- padding: 0 0.25rem;
42
+ /* padding: 0 0.25rem; */
43
43
  overflow-y: hidden;
44
44
  overflow-x: scroll;
45
45
  scroll-behavior: smooth;
@@ -95,8 +95,4 @@
95
95
  .schemaTabsContainer {
96
96
  width: 100%;
97
97
  }
98
-
99
- .tabItem {
100
- height: 100%;
101
- }
102
98
  }