From bb1ba8065f4a131023e9894b391eae5f7af3fe89 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Thu, 30 Jul 2026 12:32:13 -0400 Subject: [PATCH] Open only external docs links in a new tab The Markdown renderer put target="_blank" on every link in docs and reference content, so following an internal cross-link like the Mongo Shell Quick Start from the Docker guide spawned a new tab on every hop. The quick starts are chains of internal links, which made normal docs reading accumulate tabs. Only links with an http(s) scheme now open in a new tab with rel="noopener noreferrer"; site-internal paths and in-page anchors navigate in place. --- app/components/Markdown.tsx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/components/Markdown.tsx b/app/components/Markdown.tsx index b547ad7..84d1c72 100644 --- a/app/components/Markdown.tsx +++ b/app/components/Markdown.tsx @@ -244,18 +244,21 @@ function getMarkdownComponents() { ); }, - // Links - a: ({ children, href, ...props }: any) => ( - - {children} - - ), + // Links: only external links open in a new tab; internal links (/docs/..., + // /samples, #anchors) navigate in place + a: ({ children, href, ...props }: any) => { + const isExternal = /^https?:\/\//i.test(href ?? ''); + return ( + + {children} + + ); + }, // Strong text strong: ({ children, ...props }: any) => (