From 11478936e4a97ac80a88467640f72f4da6d6e113 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 9 May 2026 20:57:55 +0300 Subject: [PATCH 1/2] Wrap long URLs --- src/assets/styles/global.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/assets/styles/global.css b/src/assets/styles/global.css index ab73d35..13848af 100644 --- a/src/assets/styles/global.css +++ b/src/assets/styles/global.css @@ -1495,6 +1495,8 @@ body { color: #1a5276; background-color: rgba(30, 100, 160, 0.08); border-color: rgba(30, 100, 160, 0.2); + overflow-wrap: anywhere; + white-space: normal; } .prose .ref-py-release:hover { From 198c437ed7bf4ebbad648be71ae6ab22f78e4db4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 9 May 2026 20:58:40 +0300 Subject: [PATCH 2/2] Strip http[s]://[www/] from plain URLs --- src/plugins/remark-python-refs.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/remark-python-refs.ts b/src/plugins/remark-python-refs.ts index 094dbdb..906e2d2 100644 --- a/src/plugins/remark-python-refs.ts +++ b/src/plugins/remark-python-refs.ts @@ -284,10 +284,17 @@ export default function remarkPythonRefs() { visit(tree, "link", (node: Link, index, parent) => { if (index == null || !parent) return; - const label = extractText(node.children); - const info = classify(node.url, label); + const rawLabel = extractText(node.children); + const info = classify(node.url, rawLabel); if (!info) return; + // For autolinked bare URLs, drop the protocol, leading "www.", + // and trailing slash so the badge reads "python.org/downloads/..." + // rather than the full "https://www.python.org/.../" form. + const label = rawLabel.startsWith("http") + ? rawLabel.replace(/^https?:\/\/(?:www\.)?/i, "").replace(/\/$/, "") + : rawLabel; + collectRef(info.type, label, node.url); const html = buildBadgeHtml({ ...info, label, url: node.url });