♻️ (app)

This commit is contained in:
Julien Calixte
2023-08-14 14:08:10 +02:00
parent 111794a40b
commit c0182c7f57
24 changed files with 4281 additions and 2108 deletions

View File

@@ -8,6 +8,7 @@ import markdownItCheckbox from 'markdown-it-checkbox'
import markdownItFootnote from 'markdown-it-footnote'
import markdownItIframe from 'markdown-it-iframe'
import markdownItLatex from 'markdown-it-latex'
import { Ref, toValue } from 'vue'
const md = new MarkdownIt({
typographer: true,
@@ -37,13 +38,13 @@ const md = new MarkdownIt({
height: 400
})
export const useMarkdown = (defaultPrefix?: string) => {
export const useMarkdown = (defaultPrefix?: Ref<string> | string) => {
return {
toHTML: (content: string) => (content ? md.render(content) : ''),
render: (content: string, prefix?: string) =>
content
? md.render(decodeBase64ToUTF8(content), {
docId: defaultPrefix ?? prefix ?? ''
docId: defaultPrefix ? toValue(defaultPrefix) : prefix ?? ''
})
: ''
}