mirror of
https://github.com/open-webui/open-webui
synced 2024-11-06 00:32:05 +00:00
Merge pull request #2180 from austenadler/dev
Always open links in chat in a new tab
This commit is contained in:
commit
6e89a481be
@ -80,6 +80,13 @@
|
||||
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 & {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extensions: any;
|
||||
|
@ -12,11 +12,14 @@ export const sanitizeResponseContent = (content: string) => {
|
||||
.replace(/<$/, '')
|
||||
.replaceAll(/<\|[a-z]+\|>/g, ' ')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.trim();
|
||||
};
|
||||
|
||||
export const revertSanitizedResponseContent = (content: string) => {
|
||||
return content.replaceAll('<', '<');
|
||||
return content
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>');
|
||||
};
|
||||
|
||||
export const capitalizeFirstLetter = (string) => {
|
||||
|
Loading…
Reference in New Issue
Block a user