Skip to content

Commit 91c71e9

Browse files
fix: fix type-check (#34)
1 parent 61a54b5 commit 91c71e9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/__tests__/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ That's just a regular link
100100
101101
And so is this: [neat](https://www.youtube.com/watch?v=dQw4w9WgXcQ)
102102
103-
[This has a title, so it's not transformed](https://some-site.com)
103+
[This text is not the same as the url, so it's not transformed](https://some-site.com)
104+
105+
[https://some-site.com](https://some-site.com "This one has a title, so it's not transformed")
106+
107+
This one has an emphasised text, so it's not transformed:
108+
109+
[**https://some-site.com**](https://some-site.com)
104110
`.trim(),
105111
)
106112

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const remarkEmbedder: Plugin<[RemarkEmbedderOptions]> = ({
9090
node.type === 'link' &&
9191
!node.title &&
9292
node.children.length === 1 &&
93-
(node.children[0] as Text).value === node.url
93+
node.children[0].type === 'text' &&
94+
node.children[0].value === node.url
9495
if (!(isText || isValidLink)) {
9596
return
9697
}

0 commit comments

Comments
 (0)