Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: renders Markdown in all description fields #34

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { isParameterWithSchemaObject } from '../../libs/schemaObject'
import Content from '../Content.astro'
import Items from '../Items.astro'
import Key from '../Key.astro'
import Md from '../Md.astro'
import Schema from '../schema/Schema.astro'
import Text from '../Text.astro'

interface Props {
parameter: Parameter
Expand All @@ -20,12 +20,12 @@ const { parameter } = Astro.props
isOpenAPIV2Items(parameter) ? (
<>
<Items items={parameter} />
<Text>{parameter.description}</Text>
<Md text={parameter.description} />
</>
) : parameter.content ? (
<>
<Content content={parameter.content} />
<Text>{parameter.description}</Text>
<Md text={parameter.description} />
</>
) : isParameterWithSchemaObject(parameter) ? (
<Schema
Expand Down
6 changes: 3 additions & 3 deletions packages/starlight-openapi/components/schema/Schema.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { isSchemaObjectObject, type SchemaObject as SchemaObjectType } from '../../libs/schemaObject'
import Examples, { type Props as ExamplesProps } from '../example/Examples.astro'
import Text from '../Text.astro'
import Md from '../Md.astro'

import SchemaObject from './SchemaObject.astro'

Expand All @@ -16,7 +16,7 @@ const { description, example, examples, schema } = Astro.props
const isObject = schema && isSchemaObjectObject(schema)
---

{isObject && <Text>{description}</Text>}
{isObject && <Md text={description} />}
{schema && <SchemaObject schemaObject={schema} hideExample={example !== undefined || examples !== undefined} />}
{!isObject && <Text>{description}</Text>}
{!isObject && <Md text={description} />}
<Examples example={example} examples={examples} />
Loading