From a2a2ae2bfe012c6b2eee225f2d575d773af666b2 Mon Sep 17 00:00:00 2001 From: tgreyuk Date: Sat, 22 Jun 2024 21:44:43 +0100 Subject: [PATCH] fix(core): allow htmlTable format key for indexes (#618) --- docs/pages/docs/options/display-options.mdx | 2 +- .../typedoc-plugin-markdown/src/_typedoc.d.ts | 2 +- .../src/options/declarations.ts | 34 +++++++++---------- .../src/options/maps.ts | 12 ++----- .../src/types/options.ts | 2 +- 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/docs/pages/docs/options/display-options.mdx b/docs/pages/docs/options/display-options.mdx index 8f50c8162..9b1aed99d 100644 --- a/docs/pages/docs/options/display-options.mdx +++ b/docs/pages/docs/options/display-options.mdx @@ -115,7 +115,7 @@ This option should be set when a full type representation is preferred. Sets the format of index items. -> Accepts either `"list"` or `"table"`. Defaults to `"list"`. +> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. This option renders index items either as a simple unordered list or in a table. diff --git a/packages/typedoc-plugin-markdown/src/_typedoc.d.ts b/packages/typedoc-plugin-markdown/src/_typedoc.d.ts index 1b0525737..9b37126c6 100644 --- a/packages/typedoc-plugin-markdown/src/_typedoc.d.ts +++ b/packages/typedoc-plugin-markdown/src/_typedoc.d.ts @@ -17,7 +17,7 @@ declare module 'typedoc' { hideGroupHeadings: boolean; hidePageHeader: boolean; hidePageTitle: boolean; - indexFormat: 'list' | 'table'; + indexFormat: 'list' | 'table' | 'htmlTable'; interfacePropertiesFormat: 'list' | 'table' | 'htmlTable'; membersWithOwnFile: ( | 'Enum' diff --git a/packages/typedoc-plugin-markdown/src/options/declarations.ts b/packages/typedoc-plugin-markdown/src/options/declarations.ts index e1ee2b143..eb1fa81e7 100644 --- a/packages/typedoc-plugin-markdown/src/options/declarations.ts +++ b/packages/typedoc-plugin-markdown/src/options/declarations.ts @@ -21,7 +21,7 @@ */ import { DeclarationOption, ParameterType } from 'typedoc'; import { ALLOWED_OWN_FILE_MEMBERS, TEXT_CONTENT_MAPPINGS } from './constants'; -import { IndexFormat, OutputFileStrategy, ReflectionFormat } from './maps'; +import { DisplayFormat, OutputFileStrategy } from './maps'; /** * TypeDoc creates documentation according to exports derived from the given [`entryPointsStrategy`](https://typedoc.org/options/input/#entrypointstrategy) configuration. @@ -350,8 +350,8 @@ export const expandParameters: Partial = { export const indexFormat: Partial = { help: 'Sets the format of index items.', type: ParameterType.Map, - map: IndexFormat, - defaultValue: IndexFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -366,8 +366,8 @@ export const indexFormat: Partial = { export const parametersFormat: Partial = { help: 'Sets the format of parameter and type parameter groups.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -382,8 +382,8 @@ export const parametersFormat: Partial = { export const interfacePropertiesFormat: Partial = { help: 'Sets the format of property groups for interfaces.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -398,8 +398,8 @@ export const interfacePropertiesFormat: Partial = { export const classPropertiesFormat: Partial = { help: 'Sets the format of property groups for classes.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -414,8 +414,8 @@ export const classPropertiesFormat: Partial = { export const enumMembersFormat: Partial = { help: 'Sets the format of enumeration members.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -430,8 +430,8 @@ export const enumMembersFormat: Partial = { export const typeDeclarationFormat: Partial = { help: 'Sets the format of style for type declaration members.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -448,8 +448,8 @@ export const typeDeclarationFormat: Partial = { export const propertyMembersFormat: Partial = { help: 'Sets the format of style for property members for interfaces and classes.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** @@ -462,8 +462,8 @@ export const propertyMembersFormat: Partial = { export const propertiesFormat: Partial = { help: 'Sets the format of property groups for interfaces and classes.', type: ParameterType.Map, - map: ReflectionFormat, - defaultValue: ReflectionFormat.List, + map: DisplayFormat, + defaultValue: DisplayFormat.List, }; /** diff --git a/packages/typedoc-plugin-markdown/src/options/maps.ts b/packages/typedoc-plugin-markdown/src/options/maps.ts index 87a2afa78..973d146b0 100644 --- a/packages/typedoc-plugin-markdown/src/options/maps.ts +++ b/packages/typedoc-plugin-markdown/src/options/maps.ts @@ -13,18 +13,10 @@ export enum OutputFileStrategy { } /** - * The allowed values for formatting reflections. + * The allowed values for formatting reflections and indexes. */ -export enum ReflectionFormat { +export enum DisplayFormat { List = 'list', Table = 'table', HtmlTable = 'htmlTable', } - -/** - * The allowed values for formatting indexes. - */ -export enum IndexFormat { - List = 'list', - Table = 'table', -} diff --git a/packages/typedoc-plugin-markdown/src/types/options.ts b/packages/typedoc-plugin-markdown/src/types/options.ts index 1e44094f2..f3f7f5fe8 100644 --- a/packages/typedoc-plugin-markdown/src/types/options.ts +++ b/packages/typedoc-plugin-markdown/src/types/options.ts @@ -83,7 +83,7 @@ export interface PluginOptions { /** * Sets the format of index items. */ - indexFormat: 'list' | 'table'; + indexFormat: 'list' | 'table' | 'htmlTable'; /** * Sets the format of property groups for interfaces.