docusaurus-plugin-openapi-docs 0.0.0-534 → 0.0.0-536

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.
@@ -13,7 +13,9 @@ function createDescription(description) {
13
13
  return "";
14
14
  }
15
15
  return `\n\n${description
16
- .replace(utils_1.lessThan, "<")
17
- .replace(utils_1.greaterThan, ">")}\n\n`;
16
+ .replace(utils_1.greaterThan, "\\>")
17
+ .replace(utils_1.codeFence, function (match) {
18
+ return match.replace(/\\>/g, ">");
19
+ })}\n\n`;
18
20
  }
19
21
  exports.createDescription = createDescription;
@@ -28,8 +28,8 @@ function mergeAllOf(allOf) {
28
28
  "x-examples": function () {
29
29
  return true;
30
30
  },
31
- ignoreAdditionalProperties: true,
32
31
  },
32
+ ignoreAdditionalProperties: true,
33
33
  });
34
34
  const required = allOf.reduce((acc, cur) => {
35
35
  if (Array.isArray(cur.required)) {
@@ -7,3 +7,4 @@ export declare function guard<T>(value: T | undefined, cb: (value: T) => Childre
7
7
  export declare function render(children: Children): string;
8
8
  export declare const lessThan: RegExp;
9
9
  export declare const greaterThan: RegExp;
10
+ export declare const codeFence: RegExp;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.greaterThan = exports.lessThan = exports.render = exports.guard = exports.create = void 0;
9
+ exports.codeFence = exports.greaterThan = exports.lessThan = exports.render = exports.guard = exports.create = void 0;
10
10
  function create(tag, props) {
11
11
  const { children, ...rest } = props;
12
12
  let propString = "";
@@ -35,5 +35,6 @@ function render(children) {
35
35
  }
36
36
  exports.render = render;
37
37
  // Regex to selectively URL-encode '>' and '<' chars
38
- exports.lessThan = /<(?!(=|button|\s?\/button|details|\s?\/details|summary|\s?\/summary|hr|\s?\/hr|br|\s?\/br|span|\s?\/span|strong|\s?\/strong|small|\s?\/small|table|\s?\/table|td|\s?\/td|tr|\s?\/tr|th|\s?\/th|h1|\s?\/h1|h2|\s?\/h2|h3|\s?\/h3|h4|\s?\/h4|h5|\s?\/h5|h6|\s?\/h6|title|\s?\/title|p|\s?\/p|em|\s?\/em|b|\s?\/b|i|\s?\/i|u|\s?\/u|strike|\s?\/strike|a|\s?\/a|li|\s?\/li|ol|\s?\/ol|ul|\s?\/ul|img|\s?\/img|div|\s?\/div|center|\s?\/center))/giu;
39
- exports.greaterThan = /(?<!(button|details|summary|hr|br|span|strong|small|table|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|a|tag|li|ol|ul|img|div|center|\/|\s|"|'))>?!=/giu;
38
+ exports.lessThan = /<(?!(=|button|\s?\/button|details|\s?\/details|summary|\s?\/summary|hr|\s?\/hr|br|\s?\/br|span|\s?\/span|strong|\s?\/strong|small|\s?\/small|table|\s?\/table|td|\s?\/td|tr|\s?\/tr|th|\s?\/th|h1|\s?\/h1|h2|\s?\/h2|h3|\s?\/h3|h4|\s?\/h4|h5|\s?\/h5|h6|\s?\/h6|title|\s?\/title|p|\s?\/p|em|\s?\/em|b|\s?\/b|i|\s?\/i|u|\s?\/u|strike|\s?\/strike|a|\s?\/a|li|\s?\/li|ol|\s?\/ol|ul|\s?\/ul|img|\s?\/img|div|\s?\/div|center|\s?\/center))/gu;
39
+ exports.greaterThan = /(?<!(button|details|summary|hr|br|span|strong|small|table|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|a|tag|li|ol|ul|img|div|center|\/|\s|"|'))>/gu;
40
+ exports.codeFence = /`{1,3}[\s\S]*?`{1,3}/g;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-openapi-docs",
3
3
  "description": "OpenAPI plugin for Docusaurus.",
4
- "version": "0.0.0-534",
4
+ "version": "0.0.0-536",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "c9fa70b8fd3e1241f87011dec6010bb5ccb63ad5"
71
+ "gitHead": "29d7def0a7d3146fadb9874f241f1498f6171562"
72
72
  }
@@ -5,13 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import { greaterThan, lessThan } from "./utils";
8
+ import { greaterThan, codeFence } from "./utils";
9
9
 
10
10
  export function createDescription(description: string | undefined) {
11
11
  if (!description) {
12
12
  return "";
13
13
  }
14
14
  return `\n\n${description
15
- .replace(lessThan, "&lt;")
16
- .replace(greaterThan, "&gt;")}\n\n`;
15
+ .replace(greaterThan, "\\>")
16
+ .replace(codeFence, function (match) {
17
+ return match.replace(/\\>/g, ">");
18
+ })}\n\n`;
17
19
  }
@@ -29,8 +29,8 @@ export function mergeAllOf(allOf: SchemaObject[]) {
29
29
  "x-examples": function () {
30
30
  return true;
31
31
  },
32
- ignoreAdditionalProperties: true,
33
32
  },
33
+ ignoreAdditionalProperties: true,
34
34
  });
35
35
 
36
36
  const required = allOf.reduce((acc, cur) => {
@@ -43,6 +43,7 @@ export function render(children: Children): string {
43
43
 
44
44
  // Regex to selectively URL-encode '>' and '<' chars
45
45
  export const lessThan =
46
- /<(?!(=|button|\s?\/button|details|\s?\/details|summary|\s?\/summary|hr|\s?\/hr|br|\s?\/br|span|\s?\/span|strong|\s?\/strong|small|\s?\/small|table|\s?\/table|td|\s?\/td|tr|\s?\/tr|th|\s?\/th|h1|\s?\/h1|h2|\s?\/h2|h3|\s?\/h3|h4|\s?\/h4|h5|\s?\/h5|h6|\s?\/h6|title|\s?\/title|p|\s?\/p|em|\s?\/em|b|\s?\/b|i|\s?\/i|u|\s?\/u|strike|\s?\/strike|a|\s?\/a|li|\s?\/li|ol|\s?\/ol|ul|\s?\/ul|img|\s?\/img|div|\s?\/div|center|\s?\/center))/giu;
46
+ /<(?!(=|button|\s?\/button|details|\s?\/details|summary|\s?\/summary|hr|\s?\/hr|br|\s?\/br|span|\s?\/span|strong|\s?\/strong|small|\s?\/small|table|\s?\/table|td|\s?\/td|tr|\s?\/tr|th|\s?\/th|h1|\s?\/h1|h2|\s?\/h2|h3|\s?\/h3|h4|\s?\/h4|h5|\s?\/h5|h6|\s?\/h6|title|\s?\/title|p|\s?\/p|em|\s?\/em|b|\s?\/b|i|\s?\/i|u|\s?\/u|strike|\s?\/strike|a|\s?\/a|li|\s?\/li|ol|\s?\/ol|ul|\s?\/ul|img|\s?\/img|div|\s?\/div|center|\s?\/center))/gu;
47
47
  export const greaterThan =
48
- /(?<!(button|details|summary|hr|br|span|strong|small|table|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|a|tag|li|ol|ul|img|div|center|\/|\s|"|'))>?!=/giu;
48
+ /(?<!(button|details|summary|hr|br|span|strong|small|table|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|a|tag|li|ol|ul|img|div|center|\/|\s|"|'))>/gu;
49
+ export const codeFence = /`{1,3}[\s\S]*?`{1,3}/g;