From aff7c1ac884ed102c222aab4a7bb42324d7cf886 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 8f50c816..9b1aed99 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 1b052573..9b37126c 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 780b5db5..72ab36c3 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. @@ -304,8 +304,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, }; /** @@ -320,8 +320,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, }; /** @@ -336,8 +336,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, }; /** @@ -352,8 +352,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, }; /** @@ -368,8 +368,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, }; /** @@ -384,8 +384,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, }; /** @@ -402,8 +402,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, }; /** @@ -416,8 +416,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 87a2afa7..973d146b 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 1e44094f..f3f7f5fe 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.