typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
689 stars 172 forks source link

Type Generics arn't escaped correctly #622

Closed Napster2709 closed 1 month ago

Napster2709 commented 1 month ago

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

@param and @return type generics aren't escaped correctly.

Example Input:

/**
 * @param  {Type<string>} GenericName This is another Description
 * @return {Promise<SomeType>} This is the Description
 **/
someFunktion(GenericName: Type<string>) { ... }

Output:

# someFunktion

> **someFunktion**(`GenericName`): `Promise`<`SomeType`>

...

## Parameters

| Parameter     | Type                            | Description                      |
| :------------ | :------------------------------ | :------------------------------- |
| `GenericName` | `Type`<`string`>                | This is another Description      |

## Returns

`Promise`<`SomeType`>

TypeDoc configuration

fileExtension: '.mdx',
readme: 'none',
outputFileStrategy: 'modules',
publicPath: '',
entryPoints: ["path to files"],
remarkPlugins: [
    [
        'remark-toc',
        {
            maxDepth: 5,
        },
    ],
],
disableSources: true,
excludeExternals: true,
excludePrivate: true,
hidePageHeader: true,
hidePageTitle: true,
hideBreadcrumbs: true,
parametersFormat: 'table',
propertiesFormat: 'table',
typeDeclarationFormat: 'table',
indexFormat: 'table',
sanitizeComments: true,
sort: ['static-first', 'kind', 'visibility', 'alphabetical'],
kindSortOrder: [
    'Class',
    'Constructor',
    'Accessor',
    'Method',
    'Property',
],
textContentMappings: contentMapper(),

Expected behavior

generics should be escaped correctly, either like this:

Promise<SomeType> or Promise\<SomeType\>

tgreyuk commented 1 month ago

This was because the remark-plugin was ignoring the escape chars (which is perfectly ok for CommonMark in this instance). Please update to typedoc-plugin-remark@1.0.1. It will now additionally parse with remark-mdx and provide correct escaping.

Napster2709 commented 1 month ago

That indeet solved my problem.