Skip to content

Commit ef4ce36

Browse files
committed
chore(refactor): moved comment parts to helper file
1 parent 4be65e4 commit ef4ce36

17 files changed

+34
-100
lines changed

packages/typedoc-plugin-markdown/src/theme/context/helpers/get-description-for-reflection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export function getDescriptionForReflection(
99
? model.signatures[0].comment
1010
: model.comment;
1111
if (comment?.summary?.length) {
12-
return this.partials
13-
.commentParts(comment.summary)
12+
return this.helpers
13+
.getCommentParts(comment.summary)
1414
?.split('\n\n')[0]
1515
.replace(/\n/g, ' ');
1616
}

packages/typedoc-plugin-markdown/src/theme/context/partials/_index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from './comments.comment';
2-
export * from './comments.commentParts';
32
export * from './container.body';
43
export * from './container.categories';
54
export * from './container.groups';

packages/typedoc-plugin-markdown/src/theme/context/partials/comments.comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function comment(
9494
? heading(opts.headingLevel, tagText) + '\n'
9595
: bold(tagText) + '\n',
9696
];
97-
tagMd.push(this.partials.commentParts(tag.content));
97+
tagMd.push(this.helpers.getCommentParts(tag.content));
9898
return tagMd.join('\n');
9999
});
100100
md.push(tags.join('\n\n'));

packages/typedoc-plugin-markdown/src/theme/context/partials/comments.commentParts.ts

Lines changed: 0 additions & 70 deletions
This file was deleted.

packages/typedoc-plugin-markdown/src/theme/context/partials/container.categories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function categories(
1313
.forEach((category) => {
1414
md.push(heading(options.headingLevel, category.title));
1515
if (category.description) {
16-
md.push(this.partials.commentParts(category.description));
16+
md.push(this.helpers.getCommentParts(category.description));
1717
}
1818
if (category.children) {
1919
md.push(

packages/typedoc-plugin-markdown/src/theme/context/partials/container.groups.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function groups(
2626
if (group.categories) {
2727
md.push(heading(options.headingLevel, getGroupTitle(group.title)));
2828
if (group.description) {
29-
md.push(this.partials.commentParts(group.description));
29+
md.push(this.helpers.getCommentParts(group.description));
3030
}
3131
md.push(
3232
this.partials.categories(group.categories, {
@@ -44,7 +44,7 @@ export function groups(
4444

4545
md.push(heading(options.headingLevel, getGroupTitle(group.title)));
4646
if (group.description) {
47-
md.push(this.partials.commentParts(group.description));
47+
md.push(this.helpers.getCommentParts(group.description));
4848
}
4949
if (
5050
isPropertiesGroup &&

packages/typedoc-plugin-markdown/src/theme/context/partials/member.reflectionIndex.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function reflectionIndex(
1717
model.categories.forEach((categoryGroup) => {
1818
md.push(heading(options.headingLevel, categoryGroup.title) + '\n');
1919
if (categoryGroup.description) {
20-
md.push(this.partials.commentParts(categoryGroup.description) + '\n');
20+
md.push(this.helpers.getCommentParts(categoryGroup.description) + '\n');
2121
}
2222
md.push(this.helpers.getGroupIndex(categoryGroup) + '\n');
2323
});
@@ -36,7 +36,7 @@ export function reflectionIndex(
3636
);
3737
if (categoryGroup.description) {
3838
md.push(
39-
this.partials.commentParts(categoryGroup.description) + '\n',
39+
this.helpers.getCommentParts(categoryGroup.description) + '\n',
4040
);
4141
}
4242
md.push(this.helpers.getGroupIndex(categoryGroup) + '\n');

packages/typedoc-plugin-markdown/src/theme/context/partials/member.signature.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ export function signature(
8686
this.partials.inheritance(model, { headingLevel: options.headingLevel }),
8787
);
8888

89-
if (model.comment) {
89+
if (modelComments) {
9090
md.push(
91-
this.partials.comment(model.comment, {
91+
this.partials.comment(modelComments, {
9292
headingLevel: options.headingLevel,
9393
showSummary: false,
9494
}),

packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureReturns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function signatureReturns(
2828
if (model.comment?.blockTags.length) {
2929
const tags = model.comment.blockTags
3030
.filter((tag) => tag.tag === '@returns')
31-
.map((tag) => this.partials.commentParts(tag.content));
31+
.map((tag) => this.helpers.getCommentParts(tag.content));
3232
md.push(tags.join('\n\n'));
3333
}
3434

packages/typedoc-plugin-markdown/src/theme/context/resources.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ export const resourcePartials = (context: MarkdownThemeContext) => {
7777
isTableColumn?: boolean | undefined;
7878
} = {},
7979
) => partials.comment.apply(context, [model, options]) as string,
80-
commentParts: (model: CommentDisplayPart[]) =>
81-
partials.commentParts.apply(context, [model]) as string,
8280
body: (model: ContainerReflection, options: { headingLevel: number }) =>
8381
partials.body.apply(context, [model, options]) as string,
8482
categories: (

0 commit comments

Comments
 (0)