Skip to content

Commit a69f5e0

Browse files
fix: looking for a title by all tokens and not just even
1 parent 6b44a52 commit a69f5e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/transform/plugins/links/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ function getTitleFromTokens(tokens: Token[]) {
2525
while (i < tokens.length) {
2626
const token = tokens[i];
2727

28-
if (token.type === 'heading_open') {
29-
({title = ''} = headingInfo(tokens, i));
28+
if (token?.type === 'heading_open') {
29+
const info = headingInfo(tokens, i);
30+
title = info?.title ?? '';
3031

3132
break;
3233
}
3334

34-
i += 2;
35+
i += 1;
3536
}
3637

3738
return title;

0 commit comments

Comments
 (0)