Skip to content

Commit

Permalink
fix: Handle TypeDoc 0.21.3 options breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Jul 12, 2021
1 parent a2eb1b3 commit b3be4f8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/docusaurus-plugin-typedoc/src/options.ts
Expand Up @@ -16,6 +16,10 @@ const DEFAULT_PLUGIN_OPTIONS: PluginOptions = {
},
plugin: ['none'],
watch: false,
hideInPageTOC: true,
hideBreadcrumbs: true,
hidePageTitle: true,
entryDocument: 'index.md',
};

export const getPluginOptions = (
Expand Down
4 changes: 4 additions & 0 deletions packages/docusaurus-plugin-typedoc/src/plugin.ts
@@ -1,3 +1,5 @@
import * as path from 'path';

import { LoadContext } from '@docusaurus/types';
import { Application } from 'typedoc';
import { load } from 'typedoc-plugin-markdown';
Expand All @@ -21,6 +23,8 @@ export default async function pluginDocusaurus(

const app = new Application();

app.options.setValue('theme', path.resolve(__dirname));

load(app);

const options = bootstrap(app, opts);
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-typedoc/src/render.ts
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as path from 'path';

import ProgressBar from 'progress';
import {
Expand Down Expand Up @@ -36,7 +35,7 @@ export const bootstrap = (app: Application, opts: Partial<PluginOptions>) => {
addTypedocReaders(app);
addTypedocDeclarations(app);
app.renderer.render = render;
app.bootstrap({ ...getPluginOptions(opts), theme: path.resolve(__dirname) });
app.bootstrap({ ...getPluginOptions(opts) });
return app.options.getRawValues() as PluginOptions;
};

Expand Down
4 changes: 0 additions & 4 deletions packages/docusaurus-plugin-typedoc/src/theme.ts
Expand Up @@ -6,10 +6,6 @@ import { FrontMatterComponent } from './front-matter';
export default class DocusaurusTheme extends MarkdownTheme {
constructor(renderer: Renderer, basePath: string) {
super(renderer, basePath);
renderer.application.options.setValue('hideInPageTOC', true);
renderer.application.options.setValue('hideBreadcrumbs', true);
renderer.application.options.setValue('hidePageTitle', true);
renderer.application.options.setValue('entryDocument', 'index.md');
renderer.addComponent('fm', new FrontMatterComponent(renderer));
}

Expand Down
4 changes: 4 additions & 0 deletions packages/docusaurus-plugin-typedoc/src/types.ts
Expand Up @@ -10,6 +10,10 @@ export interface PluginOptions {
disableOutputCheck?: boolean;
entryPoints?: string[];
watch: boolean;
hideInPageTOC: boolean;
hideBreadcrumbs: boolean;
hidePageTitle: boolean;
entryDocument: string;
}

export interface FrontMatter {
Expand Down
Expand Up @@ -20,9 +20,13 @@ Array [
exports[`Options: should return default options 1`] = `
Object {
"docsRoot": "docs",
"entryDocument": "index.md",
"entryPoints": Array [
"entrypoint.ts",
],
"hideBreadcrumbs": true,
"hideInPageTOC": true,
"hidePageTitle": true,
"id": "default",
"out": "api",
"plugin": Array [
Expand Down

0 comments on commit b3be4f8

Please sign in to comment.