Skip to content

Commit

Permalink
fix: fix allReflectionsHaveOwnDocument option
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Sep 23, 2021
1 parent 7f830db commit 64376e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
7 changes: 3 additions & 4 deletions packages/typedoc-plugin-markdown/src/render-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as fs from 'fs';
import * as Handlebars from 'handlebars';
import * as path from 'path';
import { ContainerReflection, PageEvent } from 'typedoc';
import breadcrumbsHelper from './resources/helpers/breadcrumbs';
import commentHelper from './resources/helpers/comment';
import commentsHelper from './resources/helpers/comments';
Expand Down Expand Up @@ -36,9 +35,9 @@ export const reflectionTemplate = Handlebars.compile(
fs.readFileSync(path.join(TEMPLATE_PATH, 'reflection.hbs')).toString(),
);

export function getReflectionMemberTemplate() {
return (pageEvent: PageEvent<ContainerReflection>) => 'REFLECTION_MEMBER';
}
export const reflectionMemberTemplate = Handlebars.compile(
fs.readFileSync(path.join(TEMPLATE_PATH, 'reflection.member.hbs')).toString(),
);

export function registerPartials() {
const partialsFolder = path.join(__dirname, 'resources', 'partials');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

{{> member}}

{{/with}}
{{/with}}
18 changes: 14 additions & 4 deletions packages/typedoc-plugin-markdown/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { getKindPlural } from './groups';
import { NavigationItem } from './navigation-item';

import {
getReflectionMemberTemplate,
indexTemplate,
reflectionMemberTemplate,
reflectionTemplate,
registerHelpers,
registerPartials,
Expand Down Expand Up @@ -200,6 +200,16 @@ export class MarkdownTheme extends Theme {
};
}

getReflectionMemberTemplate() {
return (pageEvent: PageEvent<ContainerReflection>) => {
return reflectionMemberTemplate(pageEvent, {
allowProtoMethodsByDefault: true,
allowProtoPropertiesByDefault: true,
data: { theme: this },
});
};
}

getIndexTemplate() {
return (pageEvent: PageEvent<ContainerReflection>) => {
return indexTemplate(pageEvent, {
Expand Down Expand Up @@ -311,19 +321,19 @@ export class MarkdownTheme extends Theme {
kind: [ReflectionKind.TypeAlias],
isLeaf: true,
directory: 'types',
template: getReflectionMemberTemplate(),
template: this.getReflectionMemberTemplate(),
},
{
kind: [ReflectionKind.Variable],
isLeaf: true,
directory: 'variables',
template: getReflectionMemberTemplate(),
template: this.getReflectionMemberTemplate(),
},
{
kind: [ReflectionKind.Function],
isLeaf: true,
directory: 'functions',
template: getReflectionMemberTemplate(),
template: this.getReflectionMemberTemplate(),
},
]
: []),
Expand Down

0 comments on commit 64376e9

Please sign in to comment.