Skip to content

Commit 0768d8f

Browse files
Remove comment markup if it has no content
1 parent ac7620c commit 0768d8f

File tree

4 files changed

+49
-17
lines changed

4 files changed

+49
-17
lines changed
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
<div class="tsd-comment tsd-typography">
2-
{{#if comment.shortText}}
3-
<div class="lead">
4-
{{#markdown}}{{{comment.shortText}}}{{/markdown}}
1+
{{#with comment}}
2+
{{#if hasVisibleComponent}}
3+
<div class="tsd-comment tsd-typography">
4+
{{#if comment.shortText}}
5+
<div class="lead">
6+
{{#markdown}}{{{comment.shortText}}}{{/markdown}}
7+
</div>
8+
{{/if}}
9+
{{#if comment.text}}
10+
{{#markdown}}{{{comment.text}}}{{/markdown}}
11+
{{/if}}
12+
{{#if comment.tags}}
13+
<dl class="tsd-comment-tags">
14+
{{#each comment.tags}}
15+
<dt>{{tagName}}</dt>
16+
<dd>{{#markdown}}{{{text}}}{{/markdown}}</dd>
17+
{{/each}}
18+
</dl>
19+
{{/if}}
520
</div>
621
{{/if}}
7-
{{#if comment.text}}
8-
{{#markdown}}{{{comment.text}}}{{/markdown}}
9-
{{/if}}
10-
{{#if comment.tags}}
11-
<dl class="tsd-comment-tags">
12-
{{#each comment.tags}}
13-
<dt>{{tagName}}</dt>
14-
<dd>{{#markdown}}{{{text}}}{{/markdown}}</dd>
15-
{{/each}}
16-
</dl>
17-
{{/if}}
18-
</div>
22+
{{/with}}

src/typedoc/Settings.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
module TypeDoc
22
{
3+
/**
4+
* Alias to TypeScript.LanguageVersion
5+
*
6+
* @resolve
7+
*/
8+
export var CodeGenTarget = TypeScript.LanguageVersion;
9+
10+
/**
11+
* Alias to TypeScript.ModuleGenTarget
12+
*
13+
* @resolve
14+
*/
15+
export var ModuleGenTarget = TypeScript.ModuleGenTarget;
16+
17+
318
/**
419
* Holds all settings used by TypeDoc.
520
*/
621
export class Settings
722
{
823
/**
924
* The settings used by the TypeScript compiler.
25+
*
26+
* @see [[CodeGenTarget]]
27+
* @see [[ModuleGenTarget]]
1028
*/
1129
compiler:TypeScript.CompilationSettings;
1230

src/typedoc/models/comments/Comment.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ module TypeDoc.Models
4040
}
4141

4242

43+
/**
44+
* Has this comment a visible component?
45+
*
46+
* @returns TRUE when this comment has a visible component.
47+
*/
48+
hasVisibleComponent():boolean {
49+
return <boolean>(this.shortText || this.text || this.tags);
50+
}
51+
52+
4353
/**
4454
* Test whether this comment contains a tag with the given name.
4555
*

src/typedoc/models/reflections/BaseReflection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ module TypeDoc.Models
220220
* @returns TRUE when this reflection has a visible comment.
221221
*/
222222
hasComment():boolean {
223-
return <boolean>(this.comment && (this.comment.shortText || this.comment.text || this.comment.tags));
223+
return <boolean>(this.comment && this.comment.hasVisibleComponent());
224224
}
225225

226226

0 commit comments

Comments
 (0)