|
|
@ -2,6 +2,7 @@ |
|
|
|
import MarkdownIt from 'markdown-it'; |
|
|
|
import MarkdownIt from 'markdown-it'; |
|
|
|
|
|
|
|
|
|
|
|
export function markdownToHtml(markdown: string, isInline = true): string { |
|
|
|
export function markdownToHtml(markdown: string, isInline = true): string { |
|
|
|
|
|
|
|
try { |
|
|
|
const md = new MarkdownIt({ |
|
|
|
const md = new MarkdownIt({ |
|
|
|
html: true, |
|
|
|
html: true, |
|
|
|
linkify: true, |
|
|
|
linkify: true, |
|
|
@ -12,6 +13,9 @@ export function markdownToHtml(markdown: string, isInline = true): string { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return md.render(markdown); |
|
|
|
return md.render(markdown); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
return markdown; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// This is a workaround for the issue with tiptap-markdown extension
|
|
|
|
// This is a workaround for the issue with tiptap-markdown extension
|
|
|
|