Skip to content

Commit 715edc5

Browse files
committed
Fixes #143 Brings markdown support to object and array descriptions in schema
1 parent d6ae727 commit 715edc5

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/components/schema-table.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ export default class SchemaTable extends LitElement {
7777
</div>
7878
</div>
7979
80-
<div style='padding: 5px 0; color:var(--fg3)'> <span class='bold-text upper'> ${this.data['::type']}: </span> ${this.data['::description']}</div>
80+
<div style='padding: 5px 0; color:var(--fg3)'>
81+
<span class='bold-text upper'> ${this.data['::type']}</span>
82+
<span>${unsafeHTML(marked(this.data['::description'] || ''))}</span>
83+
</div>
8184
<div style = "border:1px solid var(--light-border-color)">
8285
<div style='display:flex; height:18px; background-color: var(--bg2); line-height:18px; padding:8px 2px; border-bottom:1px solid var(--light-border-color);'>
8386
<div class='td key' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg)'> Field</div>
@@ -134,7 +137,7 @@ export default class SchemaTable extends LitElement {
134137
}
135138
</div>
136139
<div class='td key-type'>${prevDataType.startsWith('xxx-') ? '' : prevDataType}</div>
137-
<div class='td key-descr'>${prevDescr}</div>
140+
<div class='td key-descr'>${unsafeHTML(marked(prevDescr || ''))} </div>
138141
</div>`
139142
: ''
140143
}

src/components/schema-tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default class SchemaTree extends LitElement {
9191
${this.schemaDescriptionExpanded === 'true' ? 'Collapse Details' : 'Expand Details'}
9292
</div>
9393
</div>
94-
<div style='color:var(--fg3)'> ${this.data ? this.data['::description'] : ''}</div>
94+
<span style='color:var(--fg3)'> ${this.data ? unsafeHTML(marked(this.data['::description'] || '')) : ''}</span>
9595
${this.data
9696
? html`
9797
${this.generateTree(
@@ -156,7 +156,7 @@ export default class SchemaTree extends LitElement {
156156
: newPrevKey
157157
}${level > 0 ? ':' : ''}${openBracket}
158158
</div>
159-
<div class='td key-descr'>${prevDescr}</div>
159+
<div class='td key-descr'>${unsafeHTML(marked(prevDescr || ''))}</div>
160160
</div>
161161
<div class='inside-bracket ${data['::type']}' style='padding-left:${data['::type'] !== 'xxx-of-option' ? leftPadding : 0}px;'>
162162
${Object.keys(data).map((key) => html`

src/rapidoc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ export default class RapiDoc extends LitElement {
235235
.nav-bar-path.active {
236236
border-left:4px solid var(--nav-accent-color);
237237
color:var(--nav-hover-text-color);
238-
background-color:var(--nav-hover-bg-color);
239238
}
240239
241240
.nav-bar-info:hover,
@@ -466,7 +465,7 @@ export default class RapiDoc extends LitElement {
466465
${(this.allowSearch === 'false')
467466
? ''
468467
: html`
469-
<div style="position:sticky; top:0; display:flex; flex-direction:row; align-items: stretch; padding:24px; background: var(--nav-bg-color); box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);">
468+
<div style="position:sticky; top:0; display:flex; flex-direction:row; align-items: stretch; padding:24px; background: var(--nav-bg-color); border-bottom: 1px solid var(--nav-hover-bg-color)">
470469
<div style="display:flex; flex:1">
471470
<input id="nav-bar-search"
472471
style="width:100%; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)"

src/styles/schema-styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default html`
7474
padding:5px 0;
7575
margin:0 2px;
7676
}
77+
.toolbar-item:first-of-type { margin:0 2px 0 0;}
7778
7879
@media only screen and (min-width: 500px) {
7980
.key-descr {

0 commit comments

Comments
 (0)