From 640b9ca306c860f35943a9277bcb5d30d7aac119 Mon Sep 17 00:00:00 2001 From: tgreyuk Date: Fri, 27 Dec 2024 23:25:23 +0000 Subject: [PATCH] feat(core): always assign header ids to linkable symbols within table rows --- .changeset/rare-pigs-drop.md | 5 ++ docs/pages/docs/options.mdx | 2 +- docs/pages/docs/options/utility-options.mdx | 9 ++- .../src/options/declarations.ts | 9 ++- .../src/theme/base/url-builder.ts | 81 ++++++------------- .../partials/member.enumMembersTable.ts | 2 +- .../partials/member.propertiesTable.ts | 2 +- .../partials/member.typeDeclarationTable.ts | 2 +- .../src/types/options.ts | 2 +- .../test/fixtures/src/comments/index.ts | 18 +++-- .../specs/__snapshots__/comments.spec.ts.snap | 24 +++--- .../objects-and-params.spec.ts.snap | 20 ++--- .../reflection.class.spec.ts.snap | 34 ++++---- .../reflection.enum.spec.ts.snap | 8 +- .../reflection.function.spec.ts.snap | 4 +- .../reflection.interface.spec.ts.snap | 60 +++++++------- .../reflection.type-alias.spec.ts.snap | 26 +++--- .../reflection.variable.spec.ts.snap | 10 +-- .../specs/__snapshots__/text.spec.ts.snap | 8 +- .../specs/__snapshots__/urls.spec.ts.snap | 2 + 20 files changed, 156 insertions(+), 172 deletions(-) create mode 100644 .changeset/rare-pigs-drop.md diff --git a/.changeset/rare-pigs-drop.md b/.changeset/rare-pigs-drop.md new file mode 100644 index 000000000..1719f0d77 --- /dev/null +++ b/.changeset/rare-pigs-drop.md @@ -0,0 +1,5 @@ +--- +'typedoc-plugin-markdown': minor +--- + +- Always assign header ids to linkable symbols within table rows. diff --git a/docs/pages/docs/options.mdx b/docs/pages/docs/options.mdx index 3d1ca3d8b..2f5496f1a 100644 --- a/docs/pages/docs/options.mdx +++ b/docs/pages/docs/options.mdx @@ -59,6 +59,6 @@ Options that are used for general configuration and utility purposes. | [`publicPath`](./options/utility-options.mdx#--publicpath) | Specify the base path for all urls. | | [`anchorPrefix`](./options/utility-options.mdx#--anchorprefix) | Custom anchor prefix when anchoring to in-page symbols. | | [`useHTMLEncodedBrackets`](./options/utility-options.mdx#--usehtmlencodedbrackets) | Use HTML encoded entities for angle brackets. | -| [`useHTMLAnchors`](./options/utility-options.mdx#--usehtmlanchors) | Add HTML named anchors to headings and table rows. | +| [`useHTMLAnchors`](./options/utility-options.mdx#--usehtmlanchors) | Add HTML anchors to page headings. | | [`preserveAnchorCasing`](./options/utility-options.mdx#--preserveanchorcasing) | Preserve anchor casing when generating link to symbols. | | [`pageTitleTemplates`](./options/utility-options.mdx#--pagetitletemplates) | Change specific text placeholders in the template. | diff --git a/docs/pages/docs/options/utility-options.mdx b/docs/pages/docs/options/utility-options.mdx index 2a81ca679..152e31844 100644 --- a/docs/pages/docs/options/utility-options.mdx +++ b/docs/pages/docs/options/utility-options.mdx @@ -118,14 +118,15 @@ However, using HTML entities (`<` and `>`) might be preferable to avoid an ## --useHTMLAnchors -Add HTML named anchors to headings and table rows. +Add HTML anchors to page headings. > Accepts a boolean value. Defaults to `false`. -This option should be used if there are issues when anchoring to symbols within a page. +By default markdown parsers normally assign header IDs to headings automatically. +This is required when cross linking to symbols within a page. +This option should be used when parsers that do not automatically assign header IDs. -- For Markdown parsers that do not automatically assign header ids. -- When cross referencing symbols that are referenced in a table row. +Note that HTML anchors will be added to linkable symbols listed in table rows as there is no alternative way to anchor to these items. ```json filename="typedoc.json" { diff --git a/packages/typedoc-plugin-markdown/src/options/declarations.ts b/packages/typedoc-plugin-markdown/src/options/declarations.ts index 78ede78ce..b26b55050 100644 --- a/packages/typedoc-plugin-markdown/src/options/declarations.ts +++ b/packages/typedoc-plugin-markdown/src/options/declarations.ts @@ -649,15 +649,16 @@ export const useHTMLEncodedBrackets: Partial = { }; /** - * This option should be used if there are issues when anchoring to symbols within a page. + * By default markdown parsers normally assign header IDs to headings automatically. + * This is required when cross linking to symbols within a page. + * This option should be used when parsers that do not automatically assign header IDs. * - * - For Markdown parsers that do not automatically assign header ids. - * - When cross referencing symbols that are referenced in a table row. + * Note that HTML anchors will be added to linkable symbols listed in table rows as there is no alternative way to anchor to these items. * * @category Utility */ export const useHTMLAnchors: Partial = { - help: 'Add HTML named anchors to headings and table rows.', + help: 'Add HTML anchors to page headings.', type: ParameterType.Boolean, defaultValue: false, }; diff --git a/packages/typedoc-plugin-markdown/src/theme/base/url-builder.ts b/packages/typedoc-plugin-markdown/src/theme/base/url-builder.ts index 4cbf7033b..7aaa039b5 100644 --- a/packages/typedoc-plugin-markdown/src/theme/base/url-builder.ts +++ b/packages/typedoc-plugin-markdown/src/theme/base/url-builder.ts @@ -514,28 +514,34 @@ export class UrlBuilder { ); } - private applyAnchorUrl( - reflection: DeclarationReflection, - containerUrl: string, - ) { + private applyAnchorUrl(reflection: Reflection, containerUrl: string) { const anchorPrefix = this.options.getValue('anchorPrefix'); const anchorId = this.getAnchorId(reflection); - if (anchorId) { - if (!this.anchors[containerUrl]) { - this.anchors[containerUrl] = []; - } - - this.anchors[containerUrl].push(anchorId); + if (!this.anchors[containerUrl]) { + this.anchors[containerUrl] = []; + } + if (anchorId) { const count = this.anchors[containerUrl]?.filter( (id) => id === anchorId, )?.length; - const anchorParts = [anchorId]; + let anchorParts: string[] = []; - if (count > 1) { - anchorParts.push(`-${count - 1}`); + if ( + reflection.parent?.parent?.kind === ReflectionKind.Property && + reflection.kind === ReflectionKind.Property + ) { + const anchorMatch = containerUrl.match(/#(.*)$/); + const anchor = anchorMatch ? anchorMatch[1] : ''; + anchorParts = [anchor]; + } else { + this.anchors[containerUrl].push(anchorId); + anchorParts = [anchorId]; + if (count > 0) { + anchorParts.push(`-${count}`); + } } if (anchorPrefix) { @@ -558,7 +564,7 @@ export class UrlBuilder { } } - private getAnchorId(reflection: DeclarationReflection) { + private getAnchorId(reflection: Reflection) { const preserveAnchorCasing = this.options.getValue('preserveAnchorCasing'); const anchorName = this.getAnchorName(reflection); @@ -570,55 +576,18 @@ export class UrlBuilder { return null; } - private getAnchorName(reflection: DeclarationReflection) { + private getAnchorName(reflection: Reflection) { if ([ReflectionKind.TypeParameter].includes(reflection.kind)) { return null; } - const htmlTableAnchors = this.options.getValue('useHTMLAnchors'); - - if (!htmlTableAnchors) { - if ( - (reflection.kind === ReflectionKind.Property && - this.options - .getValue('propertiesFormat') - .toLowerCase() - .includes('table')) || - (reflection.kind === ReflectionKind.Property && - reflection.parent?.kind === ReflectionKind.TypeLiteral && - this.options - .getValue('typeDeclarationFormat') - .toLowerCase() - .includes('table')) || - (reflection.kind === ReflectionKind.Property && - reflection.parent?.kind === ReflectionKind.Class && - this.options - .getValue('classPropertiesFormat') - .toLowerCase() - .includes('table')) || - (reflection.kind === ReflectionKind.Property && - reflection.parent?.kind === ReflectionKind.Interface && - this.options - .getValue('interfacePropertiesFormat') - .toLowerCase() - .includes('table')) || - (reflection.kind === ReflectionKind.EnumMember && - this.options - .getValue('enumMembersFormat') - .toLowerCase() - .includes('table')) - ) { - return null; - } - } if (reflection.kind === ReflectionKind.Constructor) { return 'Constructors'; } - const anchorParts = [reflection.name]; - if (reflection.typeParameters?.length) { + const anchorParts = [reflection.name.replace(/[\\[\]]/g, '')]; + const typeParams = (reflection as DeclarationReflection)?.typeParameters; + if (typeParams?.length) { anchorParts.push( - reflection.typeParameters - .map((typeParameter) => typeParameter.name) - .join('-'), + typeParams?.map((typeParameter) => typeParameter.name).join('-'), ); } return anchorParts.join(''); diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts index ad29ba326..69e2b4665 100644 --- a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts @@ -37,7 +37,7 @@ export function enumMembersTable( const row: string[] = []; const nameColumn: string[] = []; - if (this.options.getValue('useHTMLAnchors') && property.anchor) { + if (property.anchor) { nameColumn.push(``); } diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts index 1b59513f7..1cd1da4a8 100644 --- a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts @@ -96,7 +96,7 @@ export function propertiesTable( const nameColumn: string[] = []; - if (this.options.getValue('useHTMLAnchors') && property.anchor) { + if (property.anchor) { nameColumn.push(``); } diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts index afb219282..6874d59eb 100644 --- a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts @@ -60,7 +60,7 @@ export function typeDeclarationTable( const nameColumn: string[] = []; - if (this.options.getValue('useHTMLAnchors') && declaration.anchor) { + if (declaration.anchor) { nameColumn.push(``); } diff --git a/packages/typedoc-plugin-markdown/src/types/options.ts b/packages/typedoc-plugin-markdown/src/types/options.ts index 052a5f34f..c261f2bff 100644 --- a/packages/typedoc-plugin-markdown/src/types/options.ts +++ b/packages/typedoc-plugin-markdown/src/types/options.ts @@ -224,7 +224,7 @@ export interface PluginOptions { useCodeBlocks: boolean; /** - * Add HTML named anchors to headings and table rows. + * Add HTML anchors to page headings. */ useHTMLAnchors: boolean; 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 9c5327e5c..223d87c17 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts @@ -14,7 +14,8 @@ * - {@link SameName.prop} * - {@link TypeWithGenerics} * - {@link TypeDeclarationType} - * - {@link TypeDeclarationType#declaration1 | Links to declaration1} + * - {@link TypeDeclarationType#declaration1} + * - {@link TypeDeclarationType2#declaration1} * * External links: * @@ -251,16 +252,21 @@ export interface InterfacePropertiesTable extends BaseInterfaceProperties { export type TypeDeclarationType = { /** - * The subroutine recursively parsed the hexadecimal data. - * to generate the binary output for input validation. + * Comments for declaration1 */ declaration1: boolean; /** - * The subroutine recursively parsed the hexadecimal data. - * to generate the binary output for input validation. + * Comments for declaration2 */ declaration2: boolean; - declaration4: 100; + declaration3: 100; +}; + +export type TypeDeclarationType2 = { + /** + * Comments for declaration1 + */ + declaration1: boolean; }; export const TypeDeclarationConst = { 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 f128dc811..ec1ade029 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 @@ -9,8 +9,8 @@ exports[`Comments should compile @links with anchors: (Output File Strategy "mod - [SameName.prop](README.md#prop-2) - [TypeWithGenerics](README.md#typewithgenericsc-d) - [TypeDeclarationType](README.md#typedeclarationtype) -- [Links to declaration1](README.md#declaration1) -" +- [TypeDeclarationType#declaration1](README.md#declaration1) +- [TypeDeclarationType2#declaration1](README.md#declaration1-1)" `; exports[`Comments should compile comments for module: (Output File Strategy "members") (Option Group "1") 1`] = ` @@ -30,7 +30,8 @@ Links using \`{@link}\` inline tags. - [SameName.prop](interfaces/SameName.md#prop) - [TypeWithGenerics](type-aliases/TypeWithGenerics.md) - [TypeDeclarationType](type-aliases/TypeDeclarationType.md) -- [Links to declaration1](type-aliases/TypeDeclarationType.md#declaration1) +- [TypeDeclarationType#declaration1](type-aliases/TypeDeclarationType.md#declaration1) +- [TypeDeclarationType2#declaration1](type-aliases/TypeDeclarationType2.md#declaration1) External links: @@ -104,6 +105,7 @@ Some

html

inside codeblock ## Type Aliases - [TypeDeclarationType](type-aliases/TypeDeclarationType.md) +- [TypeDeclarationType2](type-aliases/TypeDeclarationType2.md) - [typeWithBlockTags](type-aliases/typeWithBlockTags.md) - [TypeWithGenerics](type-aliases/TypeWithGenerics.md) @@ -512,9 +514,9 @@ exports[`Comments should get tables for type declarations: (Output File Strategy | Name | Type | Description | Defined in | | ------ | ------ | ------ | ------ | -| \`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) | -| \`declaration4\` | \`100\` | - | [index.ts:1](http://source-url) | +| \`declaration1\` | \`boolean\` | Comments for declaration1 | [index.ts:1](http://source-url) | +| \`declaration2\` | \`boolean\` | Comments for declaration2 | [index.ts:1](http://source-url) | +| \`declaration3\` | \`100\` | - | [index.ts:1](http://source-url) | " `; @@ -537,7 +539,7 @@ exports[`Comments should get tables for type declarations: (Output File Strategy exports[`Comments should get tables for type declarations: (Output File Strategy "members") (Option Group "2") 1`] = ` "# Type Alias: TypeDeclarationType -> **TypeDeclarationType**: \\{ \`declaration1\`: \`boolean\`; \`declaration2\`: \`boolean\`; \`declaration4\`: \`100\`; \\} +> **TypeDeclarationType**: \\{ \`declaration1\`: \`boolean\`; \`declaration2\`: \`boolean\`; \`declaration3\`: \`100\`; \\} **Defined in**: [index.ts:1](http://source-url) @@ -565,8 +567,7 @@ exports[`Comments should get tables for type declarations: (Output File Strategy -The subroutine recursively parsed the hexadecimal data. -to generate the binary output for input validation. +Comments for declaration1 @@ -583,15 +584,14 @@ to generate the binary output for input validation. -The subroutine recursively parsed the hexadecimal data. -to generate the binary output for input validation. +Comments for declaration2 - \`declaration4\` + \`declaration3\` 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 efdbecdf6..7750f0fcc 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 @@ -210,18 +210,18 @@ Comments for BasicInterface | Property | Type | Description | | :------ | :------ | :------ | -| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | -| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | -| \`optionalProp?\` | \`string\` | Comments for optional prop | -| \`prop\` | \`string\` | Comments for prop | -| \`propReturningObjectDeclaration\` | \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\} | Comments for propReturningObjectDeclaration | +| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | +| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | +| \`optionalProp?\` | \`string\` | Comments for optional prop | +| \`prop\` | \`string\` | Comments for prop | +| \`propReturningObjectDeclaration\` | \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\} | Comments for propReturningObjectDeclaration | | \`propReturningObjectDeclaration.a\` | \`boolean\` | - | | \`propReturningObjectDeclaration.b\` | \`string\` | - | -| \`propReturningObjectDeclarations\` | \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\} & \\{ \`c\`: \`boolean\`; \`d\`: \`string\`; \\} | Comments for propReturningObjectDeclarations | -| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | -| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | -| \`propWithFunction\` | (\`options\`: \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\}) => \`boolean\` | Comments for propWithFunction | -| \`propWithProps\` | \\{ \`callbacks\`: \`Partial\`\\<[\`CallbacksOptions\`](../classes/CallbacksOptions.md)\\>; \`nestedPropA\`: \`string\`; \`nestedPropB\`: \`boolean\`; \`nestedPropC\`: \\{ \`nestedPropCA\`: \`string\`; \\}; \`nestedPropD\`: () => \`boolean\`; \\} | Comments for propWithProps | +| \`propReturningObjectDeclarations\` | \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\} & \\{ \`c\`: \`boolean\`; \`d\`: \`string\`; \\} | Comments for propReturningObjectDeclarations | +| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | +| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | +| \`propWithFunction\` | (\`options\`: \\{ \`a\`: \`boolean\`; \`b\`: \`string\`; \\}) => \`boolean\` | Comments for propWithFunction | +| \`propWithProps\` | \\{ \`callbacks\`: \`Partial\`\\<[\`CallbacksOptions\`](../classes/CallbacksOptions.md)\\>; \`nestedPropA\`: \`string\`; \`nestedPropB\`: \`boolean\`; \`nestedPropC\`: \\{ \`nestedPropCA\`: \`string\`; \\}; \`nestedPropD\`: () => \`boolean\`; \\} | Comments for propWithProps | | \`propWithProps.callbacks?\` | \`Partial\`\\<[\`CallbacksOptions\`](../classes/CallbacksOptions.md)\\> | Comments for callbacks | | \`propWithProps.nestedPropA\` | \`string\` | Comments for nestedPropA | | \`propWithProps.nestedPropB\` | \`boolean\` | Comments for nestedPropB | 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 f58794e0a..e687f1a79 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 @@ -72,7 +72,7 @@ new AbstractClass(): AbstractClass | Property | Modifier | Type | Description | | :------ | :------ | :------ | :------ | -| \`abstractProp\` | \`abstract\` | \`string\` | Comments for abstractProp | +| \`abstractProp\` | \`abstract\` | \`string\` | Comments for abstractProp | ## Methods @@ -158,7 +158,7 @@ new BasicClass(): BasicClass | Property | Type | Description | | :------ | :------ | :------ | -| \`prop\` | \`string\` | Comments for prop | +| \`prop\` | \`string\` | Comments for prop | ## Methods @@ -347,7 +347,7 @@ new ClassWithAccessors(): ClassWithAccessors | Property | Modifier | Type | | :------ | :------ | :------ | -| \`privateProp\` | \`private\` | \`string\` | +| \`privateProp\` | \`private\` | \`string\` | ## Accessors @@ -497,7 +497,7 @@ new ClassWithComplexProps(): ClassWithComplexProps | Property | Type | Description | | :------ | :------ | :------ | -| \`objecLiteralProp\` | \`object\` | - | +| \`objecLiteralProp\` | \`object\` | - | | \`objecLiteralProp.someFunction\` | (\`a\`: \`string\`) => \`string\` | Comments for someFunction | | \`objecLiteralProp.someProp\` | \`string\` | Comments for someProp | " @@ -726,8 +726,8 @@ new ClassWithFlags(): ClassWithFlags | Property | Modifier | Type | Description | | :------ | :------ | :------ | :------ | -| \`expermintalProp\` | \`public\` | \`string\` | **\`Experimental\`** | -| \`internalProp\` | \`private\` | \`string\` | **\`Internal\`** | +| \`expermintalProp\` | \`public\` | \`string\` | **\`Experimental\`** | +| \`internalProp\` | \`private\` | \`string\` | **\`Internal\`** | ## Methods @@ -897,11 +897,11 @@ new ClassWithModifiers(): ClassWithModifiers | Property | Modifier | Type | Default value | Description | | :------ | :------ | :------ | :------ | :------ | -| \`privateProp\` | \`private\` | \`string\` | \`undefined\` | Comments for privateProp | -| \`protectedProp\` | \`protected\` | \`string\` | \`undefined\` | Comments for protectedProp | -| \`publicPropWithDefault\` | \`public\` | \`string\` | \`'propWithDefault'\` | Comments for propWithDefault | -| \`readonlyProp\` | \`readonly\` | \`string\` | \`undefined\` | Comments for abstractProperty | -| \`staticProp\` | \`static\` | \`string\` | \`undefined\` | Comments for staticProp | +| \`privateProp\` | \`private\` | \`string\` | \`undefined\` | Comments for privateProp | +| \`protectedProp\` | \`protected\` | \`string\` | \`undefined\` | Comments for protectedProp | +| \`publicPropWithDefault\` | \`public\` | \`string\` | \`'propWithDefault'\` | Comments for propWithDefault | +| \`readonlyProp\` | \`readonly\` | \`string\` | \`undefined\` | Comments for abstractProperty | +| \`staticProp\` | \`static\` | \`string\` | \`undefined\` | Comments for staticProp | ## Methods @@ -1119,10 +1119,10 @@ new ClassWithSimpleProps(): ClassWithSimpleProps | Property | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| \`propA\` | \`string\` | \`'propAValue'\` | Comments for propA | -| \`propB\` | \`string\` | \`'propBDefaultValue'\` | Comments for propB | -| \`propC\` | \`string\` | \`'propCDefaultValue'\` | Comments for propB on two lines | -| \`propD\` | \`string\` | \`undefined\` | Comments for propE | +| \`propA\` | \`string\` | \`'propAValue'\` | Comments for propA | +| \`propB\` | \`string\` | \`'propBDefaultValue'\` | Comments for propB | +| \`propC\` | \`string\` | \`'propCDefaultValue'\` | Comments for propB on two lines | +| \`propD\` | \`string\` | \`undefined\` | Comments for propE | " `; @@ -1408,8 +1408,8 @@ new DerivedClassA(): DerivedClassA | Property | Type | Default value | Description | Overrides | | :------ | :------ | :------ | :------ | :------ | -| \`abstractProp\` | \`string\` | \`'abstractProp'\` | Comments for abstractProp | [\`AbstractClass\`](AbstractClass.md).\`abstractProp\` | -| \`derivedProp\` | \`string\` | \`undefined\` | - | - | +| \`abstractProp\` | \`string\` | \`'abstractProp'\` | Comments for abstractProp | [\`AbstractClass\`](AbstractClass.md).[\`abstractProp\`](AbstractClass.md#abstractprop) | +| \`derivedProp\` | \`string\` | \`undefined\` | - | - | ## Methods diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.enum.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.enum.spec.ts.snap index 9fa469176..1fdb41d00 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.enum.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.enum.spec.ts.snap @@ -40,8 +40,8 @@ Comments for enum | Enumeration Member | Value | Description | | :------ | :------ | :------ | -| \`MemberA\` | \`0\` | Comments for MemberA | -| \`MemberB\` | \`1\` | Comments for MemberB | +| \`MemberA\` | \`0\` | Comments for MemberA | +| \`MemberB\` | \`1\` | Comments for MemberB | " `; @@ -81,7 +81,7 @@ Comments for enum | Enumeration Member | Value | | :------ | :------ | -| \`MemberA\` | \`"UP"\` | -| \`MemberB\` | \`"DOWN"\` | +| \`MemberA\` | \`"UP"\` | +| \`MemberB\` | \`"DOWN"\` | " `; 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 7164bb033..aa298817a 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 @@ -351,8 +351,8 @@ Return comments | Name | Type | Default value | | :------ | :------ | :------ | -| \`x\` | \`number\` | 1 | -| \`y\` | \`number\` | 2 | +| \`x\` | \`number\` | 1 | +| \`y\` | \`number\` | 2 | " `; 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 4d796bcb8..d1dbc986a 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 @@ -234,18 +234,18 @@ Comments for BasicInterface | Property | Type | Description | | :------ | :------ | :------ | -| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | -| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | -| \`optionalProp?\` | \`string\` | Comments for optional prop | -| \`prop\` | \`string\` | Comments for prop | -| \`propReturningObjectDeclaration\` | \`object\` | Comments for propReturningObjectDeclaration | +| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | +| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | +| \`optionalProp?\` | \`string\` | Comments for optional prop | +| \`prop\` | \`string\` | Comments for prop | +| \`propReturningObjectDeclaration\` | \`object\` | Comments for propReturningObjectDeclaration | | \`propReturningObjectDeclaration.a\` | \`boolean\` | - | | \`propReturningObjectDeclaration.b\` | \`string\` | - | -| \`propReturningObjectDeclarations\` | \`object\` & \`object\` | Comments for propReturningObjectDeclarations | -| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | -| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | -| \`propWithFunction\` | (\`options\`: \`object\`) => \`boolean\` | Comments for propWithFunction | -| \`propWithProps\` | \`object\` | Comments for propWithProps | +| \`propReturningObjectDeclarations\` | \`object\` & \`object\` | Comments for propReturningObjectDeclarations | +| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | +| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | +| \`propWithFunction\` | (\`options\`: \`object\`) => \`boolean\` | Comments for propWithFunction | +| \`propWithProps\` | \`object\` | Comments for propWithProps | | \`propWithProps.callbacks?\` | \`Partial\`\\<[\`CallbacksOptions\`](../classes/CallbacksOptions.md)\\> | Comments for callbacks | | \`propWithProps.nestedPropA\` | \`string\` | Comments for nestedPropA | | \`propWithProps.nestedPropB\` | \`boolean\` | Comments for nestedPropB | @@ -537,19 +537,19 @@ Comments for ExtendedInterface | Property | Type | Description | Inherited from | | :------ | :------ | :------ | :------ | -| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | [\`BasicInterface\`](BasicInterface.md).\`deprecatedProp\` | -| \`extendedProp\` | \`string\` | - | - | -| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | [\`BasicInterface\`](BasicInterface.md).\`functionProp\` | -| \`optionalProp?\` | \`string\` | Comments for optional prop | [\`BasicInterface\`](BasicInterface.md).\`optionalProp\` | -| \`prop\` | \`string\` | Comments for prop | [\`BasicInterface\`](BasicInterface.md).\`prop\` | -| \`propReturningObjectDeclaration\` | \`object\` | Comments for propReturningObjectDeclaration | [\`BasicInterface\`](BasicInterface.md).\`propReturningObjectDeclaration\` | +| ~~\`deprecatedProp\`~~ | \`string\` | **Deprecated** This prop is deprecated **See** Comments for some tag | [\`BasicInterface\`](BasicInterface.md).[\`deprecatedProp\`](BasicInterface.md#deprecatedprop) | +| \`extendedProp\` | \`string\` | - | - | +| \`functionProp\` | (\`s\`: \`string\`) => \`boolean\` | Comments for functionProper | [\`BasicInterface\`](BasicInterface.md).[\`functionProp\`](BasicInterface.md#functionprop) | +| \`optionalProp?\` | \`string\` | Comments for optional prop | [\`BasicInterface\`](BasicInterface.md).[\`optionalProp\`](BasicInterface.md#optionalprop) | +| \`prop\` | \`string\` | Comments for prop | [\`BasicInterface\`](BasicInterface.md).[\`prop\`](BasicInterface.md#prop) | +| \`propReturningObjectDeclaration\` | \`object\` | Comments for propReturningObjectDeclaration | [\`BasicInterface\`](BasicInterface.md).[\`propReturningObjectDeclaration\`](BasicInterface.md#propreturningobjectdeclaration) | | \`propReturningObjectDeclaration.a\` | \`boolean\` | - | - | | \`propReturningObjectDeclaration.b\` | \`string\` | - | - | -| \`propReturningObjectDeclarations\` | \`object\` & \`object\` | Comments for propReturningObjectDeclarations | [\`BasicInterface\`](BasicInterface.md).\`propReturningObjectDeclarations\` | -| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | [\`BasicInterface\`](BasicInterface.md).\`propReturningSignatureDeclaration\` | -| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | [\`BasicInterface\`](BasicInterface.md).\`propReturningSignatureDeclarations\` | -| \`propWithFunction\` | (\`options\`: \`object\`) => \`boolean\` | Comments for propWithFunction | [\`BasicInterface\`](BasicInterface.md).\`propWithFunction\` | -| \`propWithProps\` | \`object\` | Comments for propWithProps | [\`BasicInterface\`](BasicInterface.md).\`propWithProps\` | +| \`propReturningObjectDeclarations\` | \`object\` & \`object\` | Comments for propReturningObjectDeclarations | [\`BasicInterface\`](BasicInterface.md).[\`propReturningObjectDeclarations\`](BasicInterface.md#propreturningobjectdeclarations) | +| \`propReturningSignatureDeclaration?\` | () => \`string\` \\| \`number\` \\| \`boolean\` | Comments for propReturningSignatureDeclaration | [\`BasicInterface\`](BasicInterface.md).[\`propReturningSignatureDeclaration\`](BasicInterface.md#propreturningsignaturedeclaration) | +| \`propReturningSignatureDeclarations\` | () => \`any\` & (\`paramsA\`: \`true\` \\| \`any\`[], \`paramsB\`?: \`any\`) => \`any\` & (\`paramsC\`: \`any\`) => \`any\` | Comments for propReturningSignatureDeclarations | [\`BasicInterface\`](BasicInterface.md).[\`propReturningSignatureDeclarations\`](BasicInterface.md#propreturningsignaturedeclarations) | +| \`propWithFunction\` | (\`options\`: \`object\`) => \`boolean\` | Comments for propWithFunction | [\`BasicInterface\`](BasicInterface.md).[\`propWithFunction\`](BasicInterface.md#propwithfunction) | +| \`propWithProps\` | \`object\` | Comments for propWithProps | [\`BasicInterface\`](BasicInterface.md).[\`propWithProps\`](BasicInterface.md#propwithprops) | | \`propWithProps.callbacks?\` | \`Partial\`\\<[\`CallbacksOptions\`](../classes/CallbacksOptions.md)\\> | Comments for callbacks | - | | \`propWithProps.nestedPropA\` | \`string\` | Comments for nestedPropA | - | | \`propWithProps.nestedPropB\` | \`boolean\` | Comments for nestedPropB | - | @@ -597,7 +597,7 @@ Comments for IndexableInterface | Property | Type | | :------ | :------ | -| \`prop\` | \`string\` | +| \`prop\` | \`string\` | " `; @@ -683,7 +683,7 @@ And some more comments | Property | Type | Description | | :------ | :------ | :------ | -| ~~\`propertyWithComments\`~~ | \`string\` | Some text. - list item - list item **Deprecated** This is a deprecated property **See** https://example.com | +| ~~\`propertyWithComments\`~~ | \`string\` | Some text. - list item - list item **Deprecated** This is a deprecated property **See** https://example.com | " `; @@ -747,14 +747,14 @@ exports[`Interface Reflection should compile interface with event properties: (O | Property | Type | Description | | :------ | :------ | :------ | -| \`someProp?\` | \`boolean\` | Description for prop someProp | +| \`someProp?\` | \`boolean\` | Description for prop someProp | ## Events | Event | Type | Description | | :------ | :------ | :------ | -| \`anotherEvent\` | \`MouseEvent\` | - | -| ~~\`someEvent?\`~~ | (\`eventParam\`: [\`CustomEventInterface\`](CustomEventInterface.md)\\<\`MouseEvent\`\\>) => \`void\` | Description for event someEvent **Deprecated** Deprectaed comments | +| \`anotherEvent\` | \`MouseEvent\` | - | +| ~~\`someEvent?\`~~ | (\`eventParam\`: [\`CustomEventInterface\`](CustomEventInterface.md)\\<\`MouseEvent\`\\>) => \`void\` | Description for event someEvent **Deprecated** Deprectaed comments | " `; @@ -800,8 +800,8 @@ Comments for InterfaceWithFlags | Property | Type | Description | | :------ | :------ | :------ | -| \`expermintalProp?\` | \`string\` | **\`Experimental\`** | -| \`internalProp\` | \`string\` | **\`Internal\`** Comments for internalProp | +| \`expermintalProp?\` | \`string\` | **\`Experimental\`** | +| \`internalProp\` | \`string\` | **\`Internal\`** Comments for internalProp | " `; @@ -845,7 +845,7 @@ Comments for InterfaceWithTypeParameters | Property | Type | Description | | :------ | :------ | :------ | -| \`prop\` | \`A\` | Comments for prop | +| \`prop\` | \`A\` | Comments for prop | " `; @@ -891,6 +891,6 @@ exports[`Interface Reflection should compile multiple indexable interface: (Outp | Property | Type | Description | | :------ | :------ | :------ | -| \`prop\` | \`string\` | Prop | +| \`prop\` | \`string\` | Prop | " `; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.type-alias.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.type-alias.spec.ts.snap index a6743b5e3..7f34abe64 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.type-alias.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.type-alias.spec.ts.snap @@ -279,18 +279,18 @@ Comments for LiteralType | Name | Type | Description | | :------ | :------ | :------ | -| \`someFunctionWithArrow\` | () => \`string\` | Comments for someFunctionWithArrow | -| \`x\`? | \`string\` | comment for x | -| \`y\` | \`object\` | comment for y | +| \`someFunctionWithArrow\` | () => \`string\` | Comments for someFunctionWithArrow | +| \`x\`? | \`string\` | comment for x | +| \`y\` | \`object\` | comment for y | | \`y.x\` | \`string\` | comment for y.x | | \`y.y\`? | \`boolean\` \\| \`string\` | comment for y.y | | \`y.z\` | (\`x\`: \`string\`) => \`string\` | comment for y.z | -| \`z\` | (\`x\`: \`string\`) => \`string\` | - | -| \`get accessorA\` | [\`Promise\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\<\`string\`\\> | Comments for accessorA getter | -| \`set accessorA\` | \`void\` | Comments for accessorA setter | -| \`get accessorB\` | \`string\` | - | -| \`set accessorB\` | \`void\` | - | -| \`someFunction()\` | [\`Promise\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\<\`any\`\\> | Comments for someFunction | +| \`z\` | (\`x\`: \`string\`) => \`string\` | - | +| \`get accessorA\` | [\`Promise\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\<\`string\`\\> | Comments for accessorA getter | +| \`set accessorA\` | \`void\` | Comments for accessorA setter | +| \`get accessorB\` | \`string\` | - | +| \`set accessorB\` | \`void\` | - | +| \`someFunction()\` | [\`Promise\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\<\`any\`\\> | Comments for someFunction | " `; @@ -363,10 +363,10 @@ Comments for FunctionType - Test link resolution for: -- [\`LiteralType\`](LiteralType.md) and uses [LiteralType#x](LiteralType.md) -- [\`BasicInterface\`](../interfaces/BasicInterface.md) and uses [BasicInterface#prop](../interfaces/BasicInterface.md) -- [\`BasicClass\`](../classes/BasicClass.md) and uses [BasicClass#prop](../classes/BasicClass.md) -- [\`BasicEnum\`](../enumerations/BasicEnum.md) and uses [BasicEnum#MemberA](../enumerations/BasicEnum.md) +- [\`LiteralType\`](LiteralType.md) and uses [LiteralType#x](LiteralType.md#x) +- [\`BasicInterface\`](../interfaces/BasicInterface.md) and uses [BasicInterface#prop](../interfaces/BasicInterface.md#prop) +- [\`BasicClass\`](../classes/BasicClass.md) and uses [BasicClass#prop](../classes/BasicClass.md#prop) +- [\`BasicEnum\`](../enumerations/BasicEnum.md) and uses [BasicEnum#MemberA](../enumerations/BasicEnum.md#membera) ## Parameters diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap index 14a097329..e9bf0845d 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap @@ -34,7 +34,7 @@ Comments variable with symbol | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| \`[sym]\` | \`string\` | 'value' | Comments for symbol | +| \`[sym]\` | \`string\` | 'value' | Comments for symbol | " `; @@ -200,12 +200,12 @@ xyz.com | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| \`valueA\` | \`number\` | 100 | Comments for valueA | -| \`valueB\` | \`boolean\` | true | - | -| \`valueX\` | \`object\` | - | Comments for valueX | +| \`valueA\` | \`number\` | 100 | Comments for valueA | +| \`valueB\` | \`boolean\` | true | - | +| \`valueX\` | \`object\` | - | Comments for valueX | | \`valueX.valueA\` | \`number\`[] | - | Comment for valueX.valueA | | \`valueX.valueY\` | (\`z\`: \`string\`) => \`object\` | - | - | | \`valueX.valueZ\` | \`string\` | 'foo' | - | -| \`valueY\` | (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` | - | - | +| \`valueY\` | (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` | - | - | " `; 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 e2a2c30ef..8e5999364 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 @@ -47,13 +47,13 @@ exports[`Text should get translations for member page: (Output File Strategy "me | プロパティ | Type (jp) | 説明 | | :------ | :------ | :------ | -| \`someProp?\` | \`boolean\` | Description for prop someProp | +| \`someProp?\` | \`boolean\` | Description for prop someProp | ## Events | イベント | Type (jp) | | :------ | :------ | -| \`someEvent\` | \`MouseEvent\` | +| \`someEvent\` | \`MouseEvent\` | *** @@ -74,13 +74,13 @@ exports[`Text should get translations for member page: (Output File Strategy "me | Property | Type | Description | | :------ | :------ | :------ | -| \`someProp?\` | \`boolean\` | Description for prop someProp | +| \`someProp?\` | \`boolean\` | Description for prop someProp | ## Events | Event | Type | | :------ | :------ | -| \`someEvent\` | \`MouseEvent\` | +| \`someEvent\` | \`MouseEvent\` | " `; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap index 3c3a58857..d95f5613d 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap @@ -1013,6 +1013,7 @@ exports[`Urls should gets Urls with media assets: outputFileStrategy: members 1` "interfaces/InterfacePropertiesTable.md", "interfaces/SameName.md", "type-aliases/TypeDeclarationType.md", + "type-aliases/TypeDeclarationType2.md", "type-aliases/TypeWithGenerics.md", "type-aliases/typeWithBlockTags.md", "variables/SameName.md", @@ -1042,6 +1043,7 @@ exports[`Urls should gets Urls with media assets: outputFileStrategy: members 2` "Interface.SameName.md", "README.md", "TypeAlias.TypeDeclarationType.md", + "TypeAlias.TypeDeclarationType2.md", "TypeAlias.TypeWithGenerics.md", "TypeAlias.typeWithBlockTags.md", "Variable.SameName.md",