File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ async function renderJsDocTags(tags: JsDocTag[], symbolLookup: SymbolLookup): Pr
185185 const examples = tags . filter ( t => t . kind === 'example' )
186186 const deprecated = tags . find ( t => t . kind === 'deprecated' )
187187 const see = tags . filter ( t => t . kind === 'see' )
188+
188189 const deprecatedMessagePromise = deprecated ?. doc
189190 ? renderMarkdown ( deprecated . doc . replace ( / \n / g, ' ' ) , symbolLookup )
190191 : null
@@ -195,6 +196,7 @@ async function renderJsDocTags(tags: JsDocTag[], symbolLookup: SymbolLookup): Pr
195196 const code = example . doc . replace ( / ` ` ` \w * \n ? / g, '' ) . trim ( )
196197 return highlightCodeBlock ( code , lang )
197198 } )
199+
198200 const [ renderedDeprecatedMessage , ...renderedExamples ] = await Promise . all ( [
199201 deprecatedMessagePromise ,
200202 ...examplePromises ,
@@ -238,7 +240,7 @@ async function renderJsDocTags(tags: JsDocTag[], symbolLookup: SymbolLookup): Pr
238240 }
239241
240242 // Examples (with syntax highlighting)
241- if ( examples . length > 0 ) {
243+ if ( examples . length > 0 && renderedExamples . some ( Boolean ) ) {
242244 lines . push ( `<div class="docs-examples">` )
243245 lines . push ( `<h4>Example${ examples . length > 1 ? 's' : '' } </h4>` )
244246 lines . push ( ...renderedExamples . filter ( Boolean ) )
You can’t perform that action at this time.
0 commit comments