Skip to content

Commit

Permalink
chore(core): doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed May 11, 2024
1 parent f4f068b commit e750d58
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
15 changes: 10 additions & 5 deletions docs/pages/docs/customizing-output.mdx
Expand Up @@ -10,10 +10,15 @@ Plugins export a load function with context of the resolved application.

Here is a basic plugin skeleton:

```ts filename="local-plugins/my-custom-plugin.ts"
```js filename="local-plugins/my-custom-plugin.mjs"
// @ts-check

import { MarkdownApplication } from 'typedoc-plugin-markdown';

export function load(app: MarkdownApplication) {
/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
export function load(app) {
...
}
```
Expand All @@ -22,7 +27,7 @@ The plugin can then be consumed by adding the path to the plugin in the typedoc.

```json filename="typedoc.json"
{
"plugin": ["typedoc-plugin-markdown", "./local-plugins/my-custom-plugin.js"]
"plugin": ["typedoc-plugin-markdown", "./local-plugins/my-custom-plugin.mjs"]
}
```

Expand Down Expand Up @@ -85,14 +90,14 @@ In theory all available templates, partials and helpers can be overriden with cu
This code defines a new theme called “customTheme”:

```ts
export function load(app) {
export function load(app: MarkdownApplication) {
app.renderer.defineTheme('customTheme', MyMarkdownTheme);
}

class MyMarkdownTheme extends MarkdownTheme {}
```

The theme can then be consumed by the theme optiond:
The theme can then be consumed by the `theme` option:

```json filename="typedoc.json"
{
Expand Down
27 changes: 16 additions & 11 deletions docs/pages/docs/navigation.mdx
Expand Up @@ -10,16 +10,21 @@ The navigation is returned as `JSON` and can be mapped to a custom structure and

The model can be configured by the [`--navigationModel`](/docs/options#navigationmodel) option.

```ts filename="custom-plugin.ts"
export function load(app: MarkdownApplication) {
app.renderer.postRenderAsyncJobs.push(
async (renderer: MarkdownRendererEvent) => {
// The navigation JSON structure is available on the navigation object.
const navigation = renderer.navigation;

// This can be parsed to something else or written straight to a file:
fs.writeFileSync('navigation.json', JSON.stringify(navigation));
},
);
```ts filename="custom-plugin.mjs"
// @ts-check

import { MarkdownApplication } from 'typedoc-plugin-markdown';

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
export function load(app) {
app.renderer.postRenderAsyncJobs.push(async (renderer) => {
// The navigation JSON structure is available on the navigation object.
const navigation = renderer.navigation;

// This can be parsed to something else or written straight to a file:
fs.writeFileSync('navigation.json', JSON.stringify(navigation));
});
}
```
4 changes: 3 additions & 1 deletion docs/pages/docs/typedoc-usage.mdx
Expand Up @@ -71,7 +71,9 @@ For JavaScript files, the `PluginOptions` interface can be imported to a `typedo

You can use intersection types to combine the TypeDoc options with the plugin options.

```js filename="typedoc.config.js"
```js filename="typedoc.config.cjs"
// @ts-check

/** @type {import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions} */
module.exports = {
entryPoints: ['./src/index.ts', './src/secondary-entry.ts'],
Expand Down

0 comments on commit e750d58

Please sign in to comment.