From e04f3e317e8eee0c9a2bba5169c4bfda0bec99b2 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 15 May 2025 15:11:11 +0200 Subject: [PATCH] Open markdown rendered links in new tab --- dashboard/src/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dashboard/src/index.js b/dashboard/src/index.js index e5b71abec..33b136b07 100644 --- a/dashboard/src/index.js +++ b/dashboard/src/index.js @@ -4,6 +4,18 @@ import '@fontsource/noto-sans'; import { tooltip, fallbackImage } from 'pankow'; +// Override the link rendering method for markdown renderings to open in new tab +import { marked } from 'marked'; + +const renderer = new marked.Renderer(); +renderer.link = function(item) { + const titleAttr = item.title ? ` title="${item.title}"` : ''; + return `${item.text}`; +}; + +marked.setOptions({ renderer }); + + import i18n from './i18n.js'; import Index from './Index.vue';