can edit raw content

This commit is contained in:
Julien Calixte
2023-08-20 14:24:38 +02:00
parent 80867ff00b
commit 971df9c45b
5 changed files with 77 additions and 33 deletions

View File

@@ -40,6 +40,8 @@ const md = new MarkdownIt({
})
export const useMarkdown = (defaultPrefix?: Ref<string> | string) => {
const getRawContent = (content: string) => decodeBase64ToUTF8(content)
return {
toHTML: (content: string) => (content ? md.render(content) : ''),
render: (content: string, prefix?: string) =>
@@ -47,6 +49,7 @@ export const useMarkdown = (defaultPrefix?: Ref<string> | string) => {
? md.render(decodeBase64ToUTF8(content), {
docId: defaultPrefix ? toValue(defaultPrefix) : prefix ?? ''
})
: ''
: '',
getRawContent
}
}