feat: Open links in new tab
This commit is contained in:
parent
40bf3e64fd
commit
74d6e86e79
@ -41,6 +41,7 @@
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/markdown-it-link-attributes": "^3.0.5",
|
||||
"@types/minio": "^7.1.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"better-auth": "^1.1.16",
|
||||
@ -52,6 +53,7 @@
|
||||
"lucide-svelte": "^0.474.0",
|
||||
"markdown-it": "^14.1.0",
|
||||
"markdown-it-highlightjs": "^4.2.0",
|
||||
"markdown-it-link-attributes": "^4.0.1",
|
||||
"minio": "^8.0.4",
|
||||
"mode-watcher": "^0.5.1",
|
||||
"socket.io": "^4.8.1",
|
||||
|
@ -1,5 +1,6 @@
|
||||
import markdownit from 'markdown-it';
|
||||
import highlightjs from 'markdown-it-highlightjs';
|
||||
import mila from 'markdown-it-link-attributes';
|
||||
|
||||
export default function renderMarkdown(input: string): string {
|
||||
const md = markdownit({
|
||||
@ -11,6 +12,12 @@ export default function renderMarkdown(input: string): string {
|
||||
|
||||
md.disable(['image', 'table']);
|
||||
md.use(highlightjs);
|
||||
md.use(mila, {
|
||||
attrs: {
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
},
|
||||
});
|
||||
|
||||
return md.render(input);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user