From dc0e00f4c7c3bc12ba07cdbcaa663472886448bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Bon?= Date: Sun, 14 Sep 2025 01:30:41 +0200 Subject: [PATCH 1/2] fix: blank targets --- .../tags/home-community/home-community.marko | 27 +++++++++++++------ src/tags/app-footer/app-footer.marko | 9 ++++--- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/routes/_home/tags/home-community/home-community.marko b/src/routes/_home/tags/home-community/home-community.marko index edf30773..b1c36d90 100644 --- a/src/routes/_home/tags/home-community/home-community.marko +++ b/src/routes/_home/tags/home-community/home-community.marko @@ -16,33 +16,44 @@ section class=styles.section div class=styles.cards div class=styles.discord - a href="https://discord.gg/marko" class=styles.logo + a href="https://discord.gg/marko" target="_blank" class=styles.logo fa-icon=faDiscord span -- Hang out in our${" "} - a href="https://discord.gg/marko" -- Discord server + a href="https://discord.gg/marko" target="_blank" -- Discord server -- ${" "}to ask questions & discuss marko div class=styles.twitter a ,href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live" ,class=styles.logo + ,target="_blank" fa-icon=faXTwitter span -- Tweet to${" "} - a href="https://twitter.com/MarkoDevTeam" -- @MarkoDevTeam + a href="https://twitter.com/MarkoDevTeam" target="_blank" + -- @MarkoDevTeam -- ${" "}or use the${" "} - a href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live" + a + ,href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live" + ,target="_blank" -- #markojs -- ${" "}hashtag div class=styles.bluesky - a href="https://bsky.app/profile/markojs.com" class=styles.logo + a + ,href="https://bsky.app/profile/markojs.com" + ,target="_blank" + ,class=styles.logo fa-icon=faBluesky span -- Keep up with the community on Bluesky at${" "} - a href="https://bsky.app/profile/markojs.com" -- @markojs.com + a href="https://bsky.app/profile/markojs.com" target="_blank" + -- @markojs.com div class=styles.github - a href="https://github.com/marko-js/marko" class=styles.logo + a + ,href="https://github.com/marko-js/marko" + ,target="_blank" + ,class=styles.logo fa-icon=faGithub span -- Browse the code, open issues, & make pull requests on${" "} - a href="https://github.com/marko-js/marko" -- GitHub + a href="https://github.com/marko-js/marko" target="_blank" -- GitHub diff --git a/src/tags/app-footer/app-footer.marko b/src/tags/app-footer/app-footer.marko index c2b0de19..0bb21160 100644 --- a/src/tags/app-footer/app-footer.marko +++ b/src/tags/app-footer/app-footer.marko @@ -1,16 +1,19 @@ import * as styles from "./app-footer.style.module.scss"; footer id=styles.footer - a href="https://openjsf.org/" class=styles.openjsf + a href="https://openjsf.org/" class=styles.openjsf target="_blank" img src="./openjsf.svg?no-inline" alt="" -- ${" "} span span class=styles.bold -- OpenJS  span class=styles.light -- Foundation div class=styles.separator - a href="https://github.com/marko-js/marko/blob/main/LICENSE" class=styles.osi + a + ,href="https://github.com/marko-js/marko/blob/main/LICENSE" + ,class=styles.osi + ,target="_blank" img src="./osi.svg?no-inline" alt="" -- ${" "}MIT License div class=styles.separator - a href="https://github.com/eBay" class=styles.ebay + a href="https://github.com/eBay" class=styles.ebay target="_blank" img src="./ebay.svg?no-inline" alt="eBay" -- ${" "}open source From 3927b4d0d9aeb009364e5ee0526c94d59c4d1b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Bon?= Date: Sun, 14 Sep 2025 10:41:53 +0200 Subject: [PATCH 2/2] fix: blank targets in markdown --- src/util/markodown.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/util/markodown.ts b/src/util/markodown.ts index ccfb346b..ef744629 100644 --- a/src/util/markodown.ts +++ b/src/util/markodown.ts @@ -1,6 +1,7 @@ import fs from "fs/promises"; import path from "path"; import { + marked, Marked, type MarkedExtension, type Tokens, @@ -64,7 +65,12 @@ export default function markodownPlugin(): PluginOption { async function mdToMarko(source: string) { const headings: HeadingList = []; const markoCode = await new Marked() - .use(semanticAdmonitions(), headingSections(headings), markoDocs()) + .use( + semanticAdmonitions(), + headingSections(headings), + markoDocs(), + externalLinks(), + ) .parse( // remove zero-width spaces (recommended from marked docs) source.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ""), @@ -315,6 +321,19 @@ function headingSections(headings: HeadingList): MarkedExtension { }; } +function externalLinks(): MarkedExtension { + return { + renderer: { + link(link) { + var out = marked.Renderer.prototype.link.apply(this, [link]); + const isExternal = /^https?:\/\//.test(link.href); + if (isExternal) return out.replace(/^ | undefined; async function acquireMutexLock() { const currLock = lock;