Skip to content

Commit 6cd267b

Browse files
committed
feat(core): typedoc 0.28 compatibility fixes and enhancements
1 parent 179a54c commit 6cd267b

File tree

248 files changed

+7124
-6453
lines changed

Some content is hidden

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

248 files changed

+7124
-6453
lines changed

.changeset/clear-eagles-taste.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'typedoc-plugin-markdown': minor
3+
---
4+
5+
- Implemented custom routers for plugin to support TypeDoc 0.28 router implementation.
6+
- Updated HTML anchors in headings and table rows to be unique, to avoid clashing with any auto generated ids.
7+
- Added "typeAliasPropertiesFormat" option to support TypeDoc 0.28 updated behaviour for Object literal type alias types.
8+
- The page header (if displayed) will contain separate links to Readme and index page (if applicable).

.changeset/config.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"ignore": [
1414
"@devtools/*",
1515
"typedoc-github-wiki-theme",
16-
"typedoc-gitlab-wiki-theme"
16+
"typedoc-gitlab-wiki-theme",
17+
"typedoc-vitepress-theme",
18+
"typedoc-plugin-frontmatter",
19+
"docusaurus-plugin-typedoc",
20+
"typedoc-plugin-remark"
1721
]
1822
}

.github/workflows/ci.docusaurus-plugin-typedoc.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/docusaurus-plugin-typedoc/README.md'
77
- '!packages/docusaurus-plugin-typedoc/CHANGELOG.md'
88
- '!packages/docusaurus-plugin-typedoc/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/docusaurus-plugin-typedoc/**'

.github/workflows/ci.typedoc-github-wiki-theme.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/typedoc-github-wiki-theme/README.md'
77
- '!packages/typedoc-github-wiki-theme/CHANGELOG.md'
88
- '!packages/typedoc-github-wiki-theme/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/typedoc-github-wiki-theme/**'

.github/workflows/ci.typedoc-gitlab-wiki-theme.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/typedoc-gitlab-wiki-theme/README.md'
77
- '!packages/typedoc-gitlab-wiki-theme/CHANGELOG.md'
88
- '!packages/typedoc-gitlab-wiki-theme/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/typedoc-gitlab-wiki-theme/**'

.github/workflows/ci.typedoc-plugin-frontmatter.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/typedoc-plugin-frontmatter/README.md'
77
- '!packages/typedoc-plugin-frontmatter/CHANGELOG.md'
88
- '!packages/typedoc-plugin-frontmatter/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/typedoc-plugin-frontmatter/**'

.github/workflows/ci.typedoc-plugin-remark.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/typedoc-plugin-remark/README.md'
77
- '!packages/typedoc-plugin-remark/CHANGELOG.md'
88
- '!packages/typedoc-plugin-remark/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/typedoc-plugin-remark/**'

.github/workflows/ci.typedoc-vitepress-theme.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '!packages/typedoc-vitepress-theme/README.md'
77
- '!packages/typedoc-vitepress-theme/CHANGELOG.md'
88
- '!packages/typedoc-vitepress-theme/package.json'
9+
branches:
10+
- main
11+
- release
12+
- beta
913
pull_request:
1014
paths:
1115
- 'packages/typedoc-vitepress-theme/**'

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
branches:
1111
- main
1212
- release
13+
- beta
1314
pull_request:
1415
paths:
1516
- 'packages/typedoc-plugin-markdown/**'

.gitignore

+4-14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
dist
55
.nyc_output/
66

7+
# yalc
8+
yalc.lock
9+
.yalc
10+
711
# testing
812
samples
913
typedoc-examples
@@ -15,27 +19,13 @@ html
1519
node_modules
1620

1721
# IDEs and editors
18-
/.idea
19-
.project
20-
.classpath
21-
.c9/
22-
*.launch
2322
.settings/
2423

2524
# misc
26-
/.sass-cache
27-
/connect.lock
28-
coverage
29-
/libpeerconnection.log
3025
npm-debug.log
31-
testem.log
3226
/typings
3327
.npmrc
3428

35-
# e2e
36-
/e2e/*.js
37-
/e2e/*.map
38-
3929
#System Files
4030
.DS_Store
4131
Thumbs.db

devtools/packages/helpers/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const DOCS_CONFIG: Record<string, DocsConfig> = {
88
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
99
translatablePath: `${process.cwd()}/src/internationalization/locales/en.ts`,
1010
optionsPath: '/docs',
11+
optionsFile: 'options/index.mdx',
1112
docsPath: '/docs',
1213
declarations: true,
1314
presets: false,

devtools/packages/helpers/models.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface DocsConfig {
33
translatablePath?: string;
44
presetsPath?: string;
55
optionsPath: string;
6+
optionsFile?: string;
67
docsPath: string;
78
declarations: boolean;
89
presets: boolean;

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

+13-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ export async function generateOptionsDocs(docsConfig: DocsConfig) {
1717
tsConfigFilePath: 'tsconfig.json',
1818
});
1919

20-
const outputPage: string[] = [`import { Callout } from 'nextra/components';`];
20+
const outputPage: string[] = [];
21+
22+
if (docsConfig.optionsFile === 'options/index.mdx')
23+
outputPage.push(`---
24+
asIndexPage: true
25+
---`);
26+
27+
outputPage.push(`import { Callout } from 'nextra/components';`);
2128

2229
outputPage.push('# Options');
2330
if (docsConfig.docsPath === '/docs') {
@@ -231,6 +238,7 @@ ${JSON.stringify(exampleJson, null, 2)}
231238
);
232239
const formattedOut = await prettier.format(out.join('\n\n'), {
233240
parser: 'mdx',
241+
singleQuote: true,
234242
});
235243
fs.writeFileSync(catDocPath, formattedOut);
236244
} else {
@@ -249,6 +257,7 @@ ${JSON.stringify(exampleJson, null, 2)}
249257
)}`,
250258
{
251259
parser: 'typescript',
260+
singleQuote: true,
252261
},
253262
);
254263

@@ -263,11 +272,12 @@ ${JSON.stringify(exampleJson, null, 2)}
263272

264273
const optionDocPath = path.join(
265274
getPagesPath(docsConfig.optionsPath),
266-
'options.mdx',
275+
docsConfig.optionsFile || 'options.mdx',
267276
);
268277

269278
const formattedOut = await prettier.format(outputPage.join('\n\n'), {
270279
parser: 'mdx',
280+
singleQuote: true,
271281
});
272282

273283
fs.writeFileSync(optionDocPath, formattedOut);
@@ -364,7 +374,7 @@ function getPagesPath(docsPath: string) {
364374
'..',
365375
'..',
366376
'docs',
367-
'pages',
377+
'content',
368378
);
369379
return path.join(pagesPath, docsPath);
370380
}

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

+6
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,24 @@ import { ManuallyValidatedOption } from 'typedoc';${docsConfig.optionsPath === '
6666
theme_default_value: [];
6767
theme_default_type: [];
6868
theme_description: [];
69+
theme_documentation: [];
70+
theme_category: [];
71+
theme_categories: [];
6972
theme_event: [];
7073
theme_re_exports: [];
7174
theme_renames_and_re_exports: [];
7275
theme_extends: [];
7376
theme_extended_by: [];
7477
theme_globals: [];
78+
theme_group: [];
79+
theme_groups: [];
7580
theme_member: [];
7681
theme_member_plural: [];
7782
theme_modifier: [];
7883
theme_name: [];
7984
theme_package: [];
8085
theme_packages: [];
86+
theme_readme: [];
8187
theme_type: [];
8288
theme_value: [];
8389
theme_version: [];

devtools/packages/testing/index.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import * as path from 'path';
33

44
export function expectFileToEqual(
55
key: string,
6-
outputFileStrategy: 'modules' | 'members' | ('modules' | 'members')[],
6+
outputFileStrategy:
7+
| 'modules'
8+
| 'members'
9+
| 'categories'
10+
| 'groups'
11+
| ('modules' | 'members')[],
712
file: string | string[],
813
limit?: number,
914
range?: Array<number>,
@@ -41,7 +46,7 @@ export function expectFileToEqual(
4146

4247
export function expectUrlsToEqual(
4348
outDir: string,
44-
outputFileStrategies: ('modules' | 'members')[],
49+
outputFileStrategies: ('members' | 'modules' | 'categories' | 'groups')[],
4550
) {
4651
outputFileStrategies.forEach((outputFileStrategy) => {
4752
const basePath = getBasePath(outDir, outputFileStrategy);
@@ -78,7 +83,10 @@ export function expectUrlsToEqual(
7883
});
7984
}
8085

81-
function getBasePath(key: string, outputFileStrategy: 'modules' | 'members') {
86+
function getBasePath(
87+
key: string,
88+
outputFileStrategy: 'modules' | 'members' | 'categories' | 'groups',
89+
) {
8290
const basePath = path.join(
8391
process.cwd(),
8492
'test',

docs/app/[[...mdxPath]]/page.jsx

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { generateStaticParamsFor, importPage } from 'nextra/pages';
2+
import * as path from 'path';
3+
import '../../globals.css';
4+
import { useMDXComponents as getMDXComponents } from '../../mdx-components';
5+
6+
export const generateStaticParams = generateStaticParamsFor('mdxPath');
7+
8+
export async function generateMetadata(props) {
9+
const params = await props.params;
10+
11+
const { metadata } = await importPage(params.mdxPath);
12+
13+
const titlePath = metadata.filePath
14+
.split(path.sep)
15+
.map((part) => part[0]?.toUpperCase() + part.substring(1))
16+
.slice(1, metadata.asIndexPage ? -2 : -1)
17+
.filter((part) => Boolean(part))
18+
.join(' • ');
19+
20+
const titleParts = [];
21+
if (titlePath) {
22+
titleParts.push(titlePath);
23+
}
24+
titleParts.push(metadata.title);
25+
const title = `typedoc-plugin-markdown • ${titleParts.join(' • ')}`;
26+
return {
27+
...metadata,
28+
title,
29+
};
30+
}
31+
32+
const Wrapper = getMDXComponents().wrapper;
33+
34+
export default async function Page(props) {
35+
const params = await props.params;
36+
const result = await importPage(params.mdxPath);
37+
const { default: MDXContent, toc, metadata } = result;
38+
return (
39+
<Wrapper toc={toc} metadata={metadata}>
40+
<MDXContent {...props} params={params} />
41+
</Wrapper>
42+
);
43+
}

docs/pages/_meta.js renamed to docs/app/_meta.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
breadcrumb: false,
88
sidebar: false,
99
footer: false,
10-
layout: 'raw',
10+
timestamp: false,
1111
},
1212
},
1313
docs: {

docs/app/layout.tsx

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { faMarkdown } from '@fortawesome/free-brands-svg-icons';
2+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3+
4+
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
5+
import 'nextra-theme-docs/style.css';
6+
import { Head } from 'nextra/components';
7+
import { getPageMap } from 'nextra/page-map';
8+
import '../globals.css';
9+
10+
export const metadata = {
11+
// Define your metadata here
12+
// For more information on metadata API, see: https://nextjs.org/docs/app/building-your-application/optimizing/metadata
13+
};
14+
15+
const navbar = (
16+
<Navbar
17+
logo={
18+
<div style={{ display: 'flex', alignItems: 'center' }}>
19+
<div style={{ width: '26px', height: '18px' }}>
20+
<FontAwesomeIcon
21+
icon={faMarkdown}
22+
width={'26px'}
23+
size="sm"
24+
style={{ width: '100%', height: '100%' }}
25+
/>
26+
</div>
27+
<div
28+
style={{
29+
marginLeft: '6px',
30+
fontSize: '14px',
31+
fontWeight: 'bold',
32+
}}
33+
>
34+
typedoc-plugin-markdown
35+
</div>
36+
</div>
37+
}
38+
projectLink="https://github.com/typedoc2md/typedoc-plugin-markdown"
39+
/>
40+
);
41+
const footer = <Footer></Footer>;
42+
43+
export default async function RootLayout({ children }) {
44+
return (
45+
<html lang="en" dir="ltr" suppressHydrationWarning>
46+
<Head>
47+
<link rel="icon" href="/logos/markdown-logo.svg" type="image/png" />
48+
</Head>
49+
<body>
50+
<Layout
51+
docsRepositoryBase="https://github.com/typedoc2md/typedoc-plugin-markdown/tree/main/docs"
52+
navbar={navbar}
53+
sidebar={{ defaultMenuCollapseLevel: 1 }}
54+
pageMap={await getPageMap()}
55+
footer={footer}
56+
editLink={''}
57+
feedback={{ content: '' }}
58+
>
59+
{children}
60+
</Layout>
61+
</body>
62+
</html>
63+
);
64+
}

docs/components/option-link.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import Link from 'next/link';
33
export const OptionLink = ({ type, name }) => {
44
return (
55
<Link
6-
href={`/docs/options/${type}-options#--${name.toLowerCase()}`}
6+
href={`/docs/options/${type}-options#${name.toLowerCase()}`}
77
className="whitespace-nowrap _text-primary-600 _underline _decoration-from-font [text-underline-position:from-font]"
88
>
9-
<code class="nextra-code">--{name}</code>
9+
<code class="nextra-code">{name}</code>
1010
</Link>
1111
);
1212
};

0 commit comments

Comments
 (0)