Skip to content

Commit 12a1a5f

Browse files
authored
fix(docs-gen): titles
1 parent 1598a9b commit 12a1a5f

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DeclarationReflection } from 'typedoc';
2+
3+
export function ifParentKindIs(this: DeclarationReflection, kindString: string, truthy: boolean = true, options: any) {
4+
const equals = this.parent && this.parent.kindString === kindString;
5+
6+
return !equals && !truthy ? options.fn(this) : options.inverse(this);
7+
}

docs-gen/src/resources/helpers/member-title.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import { DeclarationReflection, ReflectionKind } from 'typedoc';
1+
import { DeclarationReflection } from 'typedoc';
22

33
export function memberTitle(this: DeclarationReflection) {
4-
if (this.parent?.kind === ReflectionKind.Enum) {
5-
return '';
6-
}
7-
84
const md = [];
95

106
if (this.flags) {

docs-gen/src/resources/helpers/meta.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export function meta(this: ProjectReflection) {
99

1010
return findModuleRelection(reflection.children?.[0]);
1111
}
12+
13+
function tagConverter(tag: string) {
14+
const tags = {
15+
menucategory: 'category',
16+
menuorder: 'menuOrder'
17+
};
18+
19+
return tags[tag] ?? tag;
20+
}
1221

1322
const moduleReflection = findModuleRelection(this);
1423

@@ -20,7 +29,7 @@ export function meta(this: ProjectReflection) {
2029
if (tag.tagName !== 'description') {
2130
const escape = tag.tagName !== 'menuorder';
2231
const text = escape ? `'${tag.text}'` : tag.text;
23-
md.push(`${tag.tagName === 'menuorder' ? 'menuOrder' : tag.tagName}: ${text}`.replace('\n', ''));
32+
md.push(`${tagConverter(tag.tagName)}: ${text}`.replace('\n', ''));
2433
}
2534
});
2635
md.push('---');

docs-gen/src/resources/partials/member.hbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
{{else}}
99

10-
{{#if memberTitle}}
10+
{{#ifParentKindIs 'Enumeration' false}}
11+
1112
{{heading 3}} {{{ memberTitle }}}
12-
{{/if}}
13+
14+
{{/ifParentKindIs}}
1315

1416
{{/ifParentIsModule}}
1517

packages/cubejs-client-core/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @title @cubejs-client/core
33
* @permalink /@cubejs-client-core
4-
* @category Cube.js Frontend
4+
* @menuCategory Cube.js Frontend
55
* @subcategory Reference
66
* @menuOrder 2
77
* @description Vanilla JavaScript Cube.js client.

0 commit comments

Comments
 (0)