export function ifParentIsObjectLiteral(this: DeclarationReflection, truthy: boolean, options: any) { const parentIsObjectLiteral = this.parent && this.parent.parent && this.parent.parent.kind === ReflectionKind.ObjectLiteral; if (parentIsObjectLiteral && truthy) { return options.fn(this); } return !parentIsObjectLiteral && !truthy ? options.fn(this) : options.inverse(this); }
export function reflectionTitle(this: PageEvent) { const title = []; if (this.model.kindString) { title.push(`${this.model.kindString}:`); } title.push(this.model.name); if (this.model.typeParameters) { const typeParameters = this.model.typeParameters.map((typeParameter) => typeParameter.name).join(', '); title.push(`‹**${typeParameters}**›`); } return title.join(' '); }
onRendererEnd(renderer: RendererEvent) { if (!this.application.options.getValue('skipSidebar')) { const docusarusRoot = this.findDocusaurusRoot(renderer.outputDirectory); if (docusarusRoot === null) { this.application.logger.warn( `[typedoc-markdown-plugin] sidebars.json not written as could not locate docusaurus root directory. In order to to implemnent sidebars.json functionality, the output directory must be a child of a 'docs' directory.`, ); return; } this.writeSideBar(renderer, docusarusRoot); } }
static toLink(name, reflection: Reflection | string) { let link = name; if (reflection instanceof Reflection) { if (reflection.kindOf(ReflectionKind.TypeAlias) && !(reflection as any).stickToParent) { link = `Types${name}`; } if ((reflection as any).stickToParent) { link = (reflection as any).stickToParent + name; } } return `[${name}](${LinkPlugin.anchorName(link)})`; }
constructor(renderer: Renderer, basePath: string) { super(renderer, basePath); this.indexName = 'index'; renderer.addComponent('frontmatter', new FrontMatterComponent(renderer)); this.listenTo(renderer, RendererEvent.END, this.onRendererEnd, 1024); }
/** * Checks whether some DeclarationReflection is in the noInherit list. * @param search The DeclarationReflection to search for in the list. */ private isNoInherit(search: DeclarationReflection): boolean { if (this.noInherit.find((no: DeclarationReflection) => no.id === search.id && no.name === search.name)) { return true; } return false; }
onRendererEnd(renderer: RendererEvent) { const root = this.findRoot(renderer.outputDirectory); if (root === null) { this.application.logger.warn( `[typedoc-markdown-plugin] sidebars.json not written as could not locate VuePress root directory. In order to to implemnent sidebars.json functionality, the output directory must be a child of a 'docs' directory.`, ); return; } this.writeSideBar(renderer, root); }
/** * Returns the full url of a given mapping and reflection * @param mapping * @param reflection */ toUrl(mapping: TemplateMapping, reflection: DeclarationReflection) { return mapping.directory + '/' + this.getUrl(reflection) + this.fileExt; }
private onResolve(context: Context, reflection: ContainerReflection) { reflection.kindString = CubejsGroupPlugin.getKindSingular(reflection.kind); if (reflection.children && reflection.children.length > 0) { this.populateOrder(reflection.children); reflection.children.sort(CubejsGroupPlugin.sortCallback); reflection.groups = CubejsGroupPlugin.getReflectionGroups(reflection.children); } }
getSummaryMarkdown(renderer: RendererEvent) { const md = []; md.push(`* [Globals](globals.md)`); this.getNavigation(renderer.project).children.forEach(rootNavigation => { if (rootNavigation.children) { md.push(`* [${rootNavigation.title}](${rootNavigation.url})`); rootNavigation.children.forEach(item => { md.push(` * [${item.title}](${item.url})`); }); } }); return md.join('\n'); }
export function ifParentIsModule(this: DeclarationReflection, truthy: boolean, options: any) { const parentIsModule = this.parent && this.parent.kind === ReflectionKind.Module; if (parentIsModule && truthy) { return options.fn(this); } return !parentIsModule && !truthy ? options.fn(this) : options.inverse(this); }
onRendererEnd(renderer: RendererEvent) { if (!this.application.options.getValue('skipSidebar')) { const docusarusRoot = this.findDocusaurus2Root(renderer.outputDirectory); if (docusarusRoot === null) { this.application.logger.warn( `[typedoc-markdown-plugin] ${this.sidebarName} not written as could not locate docusaurus root directory. In order to to implemnent ${this.sidebarName} functionality, the output directory must be a child of a 'docs' directory.`, ); return; } this.writeSideBar(renderer, docusarusRoot); } }