Skip to content

Commit 320b200

Browse files
authored
Merge pull request #121 from docsbydoxdox/hotfix/hide-empty-params-returns
[hotfix] Hide empty parameters and returns sections.
2 parents a45c8fd + a8ea1f3 commit 320b200

File tree

5 files changed

+60
-20
lines changed

5 files changed

+60
-20
lines changed

packages/doxdox-renderer-bootstrap/src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const renderMethod = (method: Method) => `<div class="mb-5"><a name="${
3333
3434
${method.description ? md.render(method.description) : ''}
3535
36-
<h3>Parameters</h3>
36+
${
37+
method.params.length
38+
? `<h3>Parameters</h3>
3739
3840
<div class="table-responsive">
3941
${md
@@ -48,15 +50,21 @@ ${md
4850
])
4951
)
5052
.replace('<table>', '<table class="table">')}
51-
</div>
53+
</div>`
54+
: ''
55+
}
5256
53-
<h3>Returns</h3>
57+
${
58+
method.returns.length
59+
? `<h3>Returns</h3>
5460
5561
${method.returns.map(
5662
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
5763
5864
<p>${param.description}</p>`
59-
)}
65+
)}`
66+
: ''
67+
}
6068
6169
</div>
6270
`;

packages/doxdox-renderer-dash/src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const renderMethod = (doc: Doc, method: Method) => `<!DOCTYPE html>
5252
5353
${method.description ? md.render(method.description) : ''}
5454
55-
<h3>Parameters</h3>
55+
${
56+
method.params.length
57+
? `<h3>Parameters</h3>
5658
5759
<div class="table-responsive">
5860
${md
@@ -67,15 +69,21 @@ ${md
6769
])
6870
)
6971
.replace('<table>', '<table class="table">')}
70-
</div>
72+
</div>`
73+
: ''
74+
}
7175
72-
<h3>Returns</h3>
76+
${
77+
method.returns.length
78+
? `<h3>Returns</h3>
7379
7480
${method.returns.map(
7581
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
7682
7783
<p>${param.description}</p>`
78-
)}
84+
)}`
85+
: ''
86+
}
7987
8088
</div>
8189

packages/doxdox-renderer-github-wiki/src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const renderMethod = (method: Method) => `## ${method.fullName}
1010
1111
${method.description}
1212
13-
### Parameters
13+
${
14+
method.params.length
15+
? `### Parameters
1416
1517
${markdownTable([
1618
['Name', 'Types', 'Description'],
@@ -19,14 +21,20 @@ ${markdownTable([
1921
types.join(', '),
2022
description
2123
])
22-
])}
24+
])}`
25+
: ''
26+
}
2327
24-
### Returns
28+
${
29+
method.returns.length
30+
? `### Returns
2531
2632
${method.returns.map(
2733
param => `${param.types.join(', ')}
2834
${param.description}`
29-
)}
35+
)}`
36+
: ''
37+
}
3038
3139
Documentation generated with [doxdox](https://github.com/docsbydoxdox/doxdox)
3240

packages/doxdox-renderer-markdown/src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const renderMethod = (method: Method) => `## ${method.fullName}
66
77
${method.description}
88
9-
### Parameters
9+
${
10+
method.params.length
11+
? `### Parameters
1012
1113
${markdownTable([
1214
['Name', 'Types', 'Description'],
@@ -15,14 +17,20 @@ ${markdownTable([
1517
types.join(', '),
1618
description
1719
])
18-
])}
20+
])}`
21+
: ''
22+
}
1923
20-
### Returns
24+
${
25+
method.returns.length
26+
? `### Returns
2127
2228
${method.returns.map(
2329
param => `${param.types.join(', ')}
2430
${param.description}`
25-
)}
31+
)}`
32+
: ''
33+
}
2634
2735
`;
2836

packages/doxdox-renderer-pdf/src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const renderMethod = (method: Method) => `<div class="mb-5"><a name="${
3030
3131
${method.description ? md.render(method.description) : ''}
3232
33-
<h3>Parameters</h3>
33+
${
34+
method.params.length
35+
? `<h3>Parameters</h3>
3436
3537
<div class="table-responsive">
3638
${md
@@ -45,15 +47,21 @@ ${md
4547
])
4648
)
4749
.replace('<table>', '<table class="table">')}
48-
</div>
50+
</div>`
51+
: ''
52+
}
4953
50-
<h3>Returns</h3>
54+
${
55+
method.returns.length
56+
? `<h3>Returns</h3>
5157
5258
${method.returns.map(
5359
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
5460
5561
<p>${param.description}</p>`
56-
)}
62+
)}`
63+
: ''
64+
}
5765
5866
</div>
5967
`;

0 commit comments

Comments
 (0)