docusaurus-plugin-typedoc 0.20.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugin.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { LoadContext } from '@docusaurus/types';
2
2
  import { PluginOptions } from './types';
3
- export default function pluginDocusaurus(context: LoadContext, opts: Partial<PluginOptions>): {
3
+ export default function pluginDocusaurus(context: LoadContext, opts: Partial<PluginOptions>): Promise<{
4
4
  name: string;
5
- loadContent(): Promise<void>;
6
5
  extendCli(cli: any): void;
7
- };
6
+ }>;
package/dist/plugin.js CHANGED
@@ -30,15 +30,13 @@ const render_1 = require("./render");
30
30
  const theme_1 = require("./theme");
31
31
  const apps = [];
32
32
  const PLUGIN_NAME = 'docusaurus-plugin-typedoc';
33
- function pluginDocusaurus(context, opts) {
33
+ async function pluginDocusaurus(context, opts) {
34
+ if (opts.id && !apps.includes(opts.id)) {
35
+ apps.push(opts.id);
36
+ await generateTypedoc(context, opts);
37
+ }
34
38
  return {
35
39
  name: PLUGIN_NAME,
36
- async loadContent() {
37
- if (opts.id && !apps.includes(opts.id)) {
38
- apps.push(opts.id);
39
- generateTypedoc(context, opts);
40
- }
41
- },
42
40
  extendCli(cli) {
43
41
  cli
44
42
  .command('generate-typedoc')
@@ -46,7 +44,9 @@ function pluginDocusaurus(context, opts) {
46
44
  .action(async () => {
47
45
  var _a;
48
46
  (_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.plugins.forEach((pluginConfig) => {
49
- if (pluginConfig && typeof pluginConfig[1] === 'object' && pluginConfig[0] === PLUGIN_NAME) {
47
+ if (pluginConfig &&
48
+ typeof pluginConfig[1] === 'object' &&
49
+ pluginConfig[0] === PLUGIN_NAME) {
50
50
  generateTypedoc(context, pluginConfig[1]);
51
51
  }
52
52
  });
@@ -56,6 +56,7 @@ function pluginDocusaurus(context, opts) {
56
56
  }
57
57
  exports.default = pluginDocusaurus;
58
58
  async function generateTypedoc(context, opts) {
59
+ var _a, _b;
59
60
  const { siteDir } = context;
60
61
  const options = (0, options_1.getPluginOptions)(opts);
61
62
  const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
@@ -64,6 +65,12 @@ async function generateTypedoc(context, opts) {
64
65
  (0, render_1.removeDir)(outputDir);
65
66
  }
66
67
  const app = await typedoc_1.Application.bootstrapWithPlugins(optionsPassedToTypeDoc);
68
+ if (((_b = (_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.markdown) === null || _b === void 0 ? void 0 : _b.format) !== 'mdx') {
69
+ app.renderer.on(typedoc_1.PageEvent.END, (event) => {
70
+ var _a;
71
+ event.contents = (_a = event.contents) === null || _a === void 0 ? void 0 : _a.replace(/\\</g, '<');
72
+ });
73
+ }
67
74
  (0, render_1.addTypedocDeclarations)(app);
68
75
  setOptions(app, options);
69
76
  app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "0.20.2",
3
+ "version": "0.22.0",
4
4
  "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -20,7 +20,8 @@
20
20
  "typedoc-plugin-markdown": ">=3.15.0"
21
21
  },
22
22
  "devDependencies": {
23
- "typedoc-plugin-markdown": "^3.15.0"
23
+ "typedoc-plugin-markdown": "^3.15.0",
24
+ "@docusaurus/types": "^3.0.0"
24
25
  },
25
26
  "scripts": {
26
27
  "lint": "eslint ./src --ext .ts",