diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 177b5d31..6c68662f 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -23,7 +23,11 @@ const typeDocConfig = { parametersFormat: 'htmlTable', propertyMembersFormat: 'htmlTable', disableSources: true, - plugin: ['typedoc-plugin-zod'], + plugin: [ + 'typedoc-plugin-zod', + 'typedoc-plugin-frontmatter', + './src/plugins/typedoc-frontmatter.js', + ], }; const plugins = [ diff --git a/docs/package.json b/docs/package.json index 26e9c84b..e6acfc5c 100644 --- a/docs/package.json +++ b/docs/package.json @@ -25,6 +25,7 @@ "devDependencies": { "tailwindcss": "^3.3.3", "tsx": "^4.19.4", + "typedoc-plugin-frontmatter": "^1.3.0", "typedoc-plugin-zod": "^1.4.1" } } diff --git a/docs/src/plugins/typedoc-frontmatter.js b/docs/src/plugins/typedoc-frontmatter.js new file mode 100644 index 00000000..3c04a279 --- /dev/null +++ b/docs/src/plugins/typedoc-frontmatter.js @@ -0,0 +1,16 @@ +import { MarkdownPageEvent } from 'typedoc-plugin-markdown'; + +/** @param {import('typedoc-plugin-markdown').MarkdownApplication} app */ +export function load(app) { + app.renderer.on(MarkdownPageEvent.BEGIN, (page) => { + // page.frontmatter が undefined の場合でも確実に title を入れる + page.frontmatter = { + ...page.frontmatter, + title: + page.frontmatter?.title || + page.title || + page.url?.split('/').pop() || + undefined, + }; + }); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfe0b6a1..a0fad770 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -111,6 +111,9 @@ importers: tsx: specifier: ^4.19.4 version: 4.20.1 + typedoc-plugin-frontmatter: + specifier: ^1.3.0 + version: 1.3.0(typedoc-plugin-markdown@4.8.1(typedoc@0.28.5(typescript@5.8.3))) typedoc-plugin-zod: specifier: ^1.4.1 version: 1.4.1(typedoc@0.28.5(typescript@5.8.3)) @@ -5964,6 +5967,11 @@ packages: resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==} engines: {node: '>= 0.6'} + typedoc-plugin-frontmatter@1.3.0: + resolution: {integrity: sha512-xYQFMAecMlsRUjmf9oM/Sq2FVz4zlgcbIeVFNLdO118CHTN06gIKJNSlyExh9+Xl8sK0YhIvoQwViUURxritWA==} + peerDependencies: + typedoc-plugin-markdown: '>=4.5.0' + typedoc-plugin-markdown@4.8.1: resolution: {integrity: sha512-ug7fc4j0SiJxSwBGLncpSo8tLvrT9VONvPUQqQDTKPxCoFQBADLli832RGPtj6sfSVJebNSrHZQRUdEryYH/7g==} engines: {node: '>= 18'} @@ -12599,6 +12607,11 @@ snapshots: media-typer: 1.1.0 mime-types: 3.0.1 + typedoc-plugin-frontmatter@1.3.0(typedoc-plugin-markdown@4.8.1(typedoc@0.28.5(typescript@5.8.3))): + dependencies: + typedoc-plugin-markdown: 4.8.1(typedoc@0.28.5(typescript@5.8.3)) + yaml: 2.7.1 + typedoc-plugin-markdown@4.8.1(typedoc@0.28.5(typescript@5.8.3)): dependencies: typedoc: 0.28.5(typescript@5.8.3)