Skip to content

Commit

Permalink
fix: looking for a title by all tokens and not just even
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Nov 18, 2024
1 parent 6b44a52 commit a69f5e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/transform/plugins/links/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ function getTitleFromTokens(tokens: Token[]) {
while (i < tokens.length) {
const token = tokens[i];

if (token.type === 'heading_open') {
({title = ''} = headingInfo(tokens, i));
if (token?.type === 'heading_open') {
const info = headingInfo(tokens, i);
title = info?.title ?? '';

break;
}

i += 2;
i += 1;
}

return title;
Expand Down

0 comments on commit a69f5e0

Please sign in to comment.