kazupon / api-docs-gen

:book: API Documentation generator from `api-extractor` doc model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid markdown generated from function signatures having parameters typed with parametrized types

jsamr opened this issue · comments

Example:

/**
 * A dumb type
 */
export type DumbType<T> = { foo: T };

/**
 *
 * @param dummy - A dummy
 */
export function undumbify<T>(dummy: DumbType<T>): T { return dummy.foo };

Will produce:

### undumbify

...

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dummy | DumbType<T> | A dummy |

The less-than and greater-than signs should be escaped. Otherwise, it is considered an opening HTML tag.
To reproduce, apply this patch on master (16585f9):

diff --git a/examples/packages/utilities/src/index.ts b/examples/packages/utilities/src/index.ts
index 64a02e2..4ccb387 100644
--- a/examples/packages/utilities/src/index.ts
+++ b/examples/packages/utilities/src/index.ts
@@ -70,3 +70,14 @@ export function isSymbol(val: unknown): val is symbol {
 export function isPromise<T = any>(val: unknown): val is Promise<T> { // eslint-disable-line
   return isObject(val) && isFunction(val.then) && isFunction(val.catch)
 }
+
+/**
+ * A dumb type
+ */
+export type DumbType<T> = { foo: T };
+
+/**
+ *
+ * @param dummy - A dummy
+ */
+export function undumbify<T>(dummy: DumbType<T>): T { return dummy.foo };

And run

yarn example:setup
yarn example:build
yarn example:extract
yarn example:gen
yarn example:docs