diff --git a/demo/examples/petstore.yaml b/demo/examples/petstore.yaml index acf8a3c78..7b07a34a6 100644 --- a/demo/examples/petstore.yaml +++ b/demo/examples/petstore.yaml @@ -909,6 +909,8 @@ paths: type: string examples: response: + summary: | + This is an example of using **Docusaurus** `markdown` in a summary. Note that admonitions are not fully supported. value: OK application/xml: schema: @@ -1194,6 +1196,7 @@ components: title: Pettie - $ref: "#/components/schemas/Pet" example: + summary: A great example! category: name: Great Dane sub: diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts b/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts index 2a99c1272..9fd70126a 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts @@ -127,8 +127,9 @@ export function createResponseExamples( value: `${exampleName}`, children: [ guard(exampleValue.summary, (summary) => [ - create("Markdown", { - children: ` ${summary}`, + create("div", { + children: `${summary}`, + className: "openapi-example__summary", }), ]), create("ResponseSamples", { @@ -143,8 +144,9 @@ export function createResponseExamples( value: `${exampleName}`, children: [ guard(exampleValue.summary, (summary) => [ - create("Markdown", { - children: ` ${summary}`, + create("div", { + children: `${summary}`, + className: "openapi-example__summary", }), ]), create("ResponseSamples", { @@ -171,8 +173,9 @@ export function createResponseExample(responseExample: any, mimeType: string) { value: `Example`, children: [ guard(responseExample.summary, (summary) => [ - create("Markdown", { - children: ` ${summary}`, + create("div", { + children: `${summary}`, + className: "openapi-example__summary", }), ]), create("ResponseSamples", { @@ -187,8 +190,9 @@ export function createResponseExample(responseExample: any, mimeType: string) { value: `Example`, children: [ guard(responseExample.summary, (summary) => [ - create("Markdown", { - children: ` ${summary}`, + create("div", { + children: `${summary}`, + className: "openapi-example__summary", }), ]), create("ResponseSamples", { diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts b/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts index c3a23670b..caa2ae5fe 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts @@ -76,7 +76,6 @@ export function createApiPageMD({ `import ResponseSamples from "@theme/ResponseSamples";\n`, `import SchemaItem from "@theme/SchemaItem";\n`, `import SchemaTabs from "@theme/SchemaTabs";\n`, - `import Markdown from "@theme/Markdown";\n`, `import Heading from "@theme/Heading";\n`, `import OperationTabs from "@theme/OperationTabs";\n`, `import TabItem from "@theme/TabItem";\n\n`, diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx index b0dad0689..da3951e38 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx @@ -14,7 +14,6 @@ import FormSelect from "@theme/ApiExplorer/FormSelect"; import FormTextInput from "@theme/ApiExplorer/FormTextInput"; import LiveApp from "@theme/ApiExplorer/LiveEditor"; import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks"; -import Markdown from "@theme/Markdown"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types"; @@ -304,7 +303,7 @@ function Body({ {/* @ts-ignore */} - {example.summary && } + {example.summary &&
{example.summary}
} {exampleBody && ( - {example.summary && } + {example.summary &&
{example.summary}
} {example.body && ( {example.body}