Skip to content

Commit 31fa451

Browse files
committed
Clearly mark external markdown links
1 parent 66b2c53 commit 31fa451

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib/output/themes/MarkedPlugin.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
272272
// that becomes a real thing.
273273
if (this.markdownLinkExternal && /https?:\/\//i.test(href)) {
274274
token.attrSet("target", "_blank");
275+
const classes = token.attrGet("class")?.split(" ") || [];
276+
classes.push("external");
277+
token.attrSet("class", classes.join(" "));
275278
}
276279

277280
token.attrSet("href", href);

0 commit comments

Comments
 (0)