From 1e30517955b0f1ac2d6336e884ce6b8c6008e155 Mon Sep 17 00:00:00 2001 From: Ohad Lutzky Date: Mon, 3 Feb 2025 18:52:45 +0000 Subject: [PATCH] Open external links in a new tab (#1229) Fixes https://github.com/silverbulletmd/silverbullet/issues/1228. This matches the generated HTML to the current behavior of editor.openUrl. --- plugs/markdown/markdown_render.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugs/markdown/markdown_render.ts b/plugs/markdown/markdown_render.ts index 17458c91..a938dbd2 100644 --- a/plugs/markdown/markdown_render.ts +++ b/plugs/markdown/markdown_render.ts @@ -233,6 +233,7 @@ function render( name: "a", attrs: { href: url, + target: "_blank", }, body: cleanTags(mapRender(linkTextChildren)), }; @@ -255,6 +256,7 @@ function render( name: "a", attrs: { href: url, + target: "_blank", }, body: url, }; @@ -333,6 +335,7 @@ function render( name: "a", attrs: { href: url, + target: "_blank", }, body: url, };