|
1 | 1 | import { type ComponentProps, Fragment, useContext } from 'react' |
| 2 | +import Markdown from 'react-markdown' |
| 3 | +import rehypeRaw from 'rehype-raw' |
| 4 | +import remarkGfm from 'remark-gfm' |
2 | 5 |
|
3 | | -import { camelToKebab, ExperimentalCodeInline, ExperimentalSwitch, ExperimentalTag } from '@edgeandnode/gds' |
| 6 | +import { |
| 7 | + camelToKebab, |
| 8 | + ExperimentalCodeInline, |
| 9 | + ExperimentalLink, |
| 10 | + ExperimentalSwitch, |
| 11 | + ExperimentalTag, |
| 12 | +} from '@edgeandnode/gds' |
4 | 13 | import { CaretDown } from '@edgeandnode/gds/icons' |
5 | 14 |
|
6 | 15 | import { Heading, Table } from '@/components' |
@@ -72,7 +81,15 @@ export default function TemplateOpenApiContent({ children, ...props }: Component |
72 | 81 | <div className="mt-1 text-12 text-space-500">{parameter.schema.type}</div> |
73 | 82 | </td> |
74 | 83 | <td className="text-body-xsmall"> |
75 | | - {parameter.description ? <p className="+:mb-0">{parameter.description}</p> : null} |
| 84 | + {parameter.description ? ( |
| 85 | + <Markdown |
| 86 | + rehypePlugins={[rehypeRaw]} |
| 87 | + remarkPlugins={[remarkGfm]} |
| 88 | + components={{ a: ExperimentalLink as any, code: ExperimentalCodeInline as any }} |
| 89 | + > |
| 90 | + {parameter.description} |
| 91 | + </Markdown> |
| 92 | + ) : null} |
76 | 93 | <ul className="mt-1 empty:hidden"> |
77 | 94 | {parameter.schema.default ? ( |
78 | 95 | <li> |
@@ -209,7 +226,17 @@ export default function TemplateOpenApiContent({ children, ...props }: Component |
209 | 226 | {potentialResponse.status} |
210 | 227 | </ExperimentalTag> |
211 | 228 | </td> |
212 | | - <td className="text-body-xsmall">{potentialResponse.description}</td> |
| 229 | + <td className="text-body-xsmall"> |
| 230 | + {potentialResponse.description ? ( |
| 231 | + <Markdown |
| 232 | + rehypePlugins={[rehypeRaw]} |
| 233 | + remarkPlugins={[remarkGfm]} |
| 234 | + components={{ a: ExperimentalLink as any, code: ExperimentalCodeInline as any }} |
| 235 | + > |
| 236 | + {potentialResponse.description} |
| 237 | + </Markdown> |
| 238 | + ) : null} |
| 239 | + </td> |
213 | 240 | </tr> |
214 | 241 | ) |
215 | 242 | })} |
|
0 commit comments