Skip to content

Commit

Permalink
Merge pull request #2854 from pjeby/fix-undefined-links
Browse files Browse the repository at this point in the history
Fix `undefined` hrefs for excluded external refs
  • Loading branch information
Gerrit0 authored Feb 15, 2025
2 parents da50ac0 + 715c59c commit 0bad04c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/output/themes/MarkedPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
if (useHtml) {
const text = part.tag === "@linkcode" ? `<code>${part.text}</code>` : part.text;
result.push(
`<a href="${url}"${kindClass ? ` class="${kindClass}"` : ""}>${text}</a>`,
url
? `<a href="${url}"${kindClass ? ` class="${kindClass}"` : ""}>${text}</a>`
: part.text,
);
} else {
const text = part.tag === "@linkcode" ? "`" + part.text + "`" : part.text;
result.push(`[${text}](${url})`);
result.push(url ? `[${text}](${url})` : text);
}
} else {
result.push(part.text);
Expand Down

0 comments on commit 0bad04c

Please sign in to comment.