typedoc-plugin-markdown
Version:
A TypeDoc plugin that generates TypeScript API documentation as Markdown.
24 lines (23 loc) • 907 B
JavaScript
import { heading } from '../../../libs/markdown/index.js';
import { getAnchoredTitle } from '../../../theme/lib/index.js';
import { ReflectionKind } from 'typedoc';
export function memberContainer(model, options) {
const md = [];
const anchor = !this.router.hasOwnDocument(model) && this.router.hasUrl(model)
? this.router.getAnchor(model)
: undefined;
const isTitled = !this.router.hasOwnDocument(model) &&
![ReflectionKind.Constructor].includes(model.kind);
const { htmlAnchor, title } = getAnchoredTitle(this, isTitled ? this.partials.memberTitle(model) : '', anchor);
if (htmlAnchor) {
md.push(htmlAnchor);
}
if (isTitled) {
md.push(heading(options.headingLevel, title));
}
md.push(this.partials.member(model, {
headingLevel: options.headingLevel,
nested: options.nested,
}));
return md.join('\n\n');
}