docusaurus-plugin-typedoc 1.0.0-next.21 → 1.0.0-next.23

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/options.js CHANGED
@@ -8,6 +8,7 @@ const DEFAULT_PLUGIN_OPTIONS = {
8
8
  hideBreadcrumbs: true,
9
9
  hidePageHeader: true,
10
10
  entryFileName: 'index.md',
11
+ theme: 'docusaurus',
11
12
  sidebar: {
12
13
  autoConfiguration: true,
13
14
  pretty: false,
package/dist/plugin.js CHANGED
@@ -29,6 +29,7 @@ const path = __importStar(require("path"));
29
29
  const typedoc_1 = require("typedoc");
30
30
  const options_1 = require("./options");
31
31
  const sidebar_1 = require("./sidebar");
32
+ const theme_1 = require("./theme");
32
33
  // store list of plugin ids when running multiple instances
33
34
  const apps = [];
34
35
  function pluginDocusaurus(context, opts) {
@@ -66,6 +67,7 @@ async function generateTypedoc(context, opts) {
66
67
  const options = (0, options_1.getPluginOptions)(opts);
67
68
  const { id, sidebar, ...optionsPassedToTypeDoc } = options;
68
69
  const app = await typedoc_1.Application.bootstrapWithPlugins(optionsPassedToTypeDoc);
70
+ app.renderer.defineTheme('docusaurus', theme_1.DocusuaurusTheme);
69
71
  const outputDir = app.options.getValue('out');
70
72
  if (options.cleanOutputDir) {
71
73
  removeDir(outputDir);
package/dist/sidebar.js CHANGED
@@ -19,7 +19,7 @@ function getNavigationItem(navigationItem, basePath, filteredIds, numberPrefixPa
19
19
  return {
20
20
  type: 'category',
21
21
  label: navigationItem.title,
22
- items: getSidebar(navigationItem.children, basePath, filteredIds),
22
+ items: getSidebar(navigationItem.children, basePath, filteredIds, numberPrefixParser),
23
23
  ...(id && { link: { type: 'doc', id } }),
24
24
  };
25
25
  }
@@ -0,0 +1,9 @@
1
+ import { PageEvent, Reflection, SomeType } from 'typedoc';
2
+ import { MarkdownTheme, MarkdownThemeRenderContext } from 'typedoc-plugin-markdown';
3
+ export declare class DocusuaurusTheme extends MarkdownTheme {
4
+ getRenderContext(pageEvent: PageEvent<Reflection>): ThemeRenderContext;
5
+ }
6
+ declare class ThemeRenderContext extends MarkdownThemeRenderContext {
7
+ typeArguments: (typeArguments: SomeType[]) => string;
8
+ }
9
+ export {};
package/dist/theme.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocusuaurusTheme = void 0;
4
+ const typedoc_1 = require("typedoc");
5
+ const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown");
6
+ class DocusuaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
7
+ getRenderContext(pageEvent) {
8
+ return new ThemeRenderContext(pageEvent, this.application.options);
9
+ }
10
+ }
11
+ exports.DocusuaurusTheme = DocusuaurusTheme;
12
+ class ThemeRenderContext extends typedoc_plugin_markdown_1.MarkdownThemeRenderContext {
13
+ constructor() {
14
+ super(...arguments);
15
+ // adds space around type arguments as docusaurus generates broken links without it in certain use-cases (see https://github.com/facebook/docusaurus/issues/9518)
16
+ this.typeArguments = (typeArguments) => {
17
+ return `\\< ${typeArguments
18
+ .map((typeArgument) => typeArgument instanceof typedoc_1.ReflectionType
19
+ ? this.reflectionType(typeArgument)
20
+ : this.someType(typeArgument))
21
+ .join(', ')} \\>`;
22
+ };
23
+ }
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "1.0.0-next.21",
3
+ "version": "1.0.0-next.23",
4
4
  "description": "A Docusaurus plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "homepage": "https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc",
18
18
  "peerDependencies": {
19
- "typedoc-plugin-markdown": ">=4.0.0-next.26"
19
+ "typedoc-plugin-markdown": ">=4.0.0-next.30"
20
20
  },
21
21
  "scripts": {
22
22
  "lint": "eslint ./src --ext .ts",