mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 06:45:24 +00:00
Always open links in a new tab
This commit is contained in:
parent
9a95767062
commit
3a1fbb936b
1 changed files with 7 additions and 0 deletions
|
|
@ -78,6 +78,13 @@
|
||||||
return `<code>${code.replaceAll('&', '&')}</code>`;
|
return `<code>${code.replaceAll('&', '&')}</code>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Open all links in a new tab/window (from https://github.com/markedjs/marked/issues/655#issuecomment-383226346)
|
||||||
|
const origLinkRenderer = renderer.link;
|
||||||
|
renderer.link = (href, title, text) => {
|
||||||
|
const html = origLinkRenderer.call(renderer, href, title, text);
|
||||||
|
return html.replace(/^<a /, '<a target="_blank" rel="nofollow" ');
|
||||||
|
};
|
||||||
|
|
||||||
const { extensions, ...defaults } = marked.getDefaults() as marked.MarkedOptions & {
|
const { extensions, ...defaults } = marked.getDefaults() as marked.MarkedOptions & {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
extensions: any;
|
extensions: any;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue