Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Generics arn't escaped correctly #622

Closed
Napster2709 opened this issue May 27, 2024 · 2 comments
Closed

Type Generics arn't escaped correctly #622

Napster2709 opened this issue May 27, 2024 · 2 comments
Labels
bug Issue raised as a bug.

Comments

@Napster2709
Copy link

Napster2709 commented May 27, 2024

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\>

@Napster2709 Napster2709 added the bug Issue raised as a bug. label May 27, 2024
@Napster2709 Napster2709 reopened this May 27, 2024
tgreyuk added a commit that referenced this issue May 27, 2024
tgreyuk added a commit that referenced this issue May 27, 2024
@tgreyuk
Copy link
Member

tgreyuk commented May 27, 2024

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
Copy link
Author

That indeet solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue raised as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants