Skip to content

Commit 5b49b21

Browse files
committed
Fixed parameters column layout
1 parent b8e6706 commit 5b49b21

File tree

8 files changed

+59
-43
lines changed

8 files changed

+59
-43
lines changed

src/theme/helpers/getParamatersTableHeaders.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export function getParametersTableHeaders(parameters: any) {
1313
let headers;
1414
if (hasDefaultValues) {
1515
headers = ['Param', 'Type', 'Default value', 'Description'];
16+
parameters.forEach((param: any) => {
17+
param.defaultValue = param.defaultValue ? param.defaultValue : '-';
18+
});
1619
} else {
1720
headers = ['Param', 'Type', 'Description'];
1821
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
export function ifContainsDefaultValues(parameters: any) {
3+
let hasDefaultValues = false;
4+
parameters.forEach((param: any) => {
5+
if (param.defaultValue) {
6+
hasDefaultValues = true;
7+
return;
8+
}
9+
});
10+
return hasDefaultValues;
11+
}

tests/mocks/bitbucket/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ ___
189189

190190

191191

192-
*Defined in [functions.ts:161](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-161)*
192+
*Defined in [functions.ts:163](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-163)*
193193

194194

195195

@@ -272,12 +272,12 @@ ___
272272

273273
### functionWithDefaults
274274

275-
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE?: *`boolean`*): `string`
275+
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE: *`any`*): `string`
276276

277277

278278

279279

280-
*Defined in [functions.ts:61](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-61)*
280+
*Defined in [functions.ts:63](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-63)*
281281

282282

283283

@@ -288,11 +288,11 @@ This is a function with a parameter that has a default value.
288288

289289
| Param | Type | Default value | Description |
290290
| ------ | ------ | ------ | ------ |
291-
| valueA | `string` | "defaultValue" | - |
291+
| valueA | `string` | "defaultValue" | Comment for value A. |
292292
| valueB | `number` | 100 | - |
293-
| valueC | `number` | Number.NaN | - |
293+
| valueC | `number` | Number.NaN | Comment for value C |
294294
| valueD | `boolean` | true | - |
295-
| valueE | `boolean` | false | - |
295+
| valueE | `any` | - | Comment for value E |
296296

297297

298298

@@ -317,7 +317,7 @@ ___
317317

318318

319319

320-
*Defined in [functions.ts:176](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-176)*
320+
*Defined in [functions.ts:178](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-178)*
321321

322322

323323

@@ -380,7 +380,7 @@ ___
380380

381381

382382

383-
*Defined in [functions.ts:78](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-78)*
383+
*Defined in [functions.ts:80](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-80)*
384384

385385

386386

@@ -416,7 +416,7 @@ ___
416416

417417

418418

419-
*Defined in [functions.ts:121](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-121)*
419+
*Defined in [functions.ts:123](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-123)*
420420

421421

422422

@@ -486,7 +486,7 @@ ___
486486

487487

488488

489-
*Defined in [functions.ts:88](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-88)*
489+
*Defined in [functions.ts:90](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-90)*
490490

491491

492492

@@ -508,7 +508,7 @@ This is the first signature of a function with multiple signatures.
508508

509509

510510

511-
*Defined in [functions.ts:96](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-96)*
511+
*Defined in [functions.ts:98](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-98)*
512512

513513

514514

tests/mocks/bitbucket/modules/modulefunction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is the module extending the function moduleFunction().
1313

1414

1515

16-
*Defined in [functions.ts:130](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-130)*
16+
*Defined in [functions.ts:132](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-132)*
1717

1818

1919

@@ -57,7 +57,7 @@ This is a function that is extended by a module.
5757

5858
**● functionVariable**: *`string`*
5959

60-
*Defined in [functions.ts:140](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-140)*
60+
*Defined in [functions.ts:142](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-142)*
6161

6262

6363

@@ -79,7 +79,7 @@ ___
7979

8080

8181

82-
*Defined in [functions.ts:145](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-145)*
82+
*Defined in [functions.ts:147](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-147)*
8383

8484

8585

@@ -105,7 +105,7 @@ ___
105105

106106

107107

108-
*Defined in [functions.ts:152](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-152)*
108+
*Defined in [functions.ts:154](https://bitbucket.org/owner/repository_name/src/master/src/functions.ts?fileviewer=file-view-default#functions.ts-154)*
109109

110110

111111

tests/mocks/default/modules/_functions_.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040

41-
*Defined in [functions.ts:161](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L161)*
41+
*Defined in [functions.ts:163](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L163)*
4242

4343

4444

@@ -121,12 +121,12 @@ ___
121121

122122
### functionWithDefaults
123123

124-
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE?: *`boolean`*): `string`
124+
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE: *`any`*): `string`
125125

126126

127127

128128

129-
*Defined in [functions.ts:61](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L61)*
129+
*Defined in [functions.ts:63](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L63)*
130130

131131

132132

@@ -137,11 +137,11 @@ This is a function with a parameter that has a default value.
137137

138138
| Param | Type | Default value | Description |
139139
| ------ | ------ | ------ | ------ |
140-
| valueA | `string` | "defaultValue" | - |
140+
| valueA | `string` | "defaultValue" | Comment for value A. |
141141
| valueB | `number` | 100 | - |
142-
| valueC | `number` | Number.NaN | - |
142+
| valueC | `number` | Number.NaN | Comment for value C |
143143
| valueD | `boolean` | true | - |
144-
| valueE | `boolean` | false | - |
144+
| valueE | `any` | - | Comment for value E |
145145

146146

147147

@@ -166,7 +166,7 @@ ___
166166

167167

168168

169-
*Defined in [functions.ts:176](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L176)*
169+
*Defined in [functions.ts:178](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L178)*
170170

171171

172172

@@ -229,7 +229,7 @@ ___
229229

230230

231231

232-
*Defined in [functions.ts:78](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L78)*
232+
*Defined in [functions.ts:80](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L80)*
233233

234234

235235

@@ -265,7 +265,7 @@ ___
265265

266266

267267

268-
*Defined in [functions.ts:121](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L121)*
268+
*Defined in [functions.ts:123](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L123)*
269269

270270

271271

@@ -335,7 +335,7 @@ ___
335335

336336

337337

338-
*Defined in [functions.ts:88](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L88)*
338+
*Defined in [functions.ts:90](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L90)*
339339

340340

341341

@@ -357,7 +357,7 @@ This is the first signature of a function with multiple signatures.
357357

358358

359359

360-
*Defined in [functions.ts:96](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L96)*
360+
*Defined in [functions.ts:98](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L98)*
361361

362362

363363

tests/mocks/default/modules/_functions_.modulefunction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is the module extending the function moduleFunction().
1313

1414

1515

16-
*Defined in [functions.ts:130](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L130)*
16+
*Defined in [functions.ts:132](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L132)*
1717

1818

1919

@@ -57,7 +57,7 @@ This is a function that is extended by a module.
5757

5858
**● functionVariable**: *`string`*
5959

60-
*Defined in [functions.ts:140](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L140)*
60+
*Defined in [functions.ts:142](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L142)*
6161

6262

6363

@@ -79,7 +79,7 @@ ___
7979

8080

8181

82-
*Defined in [functions.ts:145](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L145)*
82+
*Defined in [functions.ts:147](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L147)*
8383

8484

8585

@@ -105,7 +105,7 @@ ___
105105

106106

107107

108-
*Defined in [functions.ts:152](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L152)*
108+
*Defined in [functions.ts:154](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/tests/src/functions.ts#L154)*
109109

110110

111111

tests/mocks/outfile/API.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,7 +3658,7 @@ ___
36583658

36593659
### functionWithDefaults
36603660

3661-
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE?: *`boolean`*): `string`
3661+
**functionWithDefaults**(valueA?: *`string`*, valueB?: *`number`*, valueC?: *`number`*, valueD?: *`boolean`*, valueE: *`any`*): `string`
36623662

36633663

36643664

@@ -3673,11 +3673,11 @@ This is a function with a parameter that has a default value.
36733673

36743674
| Param | Type | Default value | Description |
36753675
| ------ | ------ | ------ | ------ |
3676-
| valueA | `string` | "defaultValue" | - |
3676+
| valueA | `string` | "defaultValue" | Comment for value A. |
36773677
| valueB | `number` | 100 | - |
3678-
| valueC | `number` | Number.NaN | - |
3678+
| valueC | `number` | Number.NaN | Comment for value C |
36793679
| valueD | `boolean` | true | - |
3680-
| valueE | `boolean` | false | - |
3680+
| valueE | `any` | - | Comment for value E |
36813681

36823682

36833683

tests/src/functions.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ export function functionWithOptionalValue(requiredParam:string, optionalParam?:s
5555
/**
5656
* This is a function with a parameter that has a default value.
5757
*
58-
* @param value An optional return value.
58+
* @param valueA Comment for value A.
59+
* @param valueC Comment for value C
60+
* @param valueE Comment for value E
5961
* @returns The input value or the default value.
6062
*/
6163
export function functionWithDefaults(
6264
valueA:string = 'defaultValue',
6365
valueB:number = 100,
6466
valueC:number = Number.NaN,
6567
valueD:boolean = true,
66-
valueE:boolean = false
68+
valueE
6769
):string {
6870
return valueA;
6971
}
@@ -99,7 +101,7 @@ export function multipleSignatures(value: {name:string}): string;
99101
* This is the actual implementation, this comment will not be visible
100102
* in the generated documentation.
101103
*/
102-
export function multipleSignatures():string {
104+
export function multipleSignatures(): string {
103105
if (arguments.length > 0) {
104106
if (typeof arguments[0] == 'object') {
105107
return arguments[0].name;
@@ -118,7 +120,7 @@ export function multipleSignatures():string {
118120
* @param value The typed value.
119121
* @return Returns the typed value.
120122
*/
121-
export function genericFunction<T>(value:T):T {
123+
export function genericFunction<T>(value: T): T {
122124
return value;
123125
}
124126

@@ -127,17 +129,17 @@ export function genericFunction<T>(value:T):T {
127129
*
128130
* @param arg An argument.
129131
*/
130-
export function moduleFunction(arg:string):string { return ''; }
132+
export function moduleFunction(arg:string): string { return ''; }
131133

132134
/**
133135
* This is the module extending the function moduleFunction().
134136
*/
135-
export module moduleFunction
137+
export namespace moduleFunction
136138
{
137139
/**
138140
* This variable is appended to a function.
139141
*/
140-
var functionVariable:string;
142+
let functionVariable: string;
141143

142144
/**
143145
* This function is appended to another function.
@@ -161,8 +163,8 @@ export module moduleFunction
161163
export function createSomething() {
162164
return {
163165
foo: 'bar',
164-
doSomething: (a:number) => a + 1,
165-
doAnotherThing: () => {}
166+
doSomething: (a: number) => a + 1,
167+
doAnotherThing: () => {},
166168
};
167169
}
168170

0 commit comments

Comments
 (0)