diff --git a/devtools/packages/fixtures/typedoc.cjs b/devtools/packages/fixtures/typedoc.cjs index 3b9925aa..a0131261 100644 --- a/devtools/packages/fixtures/typedoc.cjs +++ b/devtools/packages/fixtures/typedoc.cjs @@ -15,4 +15,9 @@ module.exports = { navigation: { includeGroups: true, }, + locales: { + en: { + theme_defined_in: 'Source', + }, + }, }; diff --git a/devtools/packages/prebuild-options/tasks/generate-docs.ts b/devtools/packages/prebuild-options/tasks/generate-docs.ts index e576165c..efd04f2d 100644 --- a/devtools/packages/prebuild-options/tasks/generate-docs.ts +++ b/devtools/packages/prebuild-options/tasks/generate-docs.ts @@ -306,6 +306,9 @@ function getDefaultValue(option) { if (option.type === ParameterType.Mixed) { return JSON.stringify(option.defaultValue); } + if (option.type === ParameterType.Object) { + return JSON.stringify(option.defaultValue); + } return `"${option.defaultValue}"`; } diff --git a/devtools/packages/prebuild-options/tasks/generate-models.ts b/devtools/packages/prebuild-options/tasks/generate-models.ts index 99826338..ee21e189 100644 --- a/devtools/packages/prebuild-options/tasks/generate-models.ts +++ b/devtools/packages/prebuild-options/tasks/generate-models.ts @@ -78,9 +78,12 @@ async function writeOptionsTypes( option.type === ParameterType.Mixed && option.defaultValue, ); - const optionsOutput = ` - // THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY. + const optionsOutput: string[] = [ + `// THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY. +`, + ]; + optionsOutput.push(` /** * Describes the options declared by the plugin. * @@ -117,14 +120,25 @@ ${name}: ${getType(name, option, true)};`, `; }) .join('\n')} - `; + `); + + if (docsConfig.translatablePath) { + const { translatable } = await import(docsConfig.translatablePath); + optionsOutput.push( + ` +/** +* @category Options +*/ +export interface TranslatableStrings ${getTranslations(translatable)}`, + ); + } const optionsModelFile = path.join( path.dirname(docsConfig.declarationsPath as string), 'option-types.ts', ); - const formatted = await prettier.format(optionsOutput, { + const formatted = await prettier.format(optionsOutput.join('\n\n'), { parser: 'typescript', singleQuote: true, trailingComma: 'all', @@ -208,6 +222,19 @@ function getType( .map((value) => `"${value}"`) .join(' | ')}`; } + if (option.type === ParameterType.Object) { + const outType = `{${Object.keys(option.defaultValue as any) + .map((key) => `'${key}': ${getObjectType(name)};`) + .join('')}}`; + return isInterface ? outType : `ManuallyValidatedOption<${outType}>`; + } + return 'any'; +} + +function getObjectType(name: string) { + if (name === 'reflectionFormats') { + return "'list'|'table'|'htmlTable'"; + } return 'any'; } diff --git a/docs/pages/api-docs/Class.MarkdownPageEvent.md b/docs/pages/api-docs/Class.MarkdownPageEvent.md index 553fa0bc..66d0eb35 100644 --- a/docs/pages/api-docs/Class.MarkdownPageEvent.md +++ b/docs/pages/api-docs/Class.MarkdownPageEvent.md @@ -20,41 +20,52 @@ export function load(app: MarkdownApplication) { ### project -> **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) +```ts +project: ProjectReflection; +``` -The project the renderer is currently processing. +The [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) instance the renderer is currently processing. *** ### model -> `readonly` **model**: `Model` +```ts +readonly model: Model; +``` -The model that should be rendered on this page. +The model that that is being rendered on this page. +Either a [`DeclarationReflection`](https://typedoc.org/api/classes/Models.DeclarationReflection.html) or [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html). *** ### url -> **url**: `string` +```ts +url: string; +``` -The url this page will be located at. +The url `string` of the page. *** ### filename -> **filename**: `string` +```ts +filename: string; +``` -The filename the page will be written to. +The complete `string` filename where the file will be written.. *** ### contents? -> `optional` **contents**: `string` +```ts +optional contents: string; +``` -The final markdown content of this page. +The final markdown `string` content of the page. Should be rendered by layout templates and can be modified by plugins. @@ -62,7 +73,9 @@ Should be rendered by layout templates and can be modified by plugins. ### frontmatter? -> `optional` **frontmatter**: `Record`\<`string`, `any`\> +```ts +optional frontmatter: Record; +``` The frontmatter of this page represented as a key value object. This property can be utilised by other plugins. @@ -70,7 +83,9 @@ The frontmatter of this page represented as a key value object. This property ca ### BEGIN -> `static` `readonly` **BEGIN**: `"beginPage"` = `'beginPage'` +```ts +static readonly BEGIN: "beginPage" = 'beginPage'; +``` Triggered before a document will be rendered. @@ -78,6 +93,8 @@ Triggered before a document will be rendered. ### END -> `static` `readonly` **END**: `"endPage"` = `'endPage'` +```ts +static readonly END: "endPage" = 'endPage'; +``` Triggered after a document has been rendered, just before it is written to disc. diff --git a/docs/pages/api-docs/Class.MarkdownRendererEvent.md b/docs/pages/api-docs/Class.MarkdownRendererEvent.md index be21c500..0ffa4752 100644 --- a/docs/pages/api-docs/Class.MarkdownRendererEvent.md +++ b/docs/pages/api-docs/Class.MarkdownRendererEvent.md @@ -18,7 +18,9 @@ app.renderer.on(MarkdownRendererEvent.BEGIN, (event) => { ### project -> `readonly` **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) +```ts +readonly project: ProjectReflection; +``` The project the renderer is currently processing. @@ -26,7 +28,9 @@ The project the renderer is currently processing. ### outputDirectory -> `readonly` **outputDirectory**: `string` +```ts +readonly outputDirectory: string; +``` The path of the directory the documentation should be written to. @@ -34,7 +38,9 @@ The path of the directory the documentation should be written to. ### urls? -> `optional` **urls**: [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[] +```ts +optional urls: UrlMapping[]; +``` A list of all pages that should be generated. @@ -42,7 +48,9 @@ A list of all pages that should be generated. ### navigation? -> `optional` **navigation**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +optional navigation: NavigationItem[]; +``` The navigation structure of the project that can be utilised by plugins. @@ -50,7 +58,9 @@ The navigation structure of the project that can be utilised by plugins. ### BEGIN -> `static` `readonly` **BEGIN**: `"beginRender"` = `'beginRender'` +```ts +static readonly BEGIN: "beginRender" = 'beginRender'; +``` Triggered before the renderer starts rendering a project. @@ -58,6 +68,8 @@ Triggered before the renderer starts rendering a project. ### END -> `static` `readonly` **END**: `"endRender"` = `'endRender'` +```ts +static readonly END: "endRender" = 'endRender'; +``` Triggered after the renderer has written all documents. diff --git a/docs/pages/api-docs/Class.MarkdownTheme.md b/docs/pages/api-docs/Class.MarkdownTheme.md index 8855ff51..853e204f 100644 --- a/docs/pages/api-docs/Class.MarkdownTheme.md +++ b/docs/pages/api-docs/Class.MarkdownTheme.md @@ -24,11 +24,37 @@ class MyMarkdownTheme extends MarkdownTheme { - [`Theme`](https://typedoc.org/api/classes/Theme.html) +## Constructors + +### new MarkdownTheme() + +```ts +new MarkdownTheme(renderer): MarkdownTheme +``` + +Create a new BaseTheme instance. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `renderer` | [`Renderer`](https://typedoc.org/api/classes/Renderer.html) | The renderer this theme is attached to. | + +#### Returns + +[`MarkdownTheme`](/api-docs/Class.MarkdownTheme.md) + +#### Inherited from + +`Theme.constructor` + ## Methods ### getRenderContext() -> **getRenderContext**(`page`): [`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md) +```ts +getRenderContext(page): MarkdownThemeContext +``` Creates a new instance of the current theme context. @@ -48,7 +74,9 @@ This method can be overridden to provide an alternative theme context. ### getUrls() -> **getUrls**(`project`): [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[] +```ts +getUrls(project): UrlMapping[] +``` Maps the models of the given project to the desired output files. @@ -72,7 +100,9 @@ This method can be overriden to provide an alternative url structure. ### getNavigation() -> **getNavigation**(`project`): [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +getNavigation(project): NavigationItem[] +``` Map the models of the given project to a navigation structure. diff --git a/docs/pages/api-docs/Class.MarkdownThemeContext.md b/docs/pages/api-docs/Class.MarkdownThemeContext.md index 747790ce..97617d1f 100644 --- a/docs/pages/api-docs/Class.MarkdownThemeContext.md +++ b/docs/pages/api-docs/Class.MarkdownThemeContext.md @@ -20,7 +20,12 @@ class MyMarkdownTheme extends MarkdownTheme { ### new MarkdownThemeContext() -> **new MarkdownThemeContext**(`theme`, `page`, `options`): [`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md) +```ts +new MarkdownThemeContext( + theme, + page, + options): MarkdownThemeContext +``` #### Parameters @@ -40,19 +45,25 @@ Properties are passed into the constructor and are used to provide context to th ### internationalization -> **internationalization**: `Internationalization` +```ts +internationalization: Internationalization; +``` *** ### i18n -> **i18n**: `TranslationProxy` +```ts +i18n: TranslationProxy; +``` *** ### page -> `readonly` **page**: [`MarkdownPageEvent`](/api-docs/Class.MarkdownPageEvent.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\> +```ts +readonly page: MarkdownPageEvent; +``` The current page event. @@ -60,7 +71,9 @@ The current page event. ### options -> `readonly` **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html) +```ts +readonly options: Options; +``` The options provided to the application. @@ -70,7 +83,9 @@ General context aware helper methods not bound to any specific models that can b ### getPackageMetaData() -> **getPackageMetaData**(`packageName`): [`PackageMetaData`](/api-docs/Interface.PackageMetaData.md) +```ts +getPackageMetaData(packageName): PackageMetaData +``` Returns the package meta data for a given package name when entrypointStrategy is set to `packages`. @@ -88,7 +103,9 @@ Returns the package meta data for a given package name when entrypointStrategy i ### getRelativeUrl() -> **getRelativeUrl**(`url`, `ignorePublicPath`): `string` +```ts +getRelativeUrl(url, ignorePublicPath): string +``` Returns the relative URL (from the current page context url). @@ -96,10 +113,10 @@ If public path is set, it will be used as the base URL. #### Parameters -| Parameter | Type | Default Value | Description | -| :------ | :------ | :------ | :------ | -| `url` | `string` | `undefined` | The URL to make relative. | -| `ignorePublicPath` | `boolean` | `false` | Whether to ignore the public path. | +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `url` | `string` | The URL to make relative. | +| `ignorePublicPath` | `boolean` | Whether to ignore the public path. | #### Returns @@ -111,7 +128,14 @@ Theme resources are the main building blocks for the theme context. They are spl ### templates -> **templates**: `object` +```ts +templates: { + document: (page) => string; + project: (page) => string; + readme: (page) => string; + reflection: (page) => string; +}; +``` Then `templates` namespace holds the main templates for the theme and are mapped to single pages and configured in the MarkdownTheme. @@ -119,7 +143,9 @@ All templates return a string that is passed back to the renderer. Internally te #### document() -> **document**: (`page`) => `string` +```ts +document: (page) => string; +``` Template that maps to a project document. @@ -135,7 +161,9 @@ Template that maps to a project document. #### project() -> **project**: (`page`) => `string` +```ts +project: (page) => string; +``` Template that maps to the root project reflection. This will be the index page / documentation root page. @@ -151,7 +179,9 @@ Template that maps to the root project reflection. This will be the index page / #### readme() -> **readme**: (`page`) => `string` +```ts +readme: (page) => string; +``` Template that specifically maps to the resolved readme file. This template is not used when 'readme' is set to 'none'. @@ -167,7 +197,9 @@ Template that specifically maps to the resolved readme file. This template is no #### reflection() -> **reflection**: (`page`) => `string` +```ts +reflection: (page) => string; +``` Template that maps to individual reflection models. @@ -185,7 +217,71 @@ Template that maps to individual reflection models. ### partials -> **partials**: `object` +```ts +partials: { + comment: (model, options) => string; + commentParts: (model) => string; + body: (model, options) => string; + categories: (model, options) => string; + groups: (model, options) => string; + members: (model, options) => string; + accessor: (model, options) => string; + constructor: (model, options) => string; + memberContainer: (model, options) => string; + declaration: (model, options) => string; + declarationTitle: (model) => string; + documents: (model, options) => string; + enumMembersTable: (model) => string; + hierarchy: (model, options) => string; + indexSignature: (model) => string; + inheritance: (model, options) => string; + memberTitle: (model) => string; + memberWithGroups: (model, options) => string; + parametersList: (model) => string; + parametersTable: (model) => string; + propertiesTable: (model, options?) => string; + referenceMember: (model) => string; + reflectionFlags: (model) => string; + reflectionIndex: (model, options) => string; + signature: (model, options) => string; + signatureParameters: (model) => string; + signatureReturns: (model, options) => string; + signatureTitle: (model, options?) => string; + signatures: (model, options) => string; + sources: (model, options) => string; + member: (model, options) => string; + typeAndParent: (model) => string; + typeArguments: (model, options?) => string; + typeDeclaration: (model, options) => string; + typeDeclarationList: (model, headingLevel) => string; + typeDeclarationTable: (model) => string; + typeParametersList: (model) => string; + typeParametersTable: (model) => string; + breadcrumbs: () => string; + footer: () => string; + header: () => string; + packagesIndex: (model) => string; + pageTitle: () => string; + arrayType: (model) => string; + conditionalType: (model) => string; + indexAccessType: (model) => string; + inferredType: (model) => string; + intersectionType: (model) => string; + intrinsicType: (model) => string; + literalType: (model) => string; + namedTupleType: (model) => string; + queryType: (model) => string; + referenceType: (model) => string; + declarationType: (model) => string; + functionType: (model, options?) => string; + reflectionType: (model, options?) => string; + someType: (model?) => string; + tupleType: (model) => string; + typeOperatorType: (model) => string; + unionType: (model) => string; + unknownType: (model) => string; +}; +``` The `partials` namespace holds the partials for the theme and are used by templates to map speficic models to page output. @@ -207,7 +303,9 @@ Partials are categorised by their use: ##### breadcrumbs() -> **breadcrumbs**: () => `string` +```ts +breadcrumbs: () => string; +``` ###### Returns @@ -215,7 +313,9 @@ Partials are categorised by their use: ##### footer() -> **footer**: () => `string` +```ts +footer: () => string; +``` ###### Returns @@ -223,7 +323,9 @@ Partials are categorised by their use: ##### header() -> **header**: () => `string` +```ts +header: () => string; +``` ###### Returns @@ -231,7 +333,9 @@ Partials are categorised by their use: ##### packagesIndex() -> **packagesIndex**: (`model`) => `string` +```ts +packagesIndex: (model) => string; +``` ###### Parameters @@ -245,7 +349,9 @@ Partials are categorised by their use: ##### pageTitle() -> **pageTitle**: () => `string` +```ts +pageTitle: () => string; +``` ###### Returns @@ -255,7 +361,9 @@ Partials are categorised by their use: ##### body() -> **body**: (`model`, `options`) => `string` +```ts +body: (model, options) => string; +``` ###### Parameters @@ -271,7 +379,9 @@ Partials are categorised by their use: ##### categories() -> **categories**: (`model`, `options`) => `string` +```ts +categories: (model, options) => string; +``` Renders a collection of reflection categories. @@ -289,7 +399,9 @@ Renders a collection of reflection categories. ##### groups() -> **groups**: (`model`, `options`) => `string` +```ts +groups: (model, options) => string; +``` Renders a collection of reflection groups. @@ -307,7 +419,9 @@ Renders a collection of reflection groups. ##### members() -> **members**: (`model`, `options`) => `string` +```ts +members: (model, options) => string; +``` Renders a collection of members. @@ -327,7 +441,9 @@ Renders a collection of members. ##### accessor() -> **accessor**: (`model`, `options`) => `string` +```ts +accessor: (model, options) => string; +``` Renders an accessor member. @@ -345,7 +461,9 @@ Renders an accessor member. ##### constructor() -> **constructor**: (`model`, `options`) => `string` +```ts +constructor: (model, options) => string; +``` Renders an constructor member. @@ -363,7 +481,9 @@ Renders an constructor member. ##### memberContainer() -> **memberContainer**: (`model`, `options`) => `string` +```ts +memberContainer: (model, options) => string; +``` ###### Parameters @@ -380,7 +500,9 @@ Renders an constructor member. ##### declaration() -> **declaration**: (`model`, `options`) => `string` +```ts +declaration: (model, options) => string; +``` Renders a standard declaration member. @@ -399,7 +521,9 @@ Renders a standard declaration member. ##### declarationTitle() -> **declarationTitle**: (`model`) => `string` +```ts +declarationTitle: (model) => string; +``` ###### Parameters @@ -413,7 +537,9 @@ Renders a standard declaration member. ##### documents() -> **documents**: (`model`, `options`) => `string` +```ts +documents: (model, options) => string; +``` ###### Parameters @@ -429,7 +555,9 @@ Renders a standard declaration member. ##### enumMembersTable() -> **enumMembersTable**: (`model`) => `string` +```ts +enumMembersTable: (model) => string; +``` Renders enum members as a table. @@ -445,7 +573,9 @@ Renders enum members as a table. ##### hierarchy() -> **hierarchy**: (`model`, `options`) => `string` +```ts +hierarchy: (model, options) => string; +``` ###### Parameters @@ -461,7 +591,9 @@ Renders enum members as a table. ##### indexSignature() -> **indexSignature**: (`model`) => `string` +```ts +indexSignature: (model) => string; +``` Renders an index signature block @@ -477,7 +609,9 @@ Renders an index signature block ##### inheritance() -> **inheritance**: (`model`, `options`) => `string` +```ts +inheritance: (model, options) => string; +``` Renders an inheritance section. @@ -495,7 +629,9 @@ Renders an inheritance section. ##### memberTitle() -> **memberTitle**: (`model`) => `string` +```ts +memberTitle: (model) => string; +``` Renders the main member title. @@ -511,7 +647,9 @@ Renders the main member title. ##### memberWithGroups() -> **memberWithGroups**: (`model`, `options`) => `string` +```ts +memberWithGroups: (model, options) => string; +``` Renders a top-level member that contains group and child members such as Classes, Interfaces and Enums. @@ -529,7 +667,9 @@ Renders a top-level member that contains group and child members such as Classes ##### parametersList() -> **parametersList**: (`model`) => `string` +```ts +parametersList: (model) => string; +``` ###### Parameters @@ -543,7 +683,9 @@ Renders a top-level member that contains group and child members such as Classes ##### parametersTable() -> **parametersTable**: (`model`) => `string` +```ts +parametersTable: (model) => string; +``` ###### Parameters @@ -555,9 +697,11 @@ Renders a top-level member that contains group and child members such as Classes `string` -##### declarationsTable() +##### propertiesTable() -> **declarationsTable**: (`model`, `options`?) => `string` +```ts +propertiesTable: (model, options?) => string; +``` Renders a collection of properties in a table. @@ -577,7 +721,9 @@ There is no association list partial for properties as these are handled as a st ##### referenceMember() -> **referenceMember**: (`model`) => `string` +```ts +referenceMember: (model) => string; +``` Renders an reference member. @@ -593,7 +739,9 @@ Renders an reference member. ##### reflectionFlags() -> **reflectionFlags**: (`model`) => `string` +```ts +reflectionFlags: (model) => string; +``` Renders the flags of a reflection. @@ -609,7 +757,9 @@ Renders the flags of a reflection. ##### reflectionIndex() -> **reflectionIndex**: (`model`, `options`) => `string` +```ts +reflectionIndex: (model, options) => string; +``` ###### Parameters @@ -625,7 +775,9 @@ Renders the flags of a reflection. ##### signature() -> **signature**: (`model`, `options`) => `string` +```ts +signature: (model, options) => string; +``` Renders a signature member. @@ -646,7 +798,9 @@ Renders a signature member. ##### signatureParameters() -> **signatureParameters**: (`model`) => `string` +```ts +signatureParameters: (model) => string; +``` ###### Parameters @@ -660,7 +814,9 @@ Renders a signature member. ##### signatureReturns() -> **signatureReturns**: (`model`, `options`) => `string` +```ts +signatureReturns: (model, options) => string; +``` ###### Parameters @@ -676,7 +832,9 @@ Renders a signature member. ##### signatureTitle() -> **signatureTitle**: (`model`, `options`?) => `string` +```ts +signatureTitle: (model, options?) => string; +``` ###### Parameters @@ -693,7 +851,9 @@ Renders a signature member. ##### signatures() -> **signatures**: (`model`, `options`) => `string` +```ts +signatures: (model, options) => string; +``` Renders a signature collection. @@ -712,7 +872,9 @@ Renders a signature collection. ##### sources() -> **sources**: (`model`, `options`) => `string` +```ts +sources: (model, options) => string; +``` ###### Parameters @@ -728,7 +890,9 @@ Renders a signature collection. ##### member() -> **member**: (`model`, `options`) => `string` +```ts +member: (model, options) => string; +``` ###### Parameters @@ -745,7 +909,9 @@ Renders a signature collection. ##### typeAndParent() -> **typeAndParent**: (`model`) => `string` +```ts +typeAndParent: (model) => string; +``` ###### Parameters @@ -759,7 +925,9 @@ Renders a signature collection. ##### typeArguments() -> **typeArguments**: (`model`, `options`?) => `string` +```ts +typeArguments: (model, options?) => string; +``` ###### Parameters @@ -775,7 +943,9 @@ Renders a signature collection. ##### typeDeclaration() -> **typeDeclaration**: (`model`, `options`) => `string` +```ts +typeDeclaration: (model, options) => string; +``` ###### Parameters @@ -791,7 +961,9 @@ Renders a signature collection. ##### typeDeclarationList() -> **typeDeclarationList**: (`model`, `headingLevel`) => `string` +```ts +typeDeclarationList: (model, headingLevel) => string; +``` ###### Parameters @@ -806,7 +978,9 @@ Renders a signature collection. ##### typeDeclarationTable() -> **typeDeclarationTable**: (`model`) => `string` +```ts +typeDeclarationTable: (model) => string; +``` ###### Parameters @@ -820,7 +994,9 @@ Renders a signature collection. ##### typeParametersList() -> **typeParametersList**: (`model`) => `string` +```ts +typeParametersList: (model) => string; +``` ###### Parameters @@ -834,7 +1010,9 @@ Renders a signature collection. ##### typeParametersTable() -> **typeParametersTable**: (`model`) => `string` +```ts +typeParametersTable: (model) => string; +``` ###### Parameters @@ -850,7 +1028,9 @@ Renders a signature collection. ##### comment() -> **comment**: (`model`, `options`) => `string` +```ts +comment: (model, options) => string; +``` ###### Parameters @@ -869,7 +1049,9 @@ Renders a signature collection. ##### commentParts() -> **commentParts**: (`model`) => `string` +```ts +commentParts: (model) => string; +``` ###### Parameters @@ -885,7 +1067,9 @@ Renders a signature collection. ##### arrayType() -> **arrayType**: (`model`) => `string` +```ts +arrayType: (model) => string; +``` ###### Parameters @@ -899,7 +1083,9 @@ Renders a signature collection. ##### conditionalType() -> **conditionalType**: (`model`) => `string` +```ts +conditionalType: (model) => string; +``` ###### Parameters @@ -913,7 +1099,9 @@ Renders a signature collection. ##### indexAccessType() -> **indexAccessType**: (`model`) => `string` +```ts +indexAccessType: (model) => string; +``` ###### Parameters @@ -927,7 +1115,9 @@ Renders a signature collection. ##### inferredType() -> **inferredType**: (`model`) => `string` +```ts +inferredType: (model) => string; +``` ###### Parameters @@ -941,7 +1131,9 @@ Renders a signature collection. ##### intersectionType() -> **intersectionType**: (`model`) => `string` +```ts +intersectionType: (model) => string; +``` ###### Parameters @@ -955,7 +1147,9 @@ Renders a signature collection. ##### intrinsicType() -> **intrinsicType**: (`model`) => `string` +```ts +intrinsicType: (model) => string; +``` ###### Parameters @@ -969,7 +1163,9 @@ Renders a signature collection. ##### literalType() -> **literalType**: (`model`) => `string` +```ts +literalType: (model) => string; +``` ###### Parameters @@ -983,7 +1179,9 @@ Renders a signature collection. ##### namedTupleType() -> **namedTupleType**: (`model`) => `string` +```ts +namedTupleType: (model) => string; +``` ###### Parameters @@ -997,7 +1195,9 @@ Renders a signature collection. ##### queryType() -> **queryType**: (`model`) => `string` +```ts +queryType: (model) => string; +``` ###### Parameters @@ -1011,7 +1211,9 @@ Renders a signature collection. ##### referenceType() -> **referenceType**: (`model`) => `string` +```ts +referenceType: (model) => string; +``` ###### Parameters @@ -1025,7 +1227,9 @@ Renders a signature collection. ##### declarationType() -> **declarationType**: (`model`) => `string` +```ts +declarationType: (model) => string; +``` ###### Parameters @@ -1039,7 +1243,9 @@ Renders a signature collection. ##### functionType() -> **functionType**: (`model`, `options`?) => `string` +```ts +functionType: (model, options?) => string; +``` ###### Parameters @@ -1055,7 +1261,9 @@ Renders a signature collection. ##### reflectionType() -> **reflectionType**: (`model`, `options`?) => `string` +```ts +reflectionType: (model, options?) => string; +``` ###### Parameters @@ -1071,7 +1279,9 @@ Renders a signature collection. ##### someType() -> **someType**: (`model`?) => `string` +```ts +someType: (model?) => string; +``` Takes a generic Type and returns the appropriate partial for it. @@ -1087,7 +1297,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### tupleType() -> **tupleType**: (`model`) => `string` +```ts +tupleType: (model) => string; +``` ###### Parameters @@ -1101,7 +1313,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### typeOperatorType() -> **typeOperatorType**: (`model`) => `string` +```ts +typeOperatorType: (model) => string; +``` ###### Parameters @@ -1115,7 +1329,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### unionType() -> **unionType**: (`model`) => `string` +```ts +unionType: (model) => string; +``` ###### Parameters @@ -1129,7 +1345,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### unknownType() -> **unknownType**: (`model`) => `string` +```ts +unknownType: (model) => string; +``` ###### Parameters @@ -1145,7 +1363,25 @@ Takes a generic Type and returns the appropriate partial for it. ### helpers -> **helpers**: `object` +```ts +helpers: { + getCommentParts: (model) => string; + getDeclarationType: (model) => undefined | SomeType; + getDescriptionForReflection: (model) => null | string; + getFlattenedDeclarations: (model, options?) => DeclarationReflection[]; + getGroupIndexList: (children) => string; + getGroupIndexTable: (children) => string; + getGroupIndex: (group) => any; + getHierarchyType: (model, options?) => string; + getKeyword: (model) => string; + getModifier: (model) => null | string; + getParameterDefaultValue: (model) => string; + getPropertyDefaultValue: (model) => null | string; + getReturnType: (model?) => string; + isGroupKind: (model) => boolean; + useTableFormat: (key) => boolean; +}; +``` The `helpers` namespace holds the helpers for the theme and are smaller utility functions that return snippets or text or other data transformations. @@ -1155,9 +1391,27 @@ Please note that partials: - Can reference other helpers but should not reference partials. - Can return strings or other models. +#### getCommentParts() + +```ts +getCommentParts: (model) => string; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | [`CommentDisplayPart`](https://typedoc.org/api/types/Models.CommentDisplayPart.html)[] | + +##### Returns + +`string` + #### getDeclarationType() -> **getDeclarationType**: (`model`) => `undefined` \| [`SomeType`](https://typedoc.org/api/classes/Models.SomeType.html) +```ts +getDeclarationType: (model) => undefined | SomeType; +``` ##### Parameters @@ -1171,7 +1425,9 @@ Please note that partials: #### getDescriptionForReflection() -> **getDescriptionForReflection**: (`model`) => `null` \| `string` +```ts +getDescriptionForReflection: (model) => null | string; +``` ##### Parameters @@ -1185,7 +1441,9 @@ Please note that partials: #### getFlattenedDeclarations() -> **getFlattenedDeclarations**: (`model`, `options`?) => [`DeclarationReflection`](https://typedoc.org/api/classes/Models.DeclarationReflection.html)[] +```ts +getFlattenedDeclarations: (model, options?) => DeclarationReflection[]; +``` ##### Parameters @@ -1201,7 +1459,9 @@ Please note that partials: #### getGroupIndexList() -> **getGroupIndexList**: (`children`) => `string` +```ts +getGroupIndexList: (children) => string; +``` ##### Parameters @@ -1215,7 +1475,9 @@ Please note that partials: #### getGroupIndexTable() -> **getGroupIndexTable**: (`children`) => `string` +```ts +getGroupIndexTable: (children) => string; +``` ##### Parameters @@ -1229,7 +1491,9 @@ Please note that partials: #### getGroupIndex() -> **getGroupIndex**: (`group`) => `any` +```ts +getGroupIndex: (group) => any; +``` ##### Parameters @@ -1243,7 +1507,9 @@ Please note that partials: #### getHierarchyType() -> **getHierarchyType**: (`model`, `options`?) => `string` +```ts +getHierarchyType: (model, options?) => string; +``` ##### Parameters @@ -1259,7 +1525,9 @@ Please note that partials: #### getKeyword() -> **getKeyword**: (`model`) => `string` +```ts +getKeyword: (model) => string; +``` ##### Parameters @@ -1273,7 +1541,9 @@ Please note that partials: #### getModifier() -> **getModifier**: (`model`) => `null` \| `string` +```ts +getModifier: (model) => null | string; +``` ##### Parameters @@ -1287,7 +1557,9 @@ Please note that partials: #### getParameterDefaultValue() -> **getParameterDefaultValue**: (`model`) => `string` +```ts +getParameterDefaultValue: (model) => string; +``` ##### Parameters @@ -1301,7 +1573,9 @@ Please note that partials: #### getPropertyDefaultValue() -> **getPropertyDefaultValue**: (`model`) => `null` \| `string` +```ts +getPropertyDefaultValue: (model) => null | string; +``` ##### Parameters @@ -1315,7 +1589,9 @@ Please note that partials: #### getReturnType() -> **getReturnType**: (`model`?) => `string` +```ts +getReturnType: (model?) => string; +``` ##### Parameters @@ -1329,7 +1605,9 @@ Please note that partials: #### isGroupKind() -> **isGroupKind**: (`model`) => `boolean` +```ts +isGroupKind: (model) => boolean; +``` ##### Parameters @@ -1340,3 +1618,19 @@ Please note that partials: ##### Returns `boolean` + +#### useTableFormat() + +```ts +useTableFormat: (key) => boolean; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `"parameters"` \| `"properties"` \| `"enums"` \| `"typeDeclarations"` | + +##### Returns + +`boolean` diff --git a/docs/pages/api-docs/Interface.MarkdownApplication.md b/docs/pages/api-docs/Interface.MarkdownApplication.md index 3f324c93..5cdae7e1 100644 --- a/docs/pages/api-docs/Interface.MarkdownApplication.md +++ b/docs/pages/api-docs/Interface.MarkdownApplication.md @@ -1,13 +1,11 @@ # MarkdownApplication -An extended typing of TypeDoc's Application instance. - -This is essentially a copy of the main class with the `renderer` property overridden to the custom [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md). +This interface is essentially an extended typing of TypeDoc's [`Application`](https://typedoc.org/api/classes/Application.html) instance. ## Usage ```ts -import {MarkdownApplication} from 'typedoc-plugin-markdown'; +import { MarkdownApplication } from 'typedoc-plugin-markdown'; export function load(app: MarkdownApplication) { ... @@ -22,7 +20,11 @@ export function load(app: MarkdownApplication) { ### renderer -> **renderer**: [`MarkdownRenderer`](/api-docs/Interface.MarkdownRenderer.md) +```ts +renderer: MarkdownRenderer; +``` + +Re-types the `renderer` instance to [`MarkdownRenderer`](/api-docs/Interface.MarkdownRenderer.md). #### Overrides diff --git a/docs/pages/api-docs/Interface.MarkdownRenderer.md b/docs/pages/api-docs/Interface.MarkdownRenderer.md index e9421444..4452a07d 100644 --- a/docs/pages/api-docs/Interface.MarkdownRenderer.md +++ b/docs/pages/api-docs/Interface.MarkdownRenderer.md @@ -1,8 +1,6 @@ # MarkdownRenderer -An extended typing of TypeDoc's Renderer class. - -Includes updated typings for hooks and async jobs. +An extended typing of TypeDoc's [`Renderer`](https://typedoc.org/api/classes/Renderer.html) class that includes updated typings for hooks and async jobs. ## Usage @@ -15,12 +13,12 @@ app.renderer.markdownHooks.on( 'page.begin', () => '> This is some markdown at the top of the page', ); -app.renderer.preRenderAsyncJobs.push(async (event) => { - await doSomethingAsync(event); +app.renderer.preRenderAsyncJobs.push(async (output: MarkdownRendererEvent) => { + await doSomethingAsync(output); }); -app.renderer.postRenderAsyncJobs.push(async (event) => { - await doSomethingAsync(event); +app.renderer.postRenderAsyncJobs.push(async (output: MarkdownRendererEvent)) => { + await doSomethingAsync(output); }); } @@ -34,13 +32,21 @@ app.renderer.postRenderAsyncJobs.push(async (event) => { ### markdownHooks -> **markdownHooks**: [`EventHooks`](https://typedoc.org/api/classes/EventHooks.html)\<[`MarkdownRendererHooks`](/api-docs/Interface.MarkdownRendererHooks.md), `string`\> +```ts +markdownHooks: EventHooks; +``` + +Replaces the event hooks typings the [`MarkdownRendererHooks`](/api-docs/Interface.MarkdownRendererHooks.md) used by the plugin. *** ### preRenderAsyncJobs -> **preRenderAsyncJobs**: (`output`) => `Promise`\<`void`\>[] +```ts +preRenderAsyncJobs: (output) => Promise[]; +``` + +Re-types the returned argument argument to [`MarkdownRendererEvent`](/api-docs/Class.MarkdownRendererEvent.md). #### Overrides @@ -50,7 +56,11 @@ app.renderer.postRenderAsyncJobs.push(async (event) => { ### postRenderAsyncJobs -> **postRenderAsyncJobs**: (`output`) => `Promise`\<`void`\>[] +```ts +postRenderAsyncJobs: (output) => Promise[]; +``` + +Re-types the returned argument argument to [`MarkdownRendererEvent`](/api-docs/Class.MarkdownRendererEvent.md). #### Overrides diff --git a/docs/pages/api-docs/Interface.MarkdownRendererHooks.md b/docs/pages/api-docs/Interface.MarkdownRendererHooks.md index ffd0553f..c762a875 100644 --- a/docs/pages/api-docs/Interface.MarkdownRendererHooks.md +++ b/docs/pages/api-docs/Interface.MarkdownRendererHooks.md @@ -15,7 +15,9 @@ Describes the hooks available to inject output in the markdown theme. ### page.begin -> **page.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +page.begin: [MarkdownThemeContext]; +``` Applied at the start of the markdown output. @@ -23,7 +25,9 @@ Applied at the start of the markdown output. ### page.end -> **page.end**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +page.end: [MarkdownThemeContext]; +``` Applied at the end of the markdown output. @@ -31,7 +35,9 @@ Applied at the end of the markdown output. ### content.begin -> **content.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +content.begin: [MarkdownThemeContext]; +``` Applied before the main markdown content is rendered. @@ -39,7 +45,9 @@ Applied before the main markdown content is rendered. ### index.page.begin -> **index.page.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +index.page.begin: [MarkdownThemeContext]; +``` Applied at the start of the markdown output on the index page. @@ -47,6 +55,8 @@ Applied at the start of the markdown output on the index page. ### index.page.end -> **index.page.end**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +index.page.end: [MarkdownThemeContext]; +``` Applied at the end of the markdown output on the index page. diff --git a/docs/pages/api-docs/Interface.NavigationItem.md b/docs/pages/api-docs/Interface.NavigationItem.md index 86a501cb..1dac13b1 100644 --- a/docs/pages/api-docs/Interface.NavigationItem.md +++ b/docs/pages/api-docs/Interface.NavigationItem.md @@ -6,22 +6,30 @@ The model used to define the navigation structure. ### title -> **title**: `string` +```ts +title: string; +``` *** ### path? -> `optional` **path**: `null` \| `string` +```ts +optional path: null | string; +``` *** ### kind? -> `optional` **kind**: [`ReflectionKind`](https://typedoc.org/api/enums/Models.ReflectionKind-1.html) +```ts +optional kind: ReflectionKind; +``` *** ### children? -> `optional` **children**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +optional children: NavigationItem[]; +``` diff --git a/docs/pages/api-docs/Interface.PackageMetaData.md b/docs/pages/api-docs/Interface.PackageMetaData.md index b6881a56..463e5129 100644 --- a/docs/pages/api-docs/Interface.PackageMetaData.md +++ b/docs/pages/api-docs/Interface.PackageMetaData.md @@ -6,10 +6,14 @@ The model used to define the package metadata when in packages mode. ### description -> **description**: `string` +```ts +description: string; +``` *** ### options -> **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html) +```ts +options: Options; +``` diff --git a/docs/pages/api-docs/Interface.PluginOptions.md b/docs/pages/api-docs/Interface.PluginOptions.md index f632d103..796610d0 100644 --- a/docs/pages/api-docs/Interface.PluginOptions.md +++ b/docs/pages/api-docs/Interface.PluginOptions.md @@ -6,7 +6,9 @@ Describes the options declared by the plugin. ### anchorPrefix -> **anchorPrefix**: `string` +```ts +anchorPrefix: string; +``` Custom anchor prefix when anchoring to in-page symbols. @@ -14,7 +16,9 @@ Custom anchor prefix when anchoring to in-page symbols. ### entryFileName -> **entryFileName**: `string` +```ts +entryFileName: string; +``` The file name of the entry page. @@ -22,7 +26,9 @@ The file name of the entry page. ### entryModule -> **entryModule**: `string` +```ts +entryModule: string; +``` The name of a module that should act as the root page for the documentation. @@ -30,7 +36,9 @@ The name of a module that should act as the root page for the documentation. ### enumMembersFormat -> **enumMembersFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +enumMembersFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of enumeration members. @@ -38,7 +46,9 @@ Specify the render style of enumeration members. ### ~~excludeGroups~~ -> **excludeGroups**: `boolean` +```ts +excludeGroups: boolean; +``` #### Deprecated @@ -48,7 +58,9 @@ This option has been renamed hideGroupHeadings to better reflect its purpose. ### excludeScopesInPaths -> **excludeScopesInPaths**: `boolean` +```ts +excludeScopesInPaths: boolean; +``` Exclude writing @ scope directories in paths. @@ -56,7 +68,9 @@ Exclude writing @ scope directories in paths. ### expandObjects -> **expandObjects**: `boolean` +```ts +expandObjects: boolean; +``` Expand objects inside declarations. @@ -64,7 +78,9 @@ Expand objects inside declarations. ### expandParameters -> **expandParameters**: `boolean` +```ts +expandParameters: boolean; +``` Expand parameters in signature parentheses to display type information. @@ -72,7 +88,9 @@ Expand parameters in signature parentheses to display type information. ### fileExtension -> **fileExtension**: `string` +```ts +fileExtension: string; +``` Specify the file extension for generated output files. @@ -80,7 +98,9 @@ Specify the file extension for generated output files. ### flattenOutputFiles -> **flattenOutputFiles**: `boolean` +```ts +flattenOutputFiles: boolean; +``` Flatten output files to a single directory. @@ -88,7 +108,9 @@ Flatten output files to a single directory. ### hideBreadcrumbs -> **hideBreadcrumbs**: `boolean` +```ts +hideBreadcrumbs: boolean; +``` Do not print breadcrumbs. @@ -96,7 +118,9 @@ Do not print breadcrumbs. ### hideGroupHeadings -> **hideGroupHeadings**: `boolean` +```ts +hideGroupHeadings: boolean; +``` Excludes grouping by kind so all members are rendered and sorted at the same level. @@ -104,7 +128,9 @@ Excludes grouping by kind so all members are rendered and sorted at the same lev ### hidePageHeader -> **hidePageHeader**: `boolean` +```ts +hidePageHeader: boolean; +``` Do not print page header. @@ -112,7 +138,9 @@ Do not print page header. ### hidePageTitle -> **hidePageTitle**: `boolean` +```ts +hidePageTitle: boolean; +``` Do not print page title. @@ -120,7 +148,9 @@ Do not print page title. ### indexFormat -> **indexFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +indexFormat: "table" | "list" | "htmlTable"; +``` Specify the render format for index items. @@ -128,23 +158,25 @@ Specify the render format for index items. ### inlineDocuments -> **inlineDocuments**: `boolean` +```ts +inlineDocuments: boolean; +``` Inline documents in pages. *** -### leftAlignTableHeaders - -> **leftAlignTableHeaders**: `boolean` - -Left aligns items in table headers - -*** - ### membersWithOwnFile -> **membersWithOwnFile**: (`"Enum"` \| `"Variable"` \| `"Function"` \| `"Class"` \| `"Interface"` \| `"TypeAlias"`)[] +```ts +membersWithOwnFile: ( + | "Enum" + | "Variable" + | "Function" + | "Class" + | "Interface" + | "TypeAlias")[]; +``` Determines which members are exported to their own file when `outputFileStrategy` equals `members`. @@ -152,7 +184,9 @@ Determines which members are exported to their own file when `outputFileStrategy ### mergeReadme -> **mergeReadme**: `boolean` +```ts +mergeReadme: boolean; +``` Merges the resolved readme into the project index page. @@ -160,27 +194,41 @@ Merges the resolved readme into the project index page. ### navigationModel -> **navigationModel**: `object` +```ts +navigationModel: { + excludeGroups: boolean; + excludeCategories: boolean; + excludeFolders: boolean; +}; +``` Configures how the navigation model will be generated. #### excludeGroups -> **excludeGroups**: `boolean` +```ts +excludeGroups: boolean; +``` #### excludeCategories -> **excludeCategories**: `boolean` +```ts +excludeCategories: boolean; +``` #### excludeFolders -> **excludeFolders**: `boolean` +```ts +excludeFolders: boolean; +``` *** ### outputFileStrategy -> **outputFileStrategy**: `"members"` \| `"modules"` +```ts +outputFileStrategy: "members" | "modules"; +``` Determines how output files are generated. @@ -188,7 +236,9 @@ Determines how output files are generated. ### parametersFormat -> **parametersFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +parametersFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of parameter and type parameter groups. @@ -196,7 +246,9 @@ Specify the render style of parameter and type parameter groups. ### preserveAnchorCasing -> **preserveAnchorCasing**: `boolean` +```ts +preserveAnchorCasing: boolean; +``` Preserve anchor casing when generating link to symbols. @@ -204,7 +256,9 @@ Preserve anchor casing when generating link to symbols. ### propertiesFormat -> **propertiesFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +propertiesFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of property groups for interfaces and classes. @@ -212,7 +266,9 @@ Specify the render style of property groups for interfaces and classes. ### publicPath -> **publicPath**: `string` +```ts +publicPath: string; +``` Specify the base path for all urls. @@ -220,43 +276,79 @@ Specify the base path for all urls. ### sanitizeComments -> **sanitizeComments**: `boolean` +```ts +sanitizeComments: boolean; +``` Sanitize HTML and JSX inside JsDoc comments. *** -### tableColumnVisibility +### tableColumnSettings -> **tableColumnVisibility**: `object` +```ts +tableColumnSettings: { + hideDefaults: boolean; + hideFlags: boolean; + hideInherited: boolean; + hideModifiers: boolean; + hideOverrides: boolean; + hideSources: boolean; + leftAlignHeaders: boolean; +}; +``` Control header alignment and column visibility in tables. #### hideDefaults -> **hideDefaults**: `boolean` +```ts +hideDefaults: boolean; +``` + +#### hideFlags + +```ts +hideFlags: boolean; +``` #### hideInherited -> **hideInherited**: `boolean` +```ts +hideInherited: boolean; +``` #### hideModifiers -> **hideModifiers**: `boolean` +```ts +hideModifiers: boolean; +``` #### hideOverrides -> **hideOverrides**: `boolean` +```ts +hideOverrides: boolean; +``` #### hideSources -> **hideSources**: `boolean` +```ts +hideSources: boolean; +``` + +#### leftAlignHeaders + +```ts +leftAlignHeaders: boolean; +``` *** ### ~~textContentMappings~~ -> **textContentMappings**: `Partial`\<`any`\> +```ts +textContentMappings: Partial; +``` #### Deprecated @@ -266,7 +358,9 @@ Provides a mechanism to change the content of text used in documentation. ### typeDeclarationFormat -> **typeDeclarationFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +typeDeclarationFormat: "table" | "list" | "htmlTable"; +``` Specify the render style for type declaration members. @@ -274,7 +368,9 @@ Specify the render style for type declaration members. ### useCodeBlocks -> **useCodeBlocks**: `boolean` +```ts +useCodeBlocks: boolean; +``` Wraps signatures and declarations in code blocks. @@ -282,6 +378,8 @@ Wraps signatures and declarations in code blocks. ### useHTMLAnchors -> **useHTMLAnchors**: `boolean` +```ts +useHTMLAnchors: boolean; +``` Add HTML named anchors to headings and table rows. diff --git a/docs/pages/api-docs/Interface.UrlMapping.md b/docs/pages/api-docs/Interface.UrlMapping.md index ac3dec71..0e16564a 100644 --- a/docs/pages/api-docs/Interface.UrlMapping.md +++ b/docs/pages/api-docs/Interface.UrlMapping.md @@ -6,19 +6,25 @@ The model used to define the URL mapping structure. ### url -> **url**: `string` +```ts +url: string; +``` *** ### model -> **model**: `Model` +```ts +model: Model; +``` *** ### template() -> **template**: (`data`) => `string` +```ts +template: (data) => string; +``` #### Parameters diff --git a/docs/pages/api-docs/index.md b/docs/pages/api-docs/index.md index 7feb4a0c..3011e07a 100644 --- a/docs/pages/api-docs/index.md +++ b/docs/pages/api-docs/index.md @@ -10,8 +10,8 @@ The Application class is the main entry point for a TypeDoc application and prov | Member | Description | | :------ | :------ | -| [MarkdownApplication](/api-docs/Interface.MarkdownApplication.md) | An extended typing of TypeDoc's Application instance. | -| [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md) | An extended typing of TypeDoc's Renderer class. | +| [MarkdownApplication](/api-docs/Interface.MarkdownApplication.md) | This interface is essentially an extended typing of TypeDoc's [`Application`](https://typedoc.org/api/classes/Application.html) instance. | +| [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md) | An extended typing of TypeDoc's [`Renderer`](https://typedoc.org/api/classes/Renderer.html) class that includes updated typings for hooks and async jobs. | | [MarkdownPageEvent](/api-docs/Class.MarkdownPageEvent.md) | An event emitted by before and after the markup of a page is rendered. | | [MarkdownRendererEvent](/api-docs/Class.MarkdownRendererEvent.md) | An event emitted at the beginning and end of the rendering process. | | [MarkdownRendererHooks](/api-docs/Interface.MarkdownRendererHooks.md) | Describes the hooks available to inject output in the markdown theme. | diff --git a/docs/pages/docs/CHANGELOG.md b/docs/pages/docs/CHANGELOG.md index 6236b638..0dd1d319 100644 --- a/docs/pages/docs/CHANGELOG.md +++ b/docs/pages/docs/CHANGELOG.md @@ -8,7 +8,7 @@ Version 4.1 introduces API compatibility fixes for TypeDoc 0.26. #### TypeDoc 0.26 Feature Support -##### Localization +##### Internationalization The plugin respects TypeDoc's 0.26 new localization model. For this reason the existing option `--textContentMappings` has been deprecated in favour of using this implementation. @@ -35,7 +35,7 @@ Please note this does involve an output change whereby all line breaks are now s Please two additional table options have been exposed: -- **Column Visibility**: The option [`--tableColumnVisibility`]() introduces the ability to control what columns are displayed in output. This could be useful for some reflections that contain several columns. +- **Column Visibility**: The option [`--tableColumnSettings`]() introduces the ability to control what columns are displayed in output. This could be useful for some reflections that contain several columns. - **Header alignment**: The plugin now does not define any header alignment by default. This typically results in table headers visually appearing center aligned. If you would prefer left align headers please use the [`--leftAlignTableHeaders`]() option. ## 4.0.2 (2024-05-15) diff --git a/docs/pages/docs/_meta.js b/docs/pages/docs/_meta.js index f4a8d075..75d2287c 100644 --- a/docs/pages/docs/_meta.js +++ b/docs/pages/docs/_meta.js @@ -11,6 +11,7 @@ export default { title: 'Guides', }, 'typedoc-usage': '', + internationalization: '', 'customizing-output': '', '-- Support': { type: 'separator', diff --git a/docs/pages/docs/internationalization.mdx b/docs/pages/docs/internationalization.mdx new file mode 100644 index 00000000..93fe4cdd --- /dev/null +++ b/docs/pages/docs/internationalization.mdx @@ -0,0 +1,3 @@ +# Internationalization + +Please follow the TypeDoc documentation for [Internationalization](https://typedoc.org/guides/options/#internationalization) for more information. diff --git a/docs/pages/docs/options.mdx b/docs/pages/docs/options.mdx index 100d4968..fd30b152 100644 --- a/docs/pages/docs/options.mdx +++ b/docs/pages/docs/options.mdx @@ -37,8 +37,7 @@ Options that are used to configure how the output is structured and displayed . - [--enumMembersFormat](./options/display-options.mdx#--enummembersformat) - [--typeDeclarationFormat](./options/display-options.mdx#--typedeclarationformat) - [--indexFormat](./options/display-options.mdx#--indexformat) -- [--tableColumnVisibility](./options/display-options.mdx#--tablecolumnvisibility) -- [--leftAlignTableHeaders](./options/display-options.mdx#--leftaligntableheaders) +- [--tableColumnSettings](./options/display-options.mdx#--tablecolumnsettings) ## Utility Options diff --git a/docs/pages/docs/options/display-options.mdx b/docs/pages/docs/options/display-options.mdx index 742534d8..5773ea0a 100644 --- a/docs/pages/docs/options/display-options.mdx +++ b/docs/pages/docs/options/display-options.mdx @@ -121,7 +121,7 @@ This option specifies the output format for parameters and type parameters of fu - **"list"**: parameters are output as bullet points in a linear list, suitable for more detailed comments. - **"table"**: parameters are output within a markdown table, condensed into a single paragraph. -- **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format. +- **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format ```json filename="typedoc.json" { @@ -203,7 +203,7 @@ For a packages index page (when `--entryPointStrategy` equals `packages`), the p } ``` -## --tableColumnVisibility +## --tableColumnSettings Control header alignment and column visibility in tables. @@ -211,34 +211,31 @@ For a packages index page (when `--entryPointStrategy` equals `packages`), the p > -By default, all available data for symbols are displayed in table columns. +This option presents a standardize way reflection metadata are represented. -This option allows you to control the visibility of columns, prioritizing readability over displaying complete data. +The available keys are: + +- **"enums"**: the output format for enumeration members. +- **"parameters"**: the output format for parameters and type parameters of functions and class methods. +- **"properties"**: the output format for class and interface properties. +- **"typeDeclarations"**: the output format for type definitions. + +The available values are: + +- **"list"**: declarations are output in linear blocks with headings, suitable for more detailed comments. +- **"table"**: declarations are output within a markdown table, condensed into a single paragraph. +- **"htmlTable"**: declarations are output in an HTML table, enabling block elements to render in tabular format. ```json filename="typedoc.json" { - "tableColumnVisibility": { + "tableColumnSettings": { "hideDefaults": false, + "hideFlags": false, "hideInherited": false, "hideModifiers": false, "hideOverrides": false, - "hideSources": false + "hideSources": false, + "leftAlignHeaders": false } } ``` - -## --leftAlignTableHeaders - -Left aligns items in table headers - -> Accepts a boolean value. Defaults to `false`. - -By default table alignment is not specified which means the table headings will typically be centred. - -This options can be used to specify left alignment for table headings. - -```json filename="typedoc.json" -{ - "leftAlignTableHeaders": false -} -``` diff --git a/package-lock.json b/package-lock.json index 14e8873a..864b416a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23395,7 +23395,7 @@ } }, "packages/typedoc-plugin-markdown": { - "version": "4.0.2", + "version": "4.0.3", "license": "MIT", "engines": { "node": ">= 18" @@ -23405,7 +23405,7 @@ } }, "packages/typedoc-plugin-remark": { - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "dependencies": { "remark": "^15.0.1", diff --git a/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs b/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs deleted file mode 100644 index eb21a2a9..00000000 --- a/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-check - -/** - * Local plugin to tweak TypeDoc output for nextra docs - * - * @param {import("typedoc-plugin-markdown").MarkdownApplication} app - */ -export function load(app) { - app.converter.addUnknownSymbolResolver((ref) => { - if (ref?.symbolReference?.path && ref.moduleSource !== 'typedoc') { - const name = ref?.symbolReference?.path[0].path; - return { - target: `https://typedoc.org/api/classes/${name}`, - caption: name, - }; - } - }); -} diff --git a/packages/typedoc-plugin-markdown/.docs/typedoc.html.json b/packages/typedoc-plugin-markdown/.docs/typedoc.html.json new file mode 100644 index 00000000..ba17b178 --- /dev/null +++ b/packages/typedoc-plugin-markdown/.docs/typedoc.html.json @@ -0,0 +1,80 @@ +{ + "entryPoints": ["../src/public-api.ts"], + "plugin": [ + "./plugins/typedoc-nextra.mjs", + "./plugins/typedoc-ignore-typeparam.mjs" + ], + "out": "./html", + "sortEntryPoints": false, + "name": "API", + "readme": "none", + "sort": ["required-first", "source-order"], + "includeVersion": false, + "categoryOrder": [ + "Application", + "Theme", + "Options", + "Page Partials", + "Container Partials", + "Member Partials", + "Comment Partials", + "Type Partials", + "*" + ], + "disableSources": true, + "excludeInternal": true, + "excludeExternals": true, + "excludePrivate": true, + "navigation": { + "includeCategories": true, + "includeGroups": false + }, + "externalSymbolLinkMappings": { + "typedoc": { + "ArrayType": "https://typedoc.org/api/types/Models.ArrayType.html", + "Application": "https://typedoc.org/api/classes/Application.html", + "Comment": "https://typedoc.org/api/types/Models.Comment.html", + "CommentDisplayPart": "https://typedoc.org/api/types/Models.CommentDisplayPart.html", + "ConditionalType": "https://typedoc.org/api/types/Models.ConditionalType.html", + "ContainerReflection": "https://typedoc.org/api/classes/Models.ContainerReflection.html", + "DeclarationHierarchy": "https://typedoc.org/api/classes/Models.DeclarationHierarchy.html", + "DeclarationReflection": "https://typedoc.org/api/classes/Models.DeclarationReflection.html", + "DefaultThemeRenderContext": "https://typedoc.org/api/classes/DefaultThemeRenderContext.html", + "Event": "https://typedoc.org/api/classes/Event.html", + "EventHooks": "https://typedoc.org/api/classes/EventHooks.html", + "IndexedAccessType": "https://typedoc.org/api/types/Models.IndexedAccessType.html", + "InferredType": "https://typedoc.org/api/types/Models.InferredType.html", + "IntersectionType": "https://typedoc.org/api/types/Models.IntersectionType.html", + "IntrinsicType": "https://typedoc.org/api/types/Models.IntrinsicType.html", + "LiteralType": "https://typedoc.org/api/types/Models.LiteralType.html", + "NamedTupleMember": "https://typedoc.org/api/types/Models.NamedTupleMember.html", + "ManuallyValidatedOption": "https://typedoc.org/api/types/Configuration.ManuallyValidatedOption.html", + "Options": "https://typedoc.org/api/classes/Configuration.Options.html", + "PageEvent": "https://typedoc.org/api/classes/PageEvent.html", + "ParameterReflection": "https://typedoc.org/api/classes/Models.ParameterReflection.html", + "ProjectReflection": "https://typedoc.org/api/classes/Models.ProjectReflection.html", + "ReferenceReflection": "https://typedoc.org/api/classes/Models.ReferenceReflection.html", + "ReferenceType": "https://typedoc.org/api/classes/Models.ReferenceType.html", + "Renderer": "https://typedoc.org/api/classes/Renderer.html", + "RendererEvent": "https://typedoc.org/api/classes/RendererEvent.html", + "RenderTemplate": "https://typedoc.org/api/types/RenderTemplate.html", + "Reflection": "https://typedoc.org/api/classes/Models.Reflection.html", + "ReflectionCategory": "https://typedoc.org/api/types/Models.ReflectionCategory.html", + "ReflectionFlags": "https://typedoc.org/api/classes/Models.ReflectionFlags.html", + "ReflectionGroup": "https://typedoc.org/api/classes/Models.ReflectionGroup.html", + "ReflectionKind": "https://typedoc.org/api/enums/Models.ReflectionKind-1.html", + "ReflectionType": "https://typedoc.org/api/classes/Models.ReflectionType.html", + "SignatureReflection": "https://typedoc.org/api/classes/Models.SignatureReflection.html", + "SomeType": "https://typedoc.org/api/classes/Models.SomeType.html", + "TypeParameterReflection": "https://typedoc.org/api/classes/Models.TypeParameterReflection.html", + "Theme": "https://typedoc.org/api/classes/Theme.html", + "TypeDocOptions": "https://typedoc.org/api/interfaces/TypeDocOptions.html", + "TypeOperatorType": "https://typedoc.org/api/interfaces/TypeOperatorType.html", + "TupleType": "https://typedoc.org/api/classes/Models.TupleType.html", + "QueryType": "https://typedoc.org/api/types/Models.QueryType.html", + "UnknownType": "https://typedoc.org/api/types/Models.UnknownType.html", + "UnionType": "https://typedoc.org/api/types/Models.UnionType.html", + "UrlMapping": "https://typedoc.org/api/classes/UrlMapping.html" + } + } +} diff --git a/packages/typedoc-plugin-markdown/.docs/typedoc.json b/packages/typedoc-plugin-markdown/.docs/typedoc.json index baaa0cd6..77c3567a 100644 --- a/packages/typedoc-plugin-markdown/.docs/typedoc.json +++ b/packages/typedoc-plugin-markdown/.docs/typedoc.json @@ -9,14 +9,22 @@ "publicPath": "/api-docs", "indexFormat": "table", "mergeReadme": true, - "leftAlignTableHeaders": true, "entryFileName": "index.md", "hideBreadcrumbs": true, "hidePageHeader": true, "excludeGroups": true, + "expandObjects": true, "parametersFormat": "table", + "expandParameters": false, + "tableColumnSettings": { + "hideOverrides": true, + "hideModifiers": true, + "hideDefaults": true, + "hideSources": true, + "leftAlignHeaders": true + }, "outputFileStrategy": "members", - "useCodeBlocks": false, + "useCodeBlocks": true, "textContentMappings": { "title.memberPage": "{name}" }, diff --git a/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts b/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts index 2c7bd781..1e73ce7d 100644 --- a/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts +++ b/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts @@ -37,23 +37,27 @@ function getSymbols(files: string[], type: string, thePath = resourcesPath) { ?.getParameters() .filter((parameter) => parameter.getName() !== 'context') .map((parameter) => { - const typeunions = parameter - .getType() - .getText() - .split('|') - .map((unions) => { - const union = unions.split('.'); - const isKeyOf = union[0].startsWith('keyof'); - if (union[1] && union[1].startsWith('MarkdownPageEvent')) { - return `MarkdownPageEvent<${union[union.length - 1]}`; - } - const typeParts: string[] = []; - if (isKeyOf) { - typeParts.push('keyof'); - } - typeParts.push(union[union.length - 1]); - return typeParts.join(' '); - }); + let parameterTextType = parameter.getType().getText(); + if (parameterTextType.startsWith('{')) { + parameterTextType = parameterTextType.replace( + /import\(".*"\)\.([a-zA-Z_][a-zA-Z0-9_]*)/g, + '$1', + ); + } + const typeunions = parameterTextType.split('|').map((unions) => { + const union = unions.split('.'); + const isKeyOf = union[0].startsWith('keyof'); + if (union[1] && union[1].startsWith('MarkdownPageEvent')) { + return `MarkdownPageEvent<${union[union.length - 1]}`; + } + const typeParts: string[] = []; + if (isKeyOf) { + typeParts.push('keyof'); + } + typeParts.push(union[union.length - 1]); + return typeParts.join(' '); + }); + const name = parameter.getName(); const isOptional = parameter.isOptional(); const initializer = parameter.getInitializer(); diff --git a/packages/typedoc-plugin-markdown/package.json b/packages/typedoc-plugin-markdown/package.json index 8452738a..1b6ef22d 100644 --- a/packages/typedoc-plugin-markdown/package.json +++ b/packages/typedoc-plugin-markdown/package.json @@ -19,7 +19,7 @@ "test:update": "npm run build && npm run test -- -u", "support": "npm run schema && npm run docs", "schema": "ts-node ./.scripts/schema/generate-schema.ts", - "docs": "npm run build && typedoc --options ./.docs/typedoc.json" + "docs": "npm run build && typedoc --options ./.docs/typedoc.json && typedoc --options ./.docs/typedoc.html.json" }, "author": "Thomas Grey", "license": "MIT", diff --git a/packages/typedoc-plugin-markdown/src/app/application.ts b/packages/typedoc-plugin-markdown/src/app/application.ts index 9aab428e..3806c253 100644 --- a/packages/typedoc-plugin-markdown/src/app/application.ts +++ b/packages/typedoc-plugin-markdown/src/app/application.ts @@ -4,14 +4,12 @@ import { Application, EventHooks, Options, Renderer } from 'typedoc'; import { MarkdownRendererHooks } from './renderer/markdown-renderer-hooks'; /** - * An extended typing of TypeDoc's Application instance. - * - * This is essentially a copy of the main class with the `renderer` property overridden to the custom {@link MarkdownRenderer}. + * This interface is essentially an extended typing of TypeDoc's {@linkcode typedoc!Application Application} instance. * * ## Usage * * ```ts - * import {MarkdownApplication} from 'typedoc-plugin-markdown'; + * import { MarkdownApplication } from 'typedoc-plugin-markdown'; * * export function load(app: MarkdownApplication) { * ... @@ -21,13 +19,14 @@ import { MarkdownRendererHooks } from './renderer/markdown-renderer-hooks'; * @category Application */ export interface MarkdownApplication extends Application { + /** + * Re-types the `renderer` instance to {@linkcode MarkdownRenderer }. + */ renderer: MarkdownRenderer; } /** - * An extended typing of TypeDoc's Renderer class. - * - * Includes updated typings for hooks and async jobs. + * An extended typing of TypeDoc's {@linkcode typedoc!Renderer Renderer} class that includes updated typings for hooks and async jobs. * * ## Usage * @@ -40,12 +39,12 @@ export interface MarkdownApplication extends Application { * 'page.begin', () => '> This is some markdown at the top of the page', * ); * - * app.renderer.preRenderAsyncJobs.push(async (event) => { - * await doSomethingAsync(event); + * app.renderer.preRenderAsyncJobs.push(async (output: MarkdownRendererEvent) => { + * await doSomethingAsync(output); * }); - * app.renderer.postRenderAsyncJobs.push(async (event) => { - * await doSomethingAsync(event); + * app.renderer.postRenderAsyncJobs.push(async (output: MarkdownRendererEvent)) => { + * await doSomethingAsync(output); * }); * * } @@ -54,6 +53,9 @@ export interface MarkdownApplication extends Application { * @category Application */ export interface MarkdownRenderer extends Renderer { + /** + * Replaces the event hooks typings the {@linkcode MarkdownRendererHooks} used by the plugin. + */ markdownHooks: EventHooks; /** @internal */ packagesMeta: Record; @@ -62,6 +64,12 @@ export interface MarkdownRenderer extends Renderer { name: string, theme: new (renderer: MarkdownRenderer) => MarkdownTheme, ) => void; + /** + * Re-types the returned argument argument to {@linkcode MarkdownRendererEvent}. + */ preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; + /** + * Re-types the returned argument argument to {@linkcode MarkdownRendererEvent}. + */ postRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; } diff --git a/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts b/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts index bbe9e2b4..79cd9564 100644 --- a/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts +++ b/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts @@ -19,29 +19,30 @@ export class MarkdownPageEvent< /** @ignore **/ Model = Reflection, > extends Event { /** - * The project the renderer is currently processing. + * The {@linkcode typedoc!ProjectReflection ProjectReflection} instance the renderer is currently processing. */ project!: ProjectReflection; /** - * The model that should be rendered on this page. + * The model that that is being rendered on this page. + * Either a {@linkcode typedoc!DeclarationReflection DeclarationReflection} or {@linkcode typedoc!ProjectReflection ProjectReflection}. */ readonly model: Model; /** - * The final markdown content of this page. + * The final markdown `string` content of the page. * * Should be rendered by layout templates and can be modified by plugins. */ contents?: string; /** - * The url this page will be located at. + * The url `string` of the page. */ url!: string; /** - * The filename the page will be written to. + * The complete `string` filename where the file will be written.. */ filename!: string; diff --git a/packages/typedoc-plugin-markdown/src/app/translatable.ts b/packages/typedoc-plugin-markdown/src/app/translatable.ts index 86f481f0..0529135f 100644 --- a/packages/typedoc-plugin-markdown/src/app/translatable.ts +++ b/packages/typedoc-plugin-markdown/src/app/translatable.ts @@ -2,10 +2,14 @@ import { Application } from 'typedoc'; export function getTranslatable(app: Application) { // read text content mappings for backward compatibility - const textContentMappings = app.options.getValue('textContentMappings'); - return { ...translatable, ...serializeTextContent(textContentMappings) }; + return { + ...translatable, + ...mapToTranslatable(app.options.getValue('textContentMappings')), + ...app.options.getValue('locales')[app.options.getValue('lang')], + }; } +// String that show up in the markdown theme export const translatable = { // header theme_header_title: '{0} {1}', // {projectName} {version}, @@ -23,12 +27,25 @@ export const translatable = { theme_footer_text: '', // generic labels + theme_defined_in: 'Defined in', + theme_implements: 'Implements', + theme_indexable: 'Indexable', + theme_type_declaration: 'Type declaration', + theme_index: 'Index', + theme_implemented_by: 'Implemented by', + theme_implementation_of: 'Implementation of', + theme_inherited_from: 'Inherited from', + theme_overrides: 'Overrides', + theme_returns: 'Returns', + theme_re_exports: 'Re-exports', + theme_renames_and_re_exports: 'Renames and re-exports', + theme_api_index: 'API Index', - theme_default_value: 'Default Value', + theme_default_value: 'Default value', theme_description: 'Description', theme_event: 'Event', theme_extends: 'Extends', - theme_extended_by: 'Extended By', + theme_extended_by: 'Extended by', theme_flags: 'Flags', theme_globals: 'Globals', theme_member: 'Member', @@ -36,7 +53,6 @@ export const translatable = { theme_modifier: 'Modifier', theme_name: 'Name', theme_packages: 'Packages', - theme_source: 'Source', theme_type: 'Type', theme_value: 'Value', theme_version: 'Version', @@ -50,10 +66,10 @@ export const translatable = { * This method will be removed once textContentMappings is removed from options declaration. * */ -function serializeTextContent(textContentMappings: any) { - const output: { [key: string]: string } = {}; +function mapToTranslatable(textContentMappings: any) { + const translatable: { [key: string]: string } = {}; for (const [key, value] of Object.entries(textContentMappings)) { - const newKey = 'theme_' + camelToSnakeCase(key.replace(/\./g, '_')); + const newKey = getTranslatableKey(key); let newValue = (value as any) .replace(/{version}/g, '{1}') .replace(/{kind}/g, '{0}') @@ -63,11 +79,27 @@ function serializeTextContent(textContentMappings: any) { } else { newValue = newValue.replace(/{name}/g, '{0}'); } - output[newKey] = newValue; + translatable[newKey] = newValue; } - return output; + return translatable; } function camelToSnakeCase(str: string) { return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); } + +function getTranslatableKey(key: string) { + if (key.startsWith('kind')) { + const kindParts = key.split('.'); + if (kindParts.length === 3) { + if (kindParts[2] === 'plural') { + return 'kind_' + kindParts[2] + '_' + kindParts[1]; + } + return 'kind_' + kindParts[1]; + } + } + if (key === 'label.source') { + return 'theme_defined_in'; + } + return 'theme_' + camelToSnakeCase(key.replace(/\./g, '_')); +} diff --git a/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts b/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts index d619d773..3541215c 100644 --- a/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts +++ b/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts @@ -19,7 +19,6 @@ declare module 'typedoc' { hidePageTitle: boolean; indexFormat: 'list' | 'table' | 'htmlTable'; inlineDocuments: boolean; - leftAlignTableHeaders: boolean; membersWithOwnFile: ( | 'Enum' | 'Variable' @@ -40,12 +39,14 @@ declare module 'typedoc' { propertiesFormat: 'list' | 'table' | 'htmlTable'; publicPath: string; sanitizeComments: boolean; - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: boolean; + hideFlags: boolean; hideInherited: boolean; hideModifiers: boolean; hideOverrides: boolean; hideSources: boolean; + leftAlignHeaders: boolean; }; textContentMappings: ManuallyValidatedOption>; typeDeclarationFormat: 'list' | 'table' | 'htmlTable'; @@ -63,6 +64,18 @@ declare module 'typedoc' { theme_title_member_page: [string, string]; theme_title_module_page: [string]; theme_footer_text: []; + theme_defined_in: []; + theme_implements: []; + theme_indexable: []; + theme_type_declaration: []; + theme_index: []; + theme_implemented_by: []; + theme_implementation_of: []; + theme_inherited_from: []; + theme_overrides: []; + theme_returns: []; + theme_re_exports: []; + theme_renames_and_re_exports: []; theme_api_index: []; theme_default_value: []; theme_description: []; @@ -76,7 +89,6 @@ declare module 'typedoc' { theme_modifier: []; theme_name: []; theme_packages: []; - theme_source: []; theme_type: []; theme_value: []; theme_version: []; diff --git a/packages/typedoc-plugin-markdown/src/index.ts b/packages/typedoc-plugin-markdown/src/index.ts index c156e4cf..c330f1ca 100644 --- a/packages/typedoc-plugin-markdown/src/index.ts +++ b/packages/typedoc-plugin-markdown/src/index.ts @@ -15,6 +15,7 @@ import { Renderer, Theme, } from 'typedoc'; +import { getTranslatable } from './app/translatable'; /** * The function that is called by TypeDoc to bootstrap the plugin. https://typedoc.org/guides/development/#plugins. @@ -42,16 +43,9 @@ export function load(app: Application) { } as DeclarationOption); }); - /** - * ========================================= - * 2. Extend locale with plugin translations - * ========================================= - */ - //app.internationalization.addTranslations('en', getTranslatable(app)); - /** * ================================================= - * 3. Intercept and modify some TypeDoc core methods + * 2. Intercept and modify some TypeDoc core methods * ================================================= * * Currently the TypeDoc {@link Renderer} class is quite coupled to the HTML theme so we override a couple of core methods. @@ -90,7 +84,20 @@ export function load(app: Application) { /** * ============================ - * 3. Apply any other behaviour + * 3. Configure localization + * ============================ + */ + app.converter.on(Converter.EVENT_BEGIN, () => { + app.internationalization.addTranslations( + app.options.getValue('lang'), + { ...getTranslatable(app), ...app.options.getValue('locales') }, + true, + ); + }); + + /** + * ============================ + * 4. Apply any other behaviour * ============================ */ diff --git a/packages/typedoc-plugin-markdown/src/options/declarations.ts b/packages/typedoc-plugin-markdown/src/options/declarations.ts index 61467314..9081a659 100644 --- a/packages/typedoc-plugin-markdown/src/options/declarations.ts +++ b/packages/typedoc-plugin-markdown/src/options/declarations.ts @@ -332,7 +332,7 @@ export const expandParameters: Partial = { * * - **"list"**: parameters are output as bullet points in a linear list, suitable for more detailed comments. * - **"table"**: parameters are output within a markdown table, condensed into a single paragraph. - * - **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format. + * - **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format * * @category Display */ @@ -405,6 +405,50 @@ export const indexFormat: Partial = { defaultValue: FormatStyle.List, }; +/** + * This option presents a standardize way reflection metadata are represented. + * + * The available keys are: + * + * - **"enums"**: the output format for enumeration members. + * - **"parameters"**: the output format for parameters and type parameters of functions and class methods. + * - **"properties"**: the output format for class and interface properties. + * - **"typeDeclarations"**: the output format for type definitions. + * + * The available values are: + * + * - **"list"**: declarations are output in linear blocks with headings, suitable for more detailed comments. + * - **"table"**: declarations are output within a markdown table, condensed into a single paragraph. + * - **"htmlTable"**: declarations are output in an HTML table, enabling block elements to render in tabular format. + * + * @category Display + */ +/*export const reflectionFormats: Partial = { + help: 'Specify the render format for reflections.', + type: ParameterType.Object, + defaultValue: { + enums: FormatStyle.List, + parameters: FormatStyle.List, + properties: FormatStyle.List, + typeDeclarations: FormatStyle.List, + }, +};*/ + +/** + * Specifies how indexes are rendered. + * + * @category Display + */ +/*export const indexFormats: Partial = { + help: 'Specify the render format for indexes.', + type: ParameterType.Object, + defaultValue: { + members: FormatStyle.List, + documents: FormatStyle.List, + packages: FormatStyle.List, + }, +};*/ + /** * By default, all available data for symbols are displayed in table columns. * @@ -412,17 +456,19 @@ export const indexFormat: Partial = { * * @category Display */ -export const tableColumnVisibility: Partial = { +/*export const tableColumnSettings: Partial = { help: 'Control header alignment and column visibility in tables.', type: ParameterType.Flags, defaults: { hideDefaults: false, + hideFlags: false, hideInherited: false, hideModifiers: false, hideOverrides: false, hideSources: false, + hideTypes: false, }, -}; +};*/ /** * By default table alignment is not specified which means the table headings will typically be centred. @@ -431,10 +477,31 @@ export const tableColumnVisibility: Partial = { * * @category Display */ -export const leftAlignTableHeaders: Partial = { - help: 'Left aligns items in table headers', - type: ParameterType.Boolean, - defaultValue: false, +//export const leftAlignTableHeaders: Partial = { +// help: 'Left aligns items in table headers', +/// type: ParameterType.Boolean, +// defaultValue: false, +//}; + +/** + * By default, all available data for symbols are displayed in table columns. + * + * This option allows you to control the visibility of columns, prioritizing readability over displaying complete data. + * + * @category Display + */ +export const tableColumnSettings: Partial = { + help: 'Control header alignment and column visibility in tables.', + type: ParameterType.Flags, + defaults: { + hideDefaults: false, + hideFlags: false, + hideInherited: false, + hideModifiers: false, + hideOverrides: false, + hideSources: false, + leftAlignHeaders: false, + }, }; /** diff --git a/packages/typedoc-plugin-markdown/src/options/option-types.ts b/packages/typedoc-plugin-markdown/src/options/option-types.ts index d73ebbdd..fe104a2a 100644 --- a/packages/typedoc-plugin-markdown/src/options/option-types.ts +++ b/packages/typedoc-plugin-markdown/src/options/option-types.ts @@ -86,11 +86,6 @@ export interface PluginOptions { */ inlineDocuments: boolean; - /** - * Left aligns items in table headers - */ - leftAlignTableHeaders: boolean; - /** * Determines which members are exported to their own file when `outputFileStrategy` equals `members`. */ @@ -150,12 +145,14 @@ export interface PluginOptions { /** * Control header alignment and column visibility in tables. */ - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: boolean; + hideFlags: boolean; hideInherited: boolean; hideModifiers: boolean; hideOverrides: boolean; hideSources: boolean; + leftAlignHeaders: boolean; }; /** @@ -185,3 +182,44 @@ export interface PluginOptions { * @category Options */ export interface TextContentMappings {} + +/** + * @category Options + */ +export interface TranslatableStrings { + theme_header_title: [string, string]; + theme_header_docs: []; + theme_breadcrumbs_home: [string, string]; + theme_title_index_page: [string, string]; + theme_title_member_page: [string, string]; + theme_title_module_page: [string]; + theme_footer_text: []; + theme_defined_in: []; + theme_implements: []; + theme_indexable: []; + theme_type_declaration: []; + theme_index: []; + theme_implemented_by: []; + theme_implementation_of: []; + theme_inherited_from: []; + theme_overrides: []; + theme_returns: []; + theme_re_exports: []; + theme_renames_and_re_exports: []; + theme_api_index: []; + theme_default_value: []; + theme_description: []; + theme_event: []; + theme_extends: []; + theme_extended_by: []; + theme_flags: []; + theme_globals: []; + theme_member: []; + theme_member_plural: []; + theme_modifier: []; + theme_name: []; + theme_packages: []; + theme_type: []; + theme_value: []; + theme_version: []; +} diff --git a/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts b/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts index e3ca5ab4..ee4dda14 100644 --- a/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts +++ b/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts @@ -556,7 +556,8 @@ export class UrlBuilder { if (!htmlTableAnchors) { if ( (reflection.kind === ReflectionKind.Property && - this.options.getValue('propertiesFormat') === 'table') || + this.options.getValue('propertiesFormat').toLowerCase() === + 'table') || (reflection.kind === ReflectionKind.EnumMember && this.options.getValue('enumMembersFormat') === 'table') ) { diff --git a/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts b/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts index 65923bf1..79ac5d29 100644 --- a/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts +++ b/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts @@ -1,6 +1,4 @@ -import { MarkdownRenderer } from '@plugin/app/application'; import { MarkdownPageEvent } from '@plugin/app/events'; -import { getTranslatable } from '@plugin/app/translatable'; import { formatMarkdown } from '@plugin/libs/utils'; import { OutputFileStrategy } from '@plugin/options'; import { RenderTemplate } from '@plugin/theme'; @@ -40,23 +38,6 @@ import { MarkdownThemeContext } from './markdown-themecontext'; * @category Theme */ export class MarkdownTheme extends Theme { - /** - * The text content mappings for the theme. This is a combination of the default mappings and any mappings provided in the plugin options. - * - * @internal - */ - - /** - * @ignore - */ - constructor(renderer: MarkdownRenderer) { - super(renderer); - this.application.internationalization.addTranslations( - 'en', - getTranslatable(this.application), - ); - } - /** * Renders a template and page model to a string. * diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-comment-parts.ts b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-comment-parts.ts new file mode 100644 index 00000000..7f63e1f9 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-comment-parts.ts @@ -0,0 +1,70 @@ +import { link } from '@plugin/libs/markdown'; +import { MarkdownThemeContext } from '@plugin/theme'; +import * as fs from 'fs'; +import { CommentDisplayPart, InlineTagDisplayPart } from 'typedoc'; + +export function getCommentParts( + this: MarkdownThemeContext, + model: CommentDisplayPart[], +): string { + const md: string[] = []; + for (const part of model) { + switch (part.kind) { + case 'text': + md.push(part.text); + break; + case 'code': + md.push(part.text); + break; + case 'inline-tag': + switch (part.tag) { + case '@label': + case '@inheritdoc': + break; + case '@link': + case '@linkcode': + case '@linkplain': { + if (part.target) { + const url = getUrl(part); + const wrap = part.tag === '@linkcode' ? '`' : ''; + md.push( + url + ? `${link(`${wrap}${part.text}${wrap}`, this.getRelativeUrl(url))}` + : part.text, + ); + } else { + md.push(part.text); + } + break; + } + default: + md.push(`{${part.tag} ${part.text}}`); + break; + } + break; + default: + md.push(''); + } + } + return md.join(''); +} + +function getUrl(part: InlineTagDisplayPart) { + if ((part.target as any).url) { + return (part.target as any).url; + } + + if ((part.target as any)?.parent?.url) { + return (part.target as any)?.parent?.url; + } + + return typeof part.target === 'string' ? part.target : ''; +} + +export function isFile(file: string) { + try { + return fs.statSync(file).isFile(); + } catch { + return false; + } +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts index 4b2cd83d..640307a5 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts @@ -11,7 +11,9 @@ export function getGroupIndexTable( this: MarkdownThemeContext, children: DeclarationReflection[] | DocumentReflection[], ) { - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const leftAlignHeadings = this.options.getValue( + 'tableColumnSettings', + ).leftAlignHeaders; const headers = [ this.options.getValue('excludeGroups') || this.options.getValue('hideGroupHeadings') diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/use-table.format.ts b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/use-table.format.ts new file mode 100644 index 00000000..0a5c0a86 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/resources/helpers/use-table.format.ts @@ -0,0 +1,24 @@ +import { MarkdownThemeContext } from 'public-api'; + +export function useTableFormat( + this: MarkdownThemeContext, + key: 'properties' | 'parameters' | 'enums' | 'typeDeclarations', +): boolean { + if (key === 'parameters') { + return isTable(this.options.getValue('parametersFormat')); + } + if (key === 'properties') { + return isTable(this.options.getValue('propertiesFormat')); + } + if (key === 'enums') { + return isTable(this.options.getValue('enumMembersFormat')); + } + if (key === 'typeDeclarations') { + return isTable(this.options.getValue('typeDeclarationFormat')); + } + return false; +} + +function isTable(key: string) { + return key.toLowerCase().includes('table'); +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/index.ts b/packages/typedoc-plugin-markdown/src/theme/resources/index.ts index 6b22c773..605faf81 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/index.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/index.ts @@ -60,7 +60,7 @@ import { memberTitle } from './partials/member.memberTitle'; import { memberWithGroups } from './partials/member.memberWithGroups'; import { parametersList } from './partials/member.parametersList'; import { parametersTable } from './partials/member.parametersTable'; -import { declarationsTable } from './partials/member.propertiesTable'; +import { propertiesTable } from './partials/member.propertiesTable'; import { referenceMember } from './partials/member.reference'; import { reflectionFlags } from './partials/member.reflectionFlags'; import { reflectionIndex } from './partials/member.reflectionIndex'; @@ -102,6 +102,7 @@ import { typeOperatorType } from './partials/type.type-operator'; import { unionType } from './partials/type.union'; import { unknownType } from './partials/type.unknown'; +import { getCommentParts } from './helpers/get-comment-parts'; import { getDeclarationType } from './helpers/get-declaration-type'; import { getDescriptionForReflection } from './helpers/get-description-for-reflection'; import { getFlattenedDeclarations } from './helpers/get-flattened-declarations'; @@ -115,6 +116,7 @@ import { getParameterDefaultValue } from './helpers/get-parameter-default-value' import { getPropertyDefaultValue } from './helpers/get-property-default-value'; import { getReturnType } from './helpers/get-return-type'; import { isGroupKind } from './helpers/is-group-kind'; +import { useTableFormat } from './helpers/use-table.format'; export const templates = (context: MarkdownThemeContext) => { return { @@ -300,10 +302,10 @@ There is no association list partial for properties as these are handled as a st * @category Member Partials * */ - declarationsTable: ( + propertiesTable: ( model: DeclarationReflection[], options?: { isEventProps: boolean } | undefined, - ) => declarationsTable.apply(context, [model, options]) as string, + ) => propertiesTable.apply(context, [model, options]) as string, /** * Renders an reference member. * @category Member Partials @@ -576,6 +578,8 @@ There is no association list partial for properties as these are handled as a st export const helpers = (context: MarkdownThemeContext) => { return { + getCommentParts: (model: CommentDisplayPart[]) => + getCommentParts.apply(context, [model]) as string, getDeclarationType: (model: DeclarationReflection) => getDeclarationType.apply(context, [model]) as SomeType | undefined, getDescriptionForReflection: (model: DeclarationReflection) => @@ -612,5 +616,8 @@ export const helpers = (context: MarkdownThemeContext) => { getReturnType.apply(context, [model]) as string, isGroupKind: (model: DeclarationReflection | SignatureReflection) => isGroupKind.apply(context, [model]) as boolean, + useTableFormat: ( + key: 'properties' | 'parameters' | 'enums' | 'typeDeclarations', + ) => useTableFormat.apply(context, [key]) as boolean, }; }; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts index e39846c9..4218f77e 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts @@ -28,7 +28,7 @@ export function comment( const md: string[] = []; if (opts.showSummary && model.summary?.length > 0) { - md.push(this.partials.commentParts(model.summary)); + md.push(this.helpers.getCommentParts(model.summary)); } if (opts.showTags && model.blockTags?.length) { diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts index 24c2a207..9da01007 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts @@ -26,7 +26,8 @@ export function groups( return groupTitle; }; - groupsWithChildren?.forEach((group, index: number) => { + groupsWithChildren?.forEach((group) => { + const isEventProps = getGroupTitle(group.title) === 'Events'; if (group.categories) { md.push(heading(options.headingLevel, getGroupTitle(group.title))); if (group.description) { @@ -50,28 +51,17 @@ export function groups( if (group.description) { md.push(this.partials.commentParts(group.description)); } - if ( - isPropertiesGroup && - this.options - .getValue('propertiesFormat') - .toLowerCase() - .includes('table') - ) { + + if (isPropertiesGroup && this.helpers.useTableFormat('properties')) { md.push( - this.partials.declarationsTable( + this.partials.propertiesTable( group.children as DeclarationReflection[], { - isEventProps: getGroupTitle(group.title) === 'Events', + isEventProps, }, ), ); - } else if ( - isEnumGroup && - this.options - .getValue('enumMembersFormat') - .toLowerCase() - .includes('table') - ) { + } else if (isEnumGroup && this.helpers.useTableFormat('enums')) { md.push( this.partials.enumMembersTable( group.children as DeclarationReflection[], diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts index 429fe38d..7fb99d01 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts @@ -50,7 +50,7 @@ export function accessor( this.internationalization.kindPluralString(ReflectionKind.Parameter), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.parametersTable(model.setSignature.parameters)); } else { md.push(this.partials.parametersList(model.setSignature.parameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts index f85f29b7..6068601d 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts @@ -105,9 +105,7 @@ export function declaration( ), ), ); - if ( - this.options.getValue('parametersFormat').toLowerCase().includes('table') - ) { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); @@ -136,7 +134,7 @@ export function declaration( if (typeDeclaration?.children?.length) { const useHeading = model.kind !== ReflectionKind.Property || - this.options.getValue('propertiesFormat') == 'table'; + this.helpers.useTableFormat('properties'); if (!opts.nested && typeDeclaration?.children?.length) { if (useHeading) { md.push( diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts index 620e2150..e3d23df7 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts @@ -12,8 +12,8 @@ export function enumMembersTable( this: MarkdownThemeContext, model: DeclarationReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const comments = model.map((param) => !!param.comment?.hasVisibleComponent()); const hasComments = comments.some((value) => Boolean(value)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts index 5955252f..4344f791 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts @@ -39,7 +39,7 @@ export function memberWithGroups( ), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts index 312d23c3..27d4eb3e 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts @@ -10,8 +10,8 @@ export function parametersTable( this: MarkdownThemeContext, model: ParameterReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const parseParams = (current: any, acc: any) => { const shouldFlatten = diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts index 6664b77f..ff83d609 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts @@ -17,13 +17,14 @@ import { getPropertyDefaultValue } from '../helpers/get-property-default-value'; * @category Member Partials * */ -export function declarationsTable( +export function propertiesTable( this: MarkdownThemeContext, model: DeclarationReflection[], options?: { isEventProps: boolean }, ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + //const reflectionFormats = this.options.getValue('reflectionFormats'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const modifiers = model.map((param) => this.helpers.getModifier(param)?.toString(), ); @@ -33,7 +34,8 @@ export function declarationsTable( modifiers.some((value) => Boolean(value)); const flags = model.map((param) => this.partials.reflectionFlags(param)); - const hasFlags = flags.some((value) => Boolean(value)); + const hasFlags = + !tableColumnsOptions.hideModifiers && flags.some((value) => Boolean(value)); const hasOverrides = !tableColumnsOptions.hideOverrides && @@ -43,9 +45,9 @@ export function declarationsTable( !tableColumnsOptions.hideInherited && model.some((prop) => Boolean(prop.inheritedFrom)); - const hasDefaults = model.some((prop) => - Boolean(getPropertyDefaultValue(prop)), - ); + const hasDefaults = + !tableColumnsOptions.hideDefaults && + model.some((prop) => Boolean(getPropertyDefaultValue(prop))); const hasComments = model.some( (prop) => prop.comment?.blockTags?.length || prop?.comment?.summary?.length, ); @@ -125,7 +127,7 @@ export function declarationsTable( } if (hasFlags) { - row.push(flags[index]); + row.push(flags[index] || '-'); } if (propertyType) { @@ -177,7 +179,10 @@ export function declarationsTable( rows.push(row); }); - return this.options.getValue('propertiesFormat') == 'table' - ? table(headers, rows, leftAlignHeadings) - : htmlTable(headers, rows, leftAlignHeadings); + const displayHtmlTable = + this.options.getValue('propertiesFormat') === 'htmlTable'; + + return displayHtmlTable + ? htmlTable(headers, rows, leftAlignHeadings) + : table(headers, rows, leftAlignHeadings); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts index 7f463b57..60bb39a6 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts @@ -60,7 +60,7 @@ export function signature( ), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); @@ -74,7 +74,7 @@ export function signature( this.internationalization.kindPluralString(ReflectionKind.Parameter), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.parametersTable(model.parameters)); } else { md.push(this.partials.parametersList(model.parameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts index 0fb3249e..c45df9c0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts @@ -14,7 +14,7 @@ export function sources( const md: string[] = []; if (options.headingLevel !== -1) { - md.push(heading(options.headingLevel, this.i18n.theme_source())); + md.push(heading(options.headingLevel, this.i18n.theme_defined_in())); } model.sources?.forEach((source, index) => { if (index === 0) { diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts index 83c45631..d530b1aa 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts @@ -10,8 +10,8 @@ export function typeDeclarationTable( this: MarkdownThemeContext, model: DeclarationReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const hasSources = !tableColumnsOptions.hideSources && diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts index 0c2b2de7..6463202a 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts @@ -9,8 +9,8 @@ export function typeParametersTable( this: MarkdownThemeContext, model: TypeParameterReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + //const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); const hasDefault = !tableColumnsOptions.hideDefaults && @@ -70,6 +70,6 @@ export function typeParametersTable( }); return this.options.getValue('parametersFormat') == 'table' - ? table(headers, rows, leftAlignHeadings) - : htmlTable(headers, rows, leftAlignHeadings); + ? table(headers, rows, tableColumnsOptions.leftAlignHeaders) + : htmlTable(headers, rows, tableColumnsOptions.leftAlignHeaders); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts index de357696..3c25bcd2 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts +++ b/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts @@ -11,7 +11,9 @@ export function packagesIndex( this: MarkdownThemeContext, model: ProjectReflection, ): string { - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const leftAlignHeadings = this.options.getValue( + 'tableColumnSettings', + ).leftAlignHeaders; const md: string[] = []; diff --git a/packages/typedoc-plugin-markdown/test/fixtures/config.ts b/packages/typedoc-plugin-markdown/test/fixtures/config.ts index 38b29afb..e9c92935 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/config.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/config.ts @@ -12,10 +12,10 @@ const config: Record = { ], hidePageHeader: true, hideBreadcrumbs: true, - tableColumnVisibility: { + tableColumnSettings: { hideSources: true, + leftAlignHeaders: true, }, - leftAlignTableHeaders: true, }, options: [ {}, @@ -43,7 +43,9 @@ const config: Record = { disableSources: true, expandObjects: true, expandParameters: true, - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ {}, @@ -91,7 +93,9 @@ const config: Record = { theme: 'stub-groups', disableSources: true, entryFileName: 'index.md', - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ { @@ -146,14 +150,15 @@ const config: Record = { parametersFormat: 'htmlTable', propertiesFormat: 'htmlTable', typeDeclarationFormat: 'htmlTable', - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: true, + hideFlags: true, hideInherited: true, hideModifiers: true, hideOverrides: true, hideSources: true, + leftAlignHeaders: true, }, - leftAlignTableHeaders: true, }, ], }, @@ -165,7 +170,9 @@ const config: Record = { entryPointStrategy: 'packages', name: 'packages-example', disableSources: true, - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ { entryFileName: 'index.md' }, @@ -228,13 +235,17 @@ const config: Record = { commonOptions: { plugin: [path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs')], disableSources: true, - leftAlignTableHeaders: true, + tableColumnSettings: { leftAlignHeaders: true }, + includeVersion: true, + propertiesFormat: 'table', + readme: 'none', }, options: [ { - includeVersion: true, + options: './test/fixtures/typedoc.legacy-text-options.cjs', + }, + { options: './test/fixtures/typedoc.text-options.cjs', - propertiesFormat: 'table', }, ], }, diff --git a/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts b/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts index 5c721147..7fc1cbef 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts @@ -151,6 +151,9 @@ export class BaseClassProperties { } export class ClassPropertiesTable extends BaseClassProperties { + /** @experimental */ + propWithFlag: string; + propA = 'propAValue'; /** * The subroutine recursively parsed the hexadecimal data. diff --git a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.legacy-text-options.cjs b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.legacy-text-options.cjs new file mode 100644 index 00000000..168b5348 --- /dev/null +++ b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.legacy-text-options.cjs @@ -0,0 +1,23 @@ +// @ts-check + +const baseOptions = require('../../../../devtools/packages/fixtures/typedoc.cjs'); + +/** @type {import('typedoc').TypeDocOptions} */ +module.exports = { + ...baseOptions, + textContentMappings: { + 'header.title': 'My API - {version}', + 'header.docs': 'API', + 'footer.text': 'Copyright Test', + 'title.indexPage': ':tada: Custom Index Title', + 'title.memberPage': '{name}', + 'title.modulePage': '{kind} - {name}', + 'kind.interface.plural': '多变的', + 'kind.variable.plural': 'CoolVars', + }, + locales: { + en: { + theme_index: 'TOC', + }, + }, +}; diff --git a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs index 220f2730..f9837f3c 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs +++ b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs @@ -1,17 +1,21 @@ +// @ts-check + const baseOptions = require('../../../../devtools/packages/fixtures/typedoc.cjs'); + +/** @type {import('typedoc').TypeDocOptions} */ module.exports = { ...baseOptions, - textContentMappings: { - 'header.title': 'My API - {version}', - 'header.docs': 'API', - 'footer.text': 'Copyright Test', - 'title.indexPage': ':tada: Custom Index Title', - 'title.memberPage': '{name}', - 'title.modulePage': '{kind} - {name}', - 'label.source': 'Defined In', - 'kind.event.plural': 'My Events', - 'kind.event.singular': 'Event!', - 'kind.interface.plural': '多变的', - 'kind.variable.plural': 'CoolVars', + lang: 'fr', + locales: { + fr: { + theme_header_title: 'My API - {1} (fr)', + theme_header_docs: 'API (fr)', + theme_footer_text: 'Copyright Test (fr)', + theme_title_index_page: ':tada: Custom Index Title (fr)', + theme_title_member_page: '{0} (fr)', + theme_event: 'Event!', + kind_plural_interface: 'Interfaces (fr)', + kind_plural_variable: 'CoolVars (fr)', + }, }, }; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap index 6f8b111f..cd7520e3 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap @@ -116,7 +116,7 @@ exports[`Comments should get tables for emum: (Output File Strategy "members") ( ## Enumeration Members -| Enumeration Member | Value | Description | Defined in | +| Enumeration Member | Value | Description | Source | | ------ | ------ | ------ | ------ | | \`member1\` | \`"member1"\` | The subroutine recursively parsed the hexadecimal data. | [index.ts:1](http://source-url) | " @@ -165,7 +165,7 @@ Adds two numbers together. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | ------ | ------ | ------ | ------ | | \`param1\` | \`number\` | \`undefined\` | The first param to be added. | | \`param2\` | \`number\` | \`undefined\` | The second param to be added. Some additional text for num2. | @@ -204,13 +204,14 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe ## Properties -| Property | Modifier | Type | Default Value | Description | Overrides | Inherited from | Defined in | -| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | -| \`prop1\` | \`private\` | \`boolean\` | \`undefined\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | - | - | [index.ts:1](http://source-url) | -| \`prop2\` | \`readonly\` | \`RegExp\` | \`undefined\` | Below is a breakdown of the notable performances: - The CPU executed the instruction set in parallel with the GPU computations. - The RAM efficiently cached the frequently accessed data for faster retrieval. - The SSD accessed the stored files with lightning speed due to its high read/write capabilities. | - | - | [index.ts:1](http://source-url) | -| \`prop3?\` | \`public\` | \`string\` | \`undefined\` | > Example of Triple Code Block \`def greet(name): print("Hello, " + name + "!")\` | - | - | [index.ts:1](http://source-url) | -| ~~\`propA\`~~ | \`public\` | \`string\` | \`'propAValue'\` | **Deprecated** | [\`BaseClassProperties\`](BaseClassProperties.md).\`propA\` | - | [index.ts:1](http://source-url) | -| \`propB\` | \`public\` | \`string\` | \`undefined\` | - | - | [\`BaseClassProperties\`](BaseClassProperties.md).\`propB\` | [index.ts:1](http://source-url) | +| Property | Modifier | Flags | Type | Default value | Description | Overrides | Inherited from | Source | +| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | +| \`prop1\` | \`private\` | - | \`boolean\` | \`undefined\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | - | - | [index.ts:1](http://source-url) | +| \`prop2\` | \`readonly\` | - | \`RegExp\` | \`undefined\` | Below is a breakdown of the notable performances: - The CPU executed the instruction set in parallel with the GPU computations. - The RAM efficiently cached the frequently accessed data for faster retrieval. - The SSD accessed the stored files with lightning speed due to its high read/write capabilities. | - | - | [index.ts:1](http://source-url) | +| \`prop3?\` | \`public\` | - | \`string\` | \`undefined\` | > Example of Triple Code Block \`def greet(name): print("Hello, " + name + "!")\` | - | - | [index.ts:1](http://source-url) | +| ~~\`propA\`~~ | \`public\` | - | \`string\` | \`'propAValue'\` | **Deprecated** | [\`BaseClassProperties\`](BaseClassProperties.md).\`propA\` | - | [index.ts:1](http://source-url) | +| \`propB\` | \`public\` | - | \`string\` | \`undefined\` | - | - | [\`BaseClassProperties\`](BaseClassProperties.md).\`propB\` | [index.ts:1](http://source-url) | +| \`propWithFlag\` | \`public\` | \`Experimental\` | \`string\` | \`undefined\` | - | - | - | [index.ts:1](http://source-url) | " `; @@ -240,7 +241,7 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe ## Properties - + - - - - @@ -352,7 +333,19 @@ print("Hello, " + name + "!") + + + +
PropertyTypeDefault ValueDescription
PropertyTypeDescription
@@ -254,11 +255,6 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe -\`undefined\` - - - The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. @@ -277,11 +273,6 @@ to generate the binary output for input validation. -\`undefined\` - - - Below is a breakdown of the notable performances: - The CPU executed the instruction set in parallel with the GPU computations. @@ -303,11 +294,6 @@ Below is a breakdown of the notable performances: -\`undefined\` - - - > Example of Triple Code Block \`\`\`python @@ -330,11 +316,6 @@ print("Hello, " + name + "!") -\`'propAValue'\` - - - **Deprecated** -\`undefined\` +‐ + +
+ + \`propWithFlag\` + + + +\`string\` @@ -372,7 +365,7 @@ exports[`Comments should get tables for type declarations: (Output File Strategy ## Type declaration -| Member | Type | Description | Defined in | +| Member | Type | Description | Source | | ------ | ------ | ------ | ------ | | \`declaration1\` | \`boolean\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | [index.ts:1](http://source-url) | | \`declaration2\` | \`boolean\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | [index.ts:1](http://source-url) | diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap index 05150ad2..a6ed4e42 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap @@ -5,7 +5,7 @@ exports[`Objects And Params should compile basic interface: (Output File Strateg Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -196,7 +196,7 @@ exports[`Objects And Params should compile basic interface: (Output File Strateg Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap index 1f71999e..630a0170 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap @@ -3,7 +3,7 @@ exports[`Class Reflection should compile abstract class: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Class: \`abstract\` AbstractClass -## Extended By +## Extended by - [\`DerivedClassA\`](DerivedClassA.md) - [\`DerivedClassB\`](DerivedClassB.md) @@ -51,7 +51,7 @@ Comments for abstractMethod exports[`Class Reflection should compile abstract class: (Output File Strategy "members") (Option Group "2") 1`] = ` "# Class: \`abstract\` AbstractClass -## Extended By +## Extended by - [\`DerivedClassA\`](DerivedClassA.md) - [\`DerivedClassB\`](DerivedClassB.md) @@ -418,7 +418,7 @@ new ClassWithComplexProps(): ClassWithComplexProps ## Properties -| Property | Type | Default Value | +| Property | Type | Default value | | :------ | :------ | :------ | | \`objecLiteralProp\` | \`object\` | \`...\` | | \`objecLiteralProp.someFunction\` | (\`a\`: \`string\`) => \`string\` | \`...\` | @@ -838,7 +838,7 @@ new ClassWithModifiers(): ClassWithModifiers ## Properties -| Property | Modifier | Type | Default Value | Description | +| Property | Modifier | Type | Default value | Description | | :------ | :------ | :------ | :------ | :------ | | \`privateProp\` | \`private\` | \`string\` | \`undefined\` | Comments for privateProp | | \`protectedProp\` | \`protected\` | \`string\` | \`undefined\` | Comments for protectedProp | @@ -999,7 +999,7 @@ new ClassWithSimpleProps(): ClassWithSimpleProps ## Properties -| Property | Type | Default Value | Description | +| Property | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`propA\` | \`string\` | \`'propAValue'\` | Comments for propA | | \`propB\` | \`string\` | \`'propBDefaultValue'\` | Comments for propB | @@ -1219,7 +1219,7 @@ new DerivedClassA(): DerivedClassA ## Properties -| Property | Type | Default Value | Description | Overrides | +| Property | Type | Default value | Description | Overrides | | :------ | :------ | :------ | :------ | :------ | | \`abstractProp\` | \`string\` | \`'abstractProp'\` | Comments for abstractProp | [\`AbstractClass\`](AbstractClass.md).\`abstractProp\` | | \`derivedProp\` | \`string\` | \`undefined\` | - | - | @@ -1304,7 +1304,7 @@ exports[`Class Reflection should compile disposable class: (Output File Strategy exports[`Class Reflection should compile hierarchy for BaseClass: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Class: BaseClass -## Extended By +## Extended by - [\`ChildClassA\`](ChildClassA.md) - [\`ChildClassB\`](ChildClassB.md) @@ -1328,7 +1328,7 @@ exports[`Class Reflection should compile hierarchy for ChildClassA: (Output File - [\`BaseClass\`](BaseClass.md) -## Extended By +## Extended by - [\`GrandChildClassA\`](GrandChildClassA.md) - [\`GrandChildClassB\`](GrandChildClassB.md) diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap index 0fe1fe72..57421b04 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap @@ -415,7 +415,7 @@ This is a function with a parameter that has a default value. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`valueA\` | \`string\` | \`'defaultValue'\` | A parameter with a default string value. | | \`valueB\` | \`number\` | \`100\` | A parameter with a default numeric value. | @@ -753,7 +753,7 @@ This is a function with a parameters. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`firstParamWithDefault\` | \`boolean\` | \`true\` | - | | \`requiredParam\` | \`string\` | \`undefined\` | A normal parameter. | @@ -785,7 +785,7 @@ This is a function with a parameters. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`firstParamWithDefault\` | \`boolean\` | \`true\` | - | | \`requiredParam\` | \`string\` | \`undefined\` | A normal parameter. | diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap index 0378b01d..aedeb548 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap @@ -5,7 +5,7 @@ exports[`Interface Reflection should compile basic interface: (Output File Strat Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -236,7 +236,7 @@ exports[`Interface Reflection should compile basic interface: (Output File Strat Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap index fae1e209..9c411583 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Text should get translations for index page: (Output File Strategy "members") (Option Group "1") 1`] = ` -"[**My API - v0.0**](README.md) • **API** +"**My API - v0.0** • **API** *** @@ -18,12 +18,30 @@ Copyright Test " `; +exports[`Text should get translations for index page: (Output File Strategy "members") (Option Group "2") 1`] = ` +"**My API - v0.0 (fr)** • **API (fr)** + +*** + +# :tada: Custom Index Title (fr) + +## Modules + +- [module-1](module-1/README.md) +- [module-2](module-2/README.md) + +*** + +Copyright Test (fr) +" +`; + exports[`Text should get translations for member page: (Output File Strategy "members") (Option Group "1") 1`] = ` "[**My API - v0.0**](../../README.md) • **API** *** -[typedoc-stubs v0.0](../../modules.md) / [module-1](../README.md) / SomeInterface +[typedoc-stubs v0.0](../../README.md) / [module-1](../README.md) / SomeInterface # SomeInterface @@ -50,13 +68,13 @@ exports[`Text should get translations for module page: (Output File Strategy "me *** -[typedoc-stubs v0.0](../modules.md) / module-1 +[typedoc-stubs v0.0](../README.md) / module-1 # module-1 - module-1 -## Index +## TOC -### Interfaces +### 多变的 - [SomeInterface](interfaces/SomeInterface.md) @@ -71,11 +89,11 @@ exports[`Text should get translations for modules page: (Output File Strategy "m *** -[typedoc-stubs v0.0](modules.md) / module-2 +[typedoc-stubs v0.0](README.md) / module-2 # module-2 - module-2 -## Variables +## CoolVars ### constA @@ -95,7 +113,7 @@ exports[`Text should get translations for sidebar: (Output File Strategy "member "path": "module-1/README.md", "children": [ { - "title": "Interfaces", + "title": "多变的", "children": [ { "title": "SomeInterface", @@ -112,7 +130,7 @@ exports[`Text should get translations for sidebar: (Output File Strategy "member "path": "module-2/README.md", "children": [ { - "title": "Variables", + "title": "CoolVars", "children": [ { "title": "constA", diff --git a/packages/typedoc-plugin-markdown/test/specs/text.spec.ts b/packages/typedoc-plugin-markdown/test/specs/text.spec.ts index ee7a8dad..46c4e64c 100644 --- a/packages/typedoc-plugin-markdown/test/specs/text.spec.ts +++ b/packages/typedoc-plugin-markdown/test/specs/text.spec.ts @@ -2,7 +2,7 @@ import { expectFileToEqual } from '@devtools/testing'; describe(`Text`, () => { test(`should get translations for index page`, () => { - expectFileToEqual('text', 'members', ['modules.md']); + expectFileToEqual('text', 'members', 'README.md'); }); test(`should get translations for module page`, () => {