Skip to content

Commit d6ae727

Browse files
committed
Fixes #144 Markdown support in response description
1 parent 97c66eb commit d6ae727

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

docs/specs/data-types.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,21 @@ paths:
1111
tags:
1212
- A
1313
responses:
14+
'400':
15+
description: |
16+
Test1
17+
18+
| Tables | Are | Cool |
19+
| ------------- |:-------------:| -----:|
20+
| col 3 is | right-aligned | $1600 |
21+
| col 2 is | centered | $12 |
1422
'200':
1523
description: successful operation
1624
content:
1725
application/json:
1826
schema:
1927
type: object
28+
description: Description of **Person** object (Person must be bold)
2029
properties:
2130
age:
2231
description: Person's **Age** (age must be bold)
@@ -39,23 +48,24 @@ paths:
3948
type: integer
4049
dependentNames:
4150
type: array
42-
description: Full Name of Dependents .
51+
description: Full Name of **Dependents** (Dependents must be bold).
4352
items:
4453
type: object
4554
properties:
4655
firstNameParts:
47-
description: First Name parts
56+
description: Parts of **First Name** (First Name must be bold)
4857
type: object
4958
properties:
5059
firstName:
5160
description: This is a very very long description to test how will it show up on a API spec renderer tool such as RapiDoc. This lable must be big enough to wrap into next line
5261
type: string
53-
aVeryVeryLongFieldToForTestingHowThingsLookWhenInSchemaModelWhenItEncountersALongField:
62+
aLongFieldForTestingHowItShowsUpInSchemaModelWhenItEncountersLongField:
5463
description: Dependent Last Name
5564
type: string
5665
dependentLastName:
5766
description: Dependent Last Name
5867
type: string
68+
5969
/simple-object:
6070
get:
6171
summary: response as a simple object containing primitive properties.

src/components/api-response.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ export default class ApiResponse extends LitElement {
146146
${Object.keys(this.responses).map((status) => html`
147147
<div style = 'display: ${status === this.selectedStatus ? 'block' : 'none'}' >
148148
<div class="top-gap">
149-
<span class="resp-status">${status}:</span>
150-
<span class="resp-descr">${this.responses[status].description}</span>
149+
<span class="resp-descr m-markdown m-markdown-small">${unsafeHTML(marked(this.responses[status].description || ''))}</span>
151150
${(this.headersForEachRespStatus[status] && this.headersForEachRespStatus[status].length > 0)
152151
? html`${this.responseHeaderListTemplate(this.headersForEachRespStatus[status])}`
153152
: ''

0 commit comments

Comments
 (0)