generated from sapphiredev/sapphire-template
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docusaurus-typedoc-json-parser): render classes
- Loading branch information
1 parent
dda3ee6
commit 1af8f47
Showing
6 changed files
with
149 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
docusaurus-typedoc-json-parser/src/renderer/utilities/parseParameters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { ParameterParser } from 'typedoc-json-parser'; | ||
|
||
export function parseParameters(parameters: ParameterParser[]): string { | ||
if (!parameters.length) return ''; | ||
|
||
return `| Name | Type | Description | | ||
| :---: | :---: | :---: | :---: | | ||
${parameters | ||
.map( | ||
(parameter) => | ||
`| ${parameter.name} | ${parameter.type.toString().replace('/', '\\/')} | ${ | ||
parameter.comment.description ?? 'No description provided.' | ||
} |` | ||
) | ||
.join('\n')}`; | ||
} |
4 changes: 3 additions & 1 deletion
4
docusaurus-typedoc-json-parser/src/renderer/utilities/parseSee.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import type { CommentParser } from 'typedoc-json-parser'; | ||
|
||
export function parseSee(blockTags: CommentParser.BlockTag[]): string { | ||
return blockTags.map((blockTag) => `\n**\`See Also:\`** ${blockTag.text}`).join('\n'); | ||
if (blockTags.length === 0) return ''; | ||
|
||
return blockTags.map((blockTag) => `\n**See Also:** ${blockTag.text}`).join('\n'); | ||
} |
12 changes: 12 additions & 0 deletions
12
docusaurus-typedoc-json-parser/src/renderer/utilities/parseTypeParameters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { TypeParameterParser } from 'typedoc-json-parser'; | ||
|
||
export function parseTypeParameters(typeParameters: TypeParameterParser[]): string { | ||
if (!typeParameters.length) return ''; | ||
|
||
return `| Name | Type | Default | | ||
| :---: | :---: | :---: | | ||
${typeParameters.map( | ||
(typeParameter) => | ||
`| ${typeParameter.name} | ${typeParameter.type?.toString() ?? 'Not provided.'} | ${typeParameter.default?.toString() ?? 'Not provided.'}` | ||
)}`; | ||
} |