From f39bdd37d6e82a32b79e4115017126e31616bd25 Mon Sep 17 00:00:00 2001 From: George Corney Date: Tue, 5 Dec 2023 21:42:49 +0000 Subject: [PATCH] Open absolute URLs in a new tab --- src/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 58e3b38..1b3efe8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -278,7 +278,13 @@ function App() { let match = href.match(pattern); href = '#' + match![1]; } - return + let isAbsolute = /^https?:\/\//.test(href ?? ''); + if (isAbsolute) { + // open in new tab + return + } else { + return + } } }} >{readme}