Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

feat: open research sources in a new tab (#3351) (#3374)

Francesco Aliprandic1ba557482bd
diff --git a/src/local_deep_research/web/static/js/services/ui.js b/src/local_deep_research/web/static/js/services/ui.js
index 32eefe22c1..f169dcb34a 100644
--- a/src/local_deep_research/web/static/js/services/ui.js
+++ b/src/local_deep_research/web/static/js/services/ui.js
@@ -232,7 +232,13 @@ function renderMarkdown(markdown) {
try {
// Use marked library if available
if (typeof marked !== 'undefined') {
- // Configure marked options
+ // Configure marked options and custom renderer for links and special elements
+ const renderer = new marked.Renderer();
+ const _origLink = renderer.link.bind(renderer);
+ renderer.link = function(href, title, text) {
+ const html = _origLink(href, title, text);
+ return html.replace(/^<a /, '<a target="_blank" rel="noopener noreferrer" ');
+ };
marked.setOptions({
breaks: true,
gfm: true,
@@ -249,14 +255,16 @@ function renderMarkdown(markdown) {
});
// Parse markdown and return HTML
- const html = marked.parse(markdown);
+ const html = marked.parse(markdown, { renderer });
// Process any special elements like image references
const processedHtml = processSpecialMarkdown(html);
// Sanitize to prevent XSS from markdown content
const sanitized = typeof DOMPurify !== 'undefined'
- ? DOMPurify.sanitize(processedHtml)
+ ? DOMPurify.sanitize(processedHtml, {
+ ADD_ATTR: ['target', 'rel'] // Required because DOMPurify removes target/_blank by default
+ })
: processedHtml;
return `<div class="ldr-markdown-content">${sanitized}</div>`;