diff --git a/example/package.json b/example/package.json index 1512ccb..9a1b1a7 100644 --- a/example/package.json +++ b/example/package.json @@ -21,7 +21,7 @@ "sharp": "0.32.5", "starlight-typedoc": "workspace:*", "typedoc": "0.25", - "typedoc-plugin-markdown": "4.0.0-next.20", + "typedoc-plugin-markdown": "4.0.0-next.21", "typedoc-plugin-mdn-links": "3.0.3" }, "engines": { diff --git a/example/src/content/docs/guides/getting-started.mdx b/example/src/content/docs/guides/getting-started.mdx index ec84767..d41f928 100644 --- a/example/src/content/docs/guides/getting-started.mdx +++ b/example/src/content/docs/guides/getting-started.mdx @@ -47,7 +47,7 @@ ni starlight-typedoc typedoc typedoc-plugin-markdown@next :::note -The Starlight TypeDoc package requires at least the version `4.0.0-next.20` of `typedoc-plugin-markdown`, hence the `@next` tag in the installation command. +The Starlight TypeDoc package requires at least the version `4.0.0-next.21` of `typedoc-plugin-markdown`, hence the `@next` tag in the installation command. ::: Update your [Astro configuration](https://docs.astro.build/en/guides/configuring-astro/#supported-config-file-types) to generate documentation from your TypeScript code: diff --git a/example/src/content/docs/index.mdx b/example/src/content/docs/index.mdx index 7e20f3a..1f5d680 100644 --- a/example/src/content/docs/index.mdx +++ b/example/src/content/docs/index.mdx @@ -8,7 +8,7 @@ hero: file: ../../assets/houston.webp actions: - text: Check Example - link: /api/functions/functiondothingc/ + link: /api/functions/dothingc/ icon: right-arrow variant: primary - text: Getting Started diff --git a/packages/starlight-typedoc/package.json b/packages/starlight-typedoc/package.json index be6f7c8..3c44c18 100644 --- a/packages/starlight-typedoc/package.json +++ b/packages/starlight-typedoc/package.json @@ -47,7 +47,7 @@ "@astrojs/starlight": ">=0.9.0", "astro": ">=3.0.0", "typedoc": ">=0.25.0", - "typedoc-plugin-markdown": ">=4.0.0-next.20" + "typedoc-plugin-markdown": ">=4.0.0-next.21" }, "engines": { "node": ">=18.14.1" diff --git a/packages/starlight-typedoc/src/libs/typedoc.ts b/packages/starlight-typedoc/src/libs/typedoc.ts index c4698d2..177c9cd 100644 --- a/packages/starlight-typedoc/src/libs/typedoc.ts +++ b/packages/starlight-typedoc/src/libs/typedoc.ts @@ -26,7 +26,6 @@ const markdownPluginConfig: TypeDocConfig = { hideInPageTOC: true, hidePageHeader: true, hidePageTitle: true, - skipIndexPage: true, } export async function bootstrapApp( diff --git a/packages/starlight-typedoc/tests/e2e/asides.test.ts b/packages/starlight-typedoc/tests/e2e/asides.test.ts index 283b4fa..85ea0e5 100644 --- a/packages/starlight-typedoc/tests/e2e/asides.test.ts +++ b/packages/starlight-typedoc/tests/e2e/asides.test.ts @@ -2,7 +2,7 @@ import type { DocPage } from './fixtures/DocPage' import { expect, test } from './test' test('should use an aside for the deprecated tag with no content', async ({ docPage }) => { - await docPage.goto('functions/functiondothingb') + await docPage.goto('functions/dothingb') const name = 'Deprecated' const { aside, title, content } = await getAside(docPage, name) @@ -13,7 +13,7 @@ test('should use an aside for the deprecated tag with no content', async ({ docP }) test('should use an aside for the deprecated tag with custom content', async ({ docPage }) => { - await docPage.goto('functions/functiondothingc') + await docPage.goto('functions/dothingc') const name = 'Deprecated' const { aside, title, content } = await getAside(docPage, name) @@ -24,9 +24,9 @@ test('should use an aside for the deprecated tag with custom content', async ({ }) const releaseStageCases: [releaseStage: string, url: string][] = [ - ['Alpha', 'classes/classbar'], - ['Beta', 'variables/variableanobject'], - ['Experimental', 'interfaces/interfacething'], + ['Alpha', 'classes/bar'], + ['Beta', 'variables/anobject'], + ['Experimental', 'interfaces/thing'], ] for (const [releaseStage, url] of releaseStageCases) { diff --git a/packages/starlight-typedoc/tests/e2e/content.test.ts b/packages/starlight-typedoc/tests/e2e/content.test.ts index 70cf6f3..ebe722d 100644 --- a/packages/starlight-typedoc/tests/e2e/content.test.ts +++ b/packages/starlight-typedoc/tests/e2e/content.test.ts @@ -1,11 +1,11 @@ import { expect, test } from './test' test('should add titles to the frontmatter', async ({ docPage }) => { - await docPage.goto('classes/classfoo') + await docPage.goto('classes/foo') expect(docPage.title).toBe('Foo') - await docPage.goto('functions/functiondothinga') + await docPage.goto('functions/dothinga') expect(docPage.title).toBe('doThingA') }) @@ -31,25 +31,25 @@ test('should properly format links for multiple entry points', async ({ docPage }) test('should properly format links with anchors for a single entry point', async ({ docPage }) => { - await docPage.goto('classes/classfoo') + await docPage.goto('classes/foo') const barConstructorLinkHref = await docPage.content .getByRole('link', { exact: true, name: 'constructor' }) .getAttribute('href') - expect(barConstructorLinkHref).toEqual('/api/classes/classbar/#constructor') + expect(barConstructorLinkHref).toEqual('/api/classes/bar/#constructors') }) test('should properly format links with anchors for multiple entry points', async ({ docPage }) => { docPage.useMultipleEntryPoints() - await docPage.goto('foo/classes/classfoo') + await docPage.goto('foo/classes/foo') const barConstructorLinkHref = await docPage.content .getByRole('link', { exact: true, name: 'constructor' }) .getAttribute('href') - expect(barConstructorLinkHref).toEqual('/api-multiple-entrypoints/bar/classes/classbar/#constructor') + expect(barConstructorLinkHref).toEqual('/api-multiple-entrypoints/bar/classes/bar/#constructors') }) test('should disable edit links', async ({ docPage }) => { @@ -63,7 +63,7 @@ test('should disable edit links', async ({ docPage }) => { }) test('should support TypeDoc plugins', async ({ docPage }) => { - await docPage.goto('classes/classfoo') + await docPage.goto('classes/foo') const mdnLink = docPage.page.getByRole('link', { exact: true, name: 'HTMLElement' }) @@ -75,8 +75,8 @@ test('should support TypeDoc plugins', async ({ docPage }) => { }) test('should properly format links in summary', async ({ docPage }) => { - await docPage.goto('functions/functiondothingfaster') + await docPage.goto('functions/dothingfaster') await docPage.content.getByRole('link', { exact: true, name: 'doThingB' }).click() - await docPage.page.waitForURL('**/api/functions/functiondothingb/') + await docPage.page.waitForURL('**/api/functions/dothingb/') }) diff --git a/packages/starlight-typedoc/tests/e2e/pagination.test.ts b/packages/starlight-typedoc/tests/e2e/pagination.test.ts index b69633a..3839d2f 100644 --- a/packages/starlight-typedoc/tests/e2e/pagination.test.ts +++ b/packages/starlight-typedoc/tests/e2e/pagination.test.ts @@ -2,7 +2,7 @@ import type { DocPage } from './fixtures/DocPage' import { expect, test } from './test' test('should not include pagination links by default', async ({ docPage }) => { - await docPage.goto('classes/classfoo') + await docPage.goto('classes/foo') const { next, prev } = getPrevNext(docPage) @@ -13,7 +13,7 @@ test('should not include pagination links by default', async ({ docPage }) => { test('should not include pagination links if configured to do so', async ({ docPage }) => { docPage.useMultipleEntryPoints() - await docPage.goto('bar/classes/classbar') + await docPage.goto('bar/classes/bar') const { next, prev } = getPrevNext(docPage) diff --git a/packages/starlight-typedoc/tests/e2e/sidebar.test.ts b/packages/starlight-typedoc/tests/e2e/sidebar.test.ts index 94dc495..99d789b 100644 --- a/packages/starlight-typedoc/tests/e2e/sidebar.test.ts +++ b/packages/starlight-typedoc/tests/e2e/sidebar.test.ts @@ -1,7 +1,7 @@ import { expect, test } from './test' -const singleEntrypointUrl = 'classes/classfoo' -const multipleEntrypointsUrl = 'bar/classes/classbar' +const singleEntrypointUrl = 'classes/foo' +const multipleEntrypointsUrl = 'bar/classes/bar' test('should include the TypeDoc sidebar group for a single entry point', async ({ docPage }) => { await docPage.goto(singleEntrypointUrl) diff --git a/packages/starlight-typedoc/tests/unit/typedoc.test.ts b/packages/starlight-typedoc/tests/unit/typedoc.test.ts index c1915da..d736e10 100644 --- a/packages/starlight-typedoc/tests/unit/typedoc.test.ts +++ b/packages/starlight-typedoc/tests/unit/typedoc.test.ts @@ -89,7 +89,7 @@ test('should not add `README.md` module files for multiple entry points', async const filePaths = writeFileSyncSpy.mock.calls.map((call) => call[0].toString()) expect(writeFileSyncSpy).toHaveBeenCalled() - expect(filePaths.some((filePath) => filePath.endsWith('README.md'))).toBe(false) + expect(filePaths.some((filePath) => /\/(?:Bar|Foo)\/README\.md$/.test(filePath))).toBe(false) }) test('should support overriding typedoc-plugin-markdown readme and index page generation', async () => { @@ -98,7 +98,6 @@ test('should support overriding typedoc-plugin-markdown readme and index page ge typeDoc: { ...starlightTypeDocOptions.typeDoc, readme: 'README.md', - skipIndexPage: false, }, entryPoints: ['../../fixtures/src/Bar.ts', '../../fixtures/src/Foo.ts'], }) @@ -117,8 +116,6 @@ test('should output modules with index', async () => { ...starlightTypeDocOptions.typeDoc, outputFileStrategy: 'modules', entryFileName: 'index.md', - skipIndexPage: false, - flattenOutputFiles: true, }, entryPoints: ['../../fixtures/src/module.ts'], }) @@ -128,11 +125,11 @@ test('should output modules with index', async () => { expect(filePaths).toEqual([ expect.stringMatching(/index\.md$/), - expect.stringMatching(/Namespace\.bar\.md$/), - expect.stringMatching(/Namespace\.foo\.md$/), - expect.stringMatching(/Namespace\.functions\.md$/), - expect.stringMatching(/Namespace\.shared\.md$/), - expect.stringMatching(/Namespace\.types\.md$/), + expect.stringMatching(/namespaces\/bar\.md$/), + expect.stringMatching(/namespaces\/foo\.md$/), + expect.stringMatching(/namespaces\/functions\.md$/), + expect.stringMatching(/namespaces\/shared\.md$/), + expect.stringMatching(/namespaces\/types\.md$/), ]) }) @@ -143,8 +140,6 @@ test('should output index with correct module path', async () => { ...starlightTypeDocOptions.typeDoc, outputFileStrategy: 'modules', entryFileName: 'index.md', - skipIndexPage: false, - flattenOutputFiles: true, }, entryPoints: ['../../fixtures/src/module.ts'], }) @@ -157,10 +152,10 @@ test('should output index with correct module path', async () => { expect( content.includes(` -- [bar](/api/namespacebar/) -- [foo](/api/namespacefoo/) -- [functions](/api/namespacefunctions/) -- [shared](/api/namespaceshared/) -- [types](/api/namespacetypes/)`), +- [bar](/api/namespaces/bar/) +- [foo](/api/namespaces/foo/) +- [functions](/api/namespaces/functions/) +- [shared](/api/namespaces/shared/) +- [types](/api/namespaces/types/)`), ).toBe(true) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 745644b..79776d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,8 +51,8 @@ importers: specifier: '0.25' version: 0.25.0(typescript@5.1.6) typedoc-plugin-markdown: - specifier: 4.0.0-next.20 - version: 4.0.0-next.20(typedoc@0.25.0) + specifier: 4.0.0-next.21 + version: 4.0.0-next.21(typedoc@0.25.0) typedoc-plugin-mdn-links: specifier: 3.0.3 version: 3.0.3(typedoc@0.25.0) @@ -75,8 +75,8 @@ importers: specifier: '>=0.25.0' version: 0.25.0(typescript@5.1.6) typedoc-plugin-markdown: - specifier: '>=4.0.0-next.20' - version: 4.0.0-next.20(typedoc@0.25.0) + specifier: '>=4.0.0-next.21' + version: 4.0.0-next.21(typedoc@0.25.0) devDependencies: '@astrojs/starlight': specifier: 0.9.0 @@ -6372,10 +6372,10 @@ packages: is-typed-array: 1.1.12 dev: true - /typedoc-plugin-markdown@4.0.0-next.20(typedoc@0.25.0): - resolution: {integrity: sha512-mQoLUSk6KLPMv1zpcTk43h8+8aD+T65qPh99/umSsczd1yTOyZiA0h0kAlsrZrAM8SWoJEn/fZWgV3JMR3Bb4Q==} + /typedoc-plugin-markdown@4.0.0-next.21(typedoc@0.25.0): + resolution: {integrity: sha512-Fvk4TTjLTwS5hsKmrT1YvdM6T2ljL2Mj8NISg9UhbNXYb3pY1ucFE4w66u2ntqadElWqsCsWLLemX3FMeykTkw==} peerDependencies: - typedoc: '>=0.24.0' + typedoc: '>=0.25.0' dependencies: typedoc: 0.25.0(typescript@5.1.6) dev: false