Skip to content

Commit 0a45f14

Browse files
feat: interfaces links and markdown
1 parent 7b6229f commit 0a45f14

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/lib/parser/markdown.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const interfacesToMarkdown = ({
150150
} & Required<Pick<MarkdownOptions, 'headingLevel'>> &
151151
Omit<MarkdownOptions, 'headingLevel'> &
152152
Pick<MarkdownOptions, 'emoji'>): string => {
153-
const {name, documentation} = entry;
153+
const {name, documentation, jsDocs, url} = entry;
154154

155155
const markdown: string[] = [
156156
`${headingLevel}# ${emoji === undefined || emoji === null ? '' : ':gear: '}${name}\n`
@@ -160,6 +160,14 @@ const interfacesToMarkdown = ({
160160
markdown.push(`${documentation}\n`);
161161
}
162162

163+
const metadata = metadataToMarkdown({
164+
...jsDocsMetadata(jsDocs),
165+
url,
166+
emoji
167+
});
168+
169+
markdown.push(...metadata);
170+
163171
markdown.push(`| Property | Type | Description |`);
164172
markdown.push('| ---------- | ---------- | ---------- |');
165173

src/test/mock.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ References:
352352

353353

354354

355+
[:link: Source](https://github.com/peterpeterparker/tsdoc-markdown/tree/main/src/test/mock.ts#L183)
356+
355357
| Property | Type | Description |
356358
| ---------- | ---------- | ---------- |
357359
| `SECOND` | `1000` | |
@@ -362,6 +364,8 @@ References:
362364

363365

364366

367+
[:link: Source](https://github.com/peterpeterparker/tsdoc-markdown/tree/main/src/test/mock.ts#L188)
368+
365369
| Property | Type | Description |
366370
| ---------- | ---------- | ---------- |
367371
| `T1` | `` | |
@@ -378,6 +382,8 @@ References:
378382

379383
A Foo interface description.
380384

385+
[:link: Source](https://github.com/peterpeterparker/tsdoc-markdown/tree/main/src/test/mock.ts#L157)
386+
381387
| Property | Type | Description |
382388
| ---------- | ---------- | ---------- |
383389
| `hello` | `string` | Says hello. |
@@ -389,6 +395,13 @@ A Foo interface description.
389395

390396
Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs.
391397

398+
References:
399+
400+
* [https://github.com/peterpeterparker/tsdoc-markdown](https://github.com/peterpeterparker/tsdoc-markdown)
401+
402+
403+
[:link: Source](https://github.com/peterpeterparker/tsdoc-markdown/tree/main/src/test/mock.ts#L259)
404+
392405
| Property | Type | Description |
393406
| ---------- | ---------- | ---------- |
394407
| `source` | `string` | The glob pattern or specific path to match for incoming requests that should be redirected. type: {StorageConfigSourceGlob} |

0 commit comments

Comments
 (0)