Skip to content

Commit c847715

Browse files
committed
feat(core): core router support and further theme alignment to core theme
1 parent 28ecc72 commit c847715

File tree

114 files changed

+2087
-1386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2087
-1386
lines changed

.changeset/config.json

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"updateInternalDependencies": "minor",
1313
"ignore": [
1414
"@devtools/*",
15+
"typedoc-plugin-frontmatter",
16+
"typedoc-plugin-remark",
1517
"typedoc-github-wiki-theme",
1618
"typedoc-gitlab-wiki-theme",
1719
"typedoc-vitepress-theme",

.changeset/dirty-actors-poke.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'typedoc-plugin-markdown': patch
3+
---
4+
5+
- Fix incompatibility when used with "outputs" (#788).
6+
- Utilize "anchorPrefix" option to ensure unique anchors linking if required (#764).

.changeset/icy-dryers-smile.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'typedoc-plugin-markdown': minor
3+
---
4+
5+
- Implemented support for consuming TypeDoc core routers.
6+
- Exported routers to public api.
7+
- Implemented a hierarchy summary page as per default theme.
8+
- Updated "Constructor" titles of classes to fix internal anchor issues.

devtools/examples/docusaurus/docusaurus.config.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,8 @@ const config = {
5959
'../../../packages/typedoc-plugin-markdown/test/fixtures/tsconfig.json',
6060
),
6161
entryPoints: [
62-
'../../../packages/typedoc-plugin-markdown/test/fixtures/src/groups/**/*.ts',
62+
'../../../packages/typedoc-plugin-markdown/test/fixtures/src/reflections/index.ts',
6363
],
64-
expandObjects: true,
65-
readme: 'none',
66-
sidebar: { pretty: true },
67-
outputFileStrategy: 'modules',
68-
cleanOutputDir: true,
6964
},
7065
],
7166
[
@@ -84,10 +79,9 @@ const config = {
8479
'../../../packages/typedoc-plugin-markdown/test/fixtures/tsconfig.json',
8580
),
8681
entryPoints: [
87-
'../../../packages/typedoc-plugin-markdown/test/fixtures/src/modules/module-1',
88-
'../../../packages/typedoc-plugin-markdown/test/fixtures/src/modules/module-2',
82+
'../../../packages/typedoc-plugin-markdown/test/fixtures/src//packages/*',
8983
],
90-
entryPointStrategy: 'expand',
84+
entryPointStrategy: 'packages',
9185
cleanOutputDir: true,
9286
navigation: {
9387
includeFolders: false,

devtools/packages/prebuild-options/tasks/generate-docs.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ asIndexPage: true
2626

2727
outputPage.push(`import { Callout } from 'nextra/components';`);
2828

29-
outputPage.push('# Options');
29+
outputPage.push('# Plugin Options');
3030
if (docsConfig.docsPath === '/docs') {
3131
outputPage.push(
32-
`<Callout type="info">These options should be used in conjunction with the core TypeDoc options (see [TypeDoc Usage](/docs/typedoc-usage)).</Callout>`,
32+
`This page documents additional options that are exposed by this plugin.
33+
34+
*Note: The options must be set at root level and will be ignored inside [packageOptions](https://typedoc.org/documents/Options.Package_Options.html).*`,
3335
);
3436
} else {
3537
if (docsConfig.presets) {

devtools/packages/testing/index.ts

+42-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function expectFileToEqual(
1212
? outputFileStrategy
1313
: [outputFileStrategy];
1414
outputFileStrategies.forEach((outputFileStrategy) => {
15-
const basePath = getBasePath(key, outputFileStrategy);
15+
const basePath = getOutputFileStrategyPath(key, outputFileStrategy);
1616

1717
const optionDirs = fs.readdirSync(basePath);
1818
optionDirs.forEach((optionDir, index) => {
@@ -44,7 +44,7 @@ export function expectUrlsToEqual(
4444
outputFileStrategies: ('members' | 'modules')[],
4545
) {
4646
outputFileStrategies.forEach((outputFileStrategy) => {
47-
const basePath = getBasePath(outDir, outputFileStrategy);
47+
const basePath = getOutputFileStrategyPath(outDir, outputFileStrategy);
4848
const optionDirs = fs.readdirSync(basePath);
4949
optionDirs.forEach((optionDir) => {
5050
const optionsBasePath = path.join(basePath, optionDir);
@@ -78,12 +78,51 @@ export function expectUrlsToEqual(
7878
});
7979
}
8080

81-
function getBasePath(key: string, outputFileStrategy: 'modules' | 'members') {
81+
export function getOutDir() {
82+
return path.join(process.cwd(), 'test', 'fixtures', 'out');
83+
}
84+
85+
export function expectDirToEqual(outDir: string) {
86+
const basePath = getPath(outDir);
87+
const rootDirectory = fs.readdirSync(path.join(basePath));
88+
const reduceDirectory = (
89+
basePath: string,
90+
baseDirectory: string,
91+
directory: string[],
92+
) => {
93+
return directory.reduce((prev: any, item) => {
94+
if (fs.lstatSync(`${basePath}/${item}`).isDirectory()) {
95+
const nestedDir = fs.readdirSync(`${basePath}/${item}`);
96+
return [
97+
...prev,
98+
...reduceDirectory(
99+
`${basePath}/${item}`,
100+
`${baseDirectory}/${item}`,
101+
nestedDir,
102+
),
103+
];
104+
}
105+
return [...prev, `${baseDirectory}/${item}`.replace(/^\/+/, '')];
106+
}, []);
107+
};
108+
const urls = reduceDirectory(basePath, '', rootDirectory);
109+
expect(urls).toMatchSnapshot(`dir: ${outDir}`);
110+
}
111+
112+
function getPath(dir: string) {
113+
return path.join(process.cwd(), 'test', 'fixtures', 'out', dir);
114+
}
115+
116+
function getOutputFileStrategyPath(
117+
key: string,
118+
outputFileStrategy: 'modules' | 'members',
119+
) {
82120
const basePath = path.join(
83121
process.cwd(),
84122
'test',
85123
'fixtures',
86124
'out',
125+
'md',
87126
key,
88127
outputFileStrategy,
89128
);

docs/content/docs/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 4.5.2
4+
5+
### Patch Changes
6+
7+
- Ensure all file paths use forward slashes in windows ([#782](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/782)).
8+
9+
## 4.5.1 (2025-03-18)
10+
11+
### Patch Changes
12+
13+
- Correctly handle package index paths ([#782](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/782)).
14+
- Make all options optional in PluginOptions interface ([#781](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/781)).
15+
316
## 4.5.0 (2025-03-16)
417

518
This release introduces support for [TypeDoc 0.28](https://github.com/TypeStrong/typedoc/blob/v0.28.0/CHANGELOG.md#v0280-2025-03-15) that contains several under-the-hood breaking API changes.

docs/content/docs/_meta.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ export default {
55
title: 'Getting Started',
66
},
77
'quick-start': '',
8+
'typedoc-options': '',
89
options: '',
910
'-- Guides': {
1011
type: 'separator',
1112
title: 'Guides',
1213
},
13-
'typedoc-usage': '',
1414
'output-file-structure': '',
1515
'customizing-output': '',
1616
'utilizing-navigation': '',
17+
'option-typings': '',
1718
'-- Support': {
1819
type: 'separator',
1920
title: 'Support',

docs/content/docs/option-typings.mdx

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Callout, FileTree } from 'nextra/components';
2+
3+
# Option Typings
4+
5+
You can inform your IDE about the shape of the exported options the plugin provides.
6+
7+
## JSON Files
8+
9+
You can utilize the provided JSON schema at https://typedoc-plugin-markdown.org/schema.json. For simplicity of configuration, this schema consolidates all options from TypeDoc and the plugin.
10+
11+
```json filename="typedoc.json"
12+
{
13+
"$schema": "https://typedoc-plugin-markdown.org/schema.json",
14+
"entryPoints": ["./src/index.ts", "./src/secondary-entry.ts"],
15+
"out": "docs",
16+
"plugin": ["typedoc-plugin-markdown", "some-other-plugin"],
17+
};
18+
```
19+
20+
## JavaScript Files
21+
22+
For JavaScript files, the `PluginOptions` interface can be imported to a `typedoc.config.js` file with a `@type` annotation.
23+
24+
You can use intersection types to combine the TypeDoc options with the plugin options.
25+
26+
```js filename="typedoc.config.cjs"
27+
// @ts-check
28+
29+
/** @type {import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions} */
30+
module.exports = {
31+
entryPoints: ['./src/index.ts', './src/secondary-entry.ts'],
32+
out: 'doc',
33+
plugin: ['typedoc-plugin-markdown', 'some-other-plugin'],
34+
};
35+
```

docs/content/docs/options/display-options.mdx

+48
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,51 @@ In addition you can control the alignment of the header text.
331331
}
332332
}
333333
```
334+
335+
## pageTitleTemplates
336+
337+
<Callout emoji="💡">Change specific text placeholders in the template.</Callout>
338+
339+
> Accepts a key/value object.
340+
341+
Customizes the page titles for index, module, and member pages in the documentation.
342+
343+
This option is provided as an object, with keys corresponding to the page types.
344+
345+
Each value can be either:
346+
347+
- A string supporting placeholders.
348+
- A function that receives input arguments.
349+
350+
Available placeholders / arguments:
351+
352+
- `{projectName}` – The project's name, resolved by TypeDoc.
353+
- `{version}` – The project version, resolved by TypeDoc (when `includeVersion` is `true`).
354+
- `{kind}` – The reflection kind of the item.
355+
- `{name}` – The name of the module or member.
356+
357+
Available keys:
358+
359+
- `index` – For the main documentation index page. Supports `projectName` and `version`.
360+
- `module` – For module and namespace pages. Supports `kind` and `name`.
361+
- `member` – For individual member pages. Supports `kind` and `name`.
362+
363+
Examples showing usage of both string (JS config) and function (JS/JSON config) values:
364+
365+
```js filename="typedoc.cjs"
366+
pageTitleTemplates: {
367+
index: (args) => `${args.projectName}: ${args.version}`,
368+
module: (args) => `${args.kind}: ${args.name}`,
369+
member: (args) => `${args.kind}: ${args.name}`,
370+
}
371+
```
372+
373+
```json filename="typedoc.json"
374+
{
375+
"pageTitleTemplates": {
376+
"index": "{projectName} {version}",
377+
"member": "{kind}: {name}",
378+
"module": "{name}"
379+
}
380+
}
381+
```

0 commit comments

Comments
 (0)