diff options
| author | Matt Mayer <[email protected]> | 2022-12-27 00:30:18 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-26 17:30:18 +0000 |
| commit | 3793ec1baffbf0d41b3f49fa94380ffd4048b054 (patch) | |
| tree | 4e3f044dfd88b9b8636f8670685c5896b1c2ed75 /scripts/apidoc/utils.ts | |
| parent | ec53c4507ad724704d792db633889f9eb66bea67 (diff) | |
| download | faker-3793ec1baffbf0d41b3f49fa94380ffd4048b054.tar.xz faker-3793ec1baffbf0d41b3f49fa94380ffd4048b054.zip | |
docs(datatype): allow markdown in @see links (#1667)
Diffstat (limited to 'scripts/apidoc/utils.ts')
| -rw-r--r-- | scripts/apidoc/utils.ts | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/apidoc/utils.ts b/scripts/apidoc/utils.ts index 651a0119..ef26a67d 100644 --- a/scripts/apidoc/utils.ts +++ b/scripts/apidoc/utils.ts @@ -112,15 +112,20 @@ export function extractRawExamples(signature?: SignatureReflection): string[] { * @param signature The signature to extract the see also references from. */ export function extractSeeAlsos(signature?: SignatureReflection): string[] { - return extractTagContent('@see', signature, (tag) => { - const content = tag.content; - if (content.length === 1) { - return joinTagContent(tag); - } - return tag.content - .filter((_, index) => index % 3 === 1) // ['-', 'content', '\n'] - .map((part) => part.text); - }); + return extractTagContent('@see', signature, (tag) => + // If the @see tag contains code in backticks, the content is split into multiple parts. + // So we join together, split on newlines and filter out empty tags. + joinTagParts(tag.content) + .split('\n') + .map((link) => { + link = link.trim(); + if (link.startsWith('-')) { + link = link.slice(1).trim(); + } + return link; + }) + .filter((link) => link) + ); } /** |
