Skip to content

Commit 027edb3

Browse files
committed
feat: add parseDocComment
1 parent b6c3455 commit 027edb3

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"jsdom": "^27.1.0",
2323
"lodash-es": "^4.17.21",
2424
"marked": "^16.4.2",
25+
"memoize": "^10.2.0",
2526
"nanoid": "^5.1.6",
2627
"new-github-issue-url": "^1.1.0",
2728
"pathe": "^2.0.3",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expect, test } from "vitest";
2+
import { parseDocComment } from "./parse-doc-comment.ts";
3+
4+
test("parses doc comment", () => {
5+
expect(parseDocComment("/** @internal */").modifierTagSet.isInternal()).toBe(true);
6+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { TSDocParser, type DocComment } from "@microsoft/tsdoc";
2+
import memoize from "memoize";
3+
4+
export const parseDocComment = memoize((comment: string): DocComment => {
5+
const parser = new TSDocParser();
6+
return parser.parseString(comment).docComment;
7+
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"jsdom": "^27.1.0",
3636
"lodash-es": "^4.17.21",
3737
"marked": "^16.4.2",
38+
"memoize": "^10.2.0",
3839
"nanoid": "^5.1.6",
3940
"new-github-issue-url": "^1.1.0",
4041
"pathe": "^2.0.3",

src/components/DocComment.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
import { parseDocComment } from "@jsdocs-io/extractor";
32
import { StandardTags } from "@microsoft/tsdoc";
43
import DocCommentInherit from "./DocCommentInherit.astro";
54
import DocNodeContainer from "./DocNodeContainer.astro";
5+
import { parseDocComment } from "../../lib/components/parse-doc-comment";
66
7-
type Props = {
7+
interface Props {
88
doc: string;
9-
};
9+
}
1010
1111
const { doc } = Astro.props;
1212
const {

0 commit comments

Comments
 (0)