[feat] tag visible in realm
This commit is contained in:
@@ -10,6 +10,12 @@ const convertor = new showdown.Converter({
|
||||
tables: true
|
||||
})
|
||||
|
||||
const safeConvertor = new showdown.Converter({
|
||||
simpleLineBreaks: true,
|
||||
strikethrough: true,
|
||||
tables: true,
|
||||
backslashEscapesHTMLTags: true
|
||||
})
|
||||
|
||||
DOMPurify.addHook("uponSanitizeElement", (node: HTMLElement, data) => {
|
||||
if (data.tagName === "iframe") {
|
||||
@@ -38,6 +44,12 @@ export async function ParseMarkdown(data:string, char:(character | groupChat) =
|
||||
})
|
||||
}
|
||||
|
||||
export function parseMarkdownSafe(data:string) {
|
||||
return DOMPurify.sanitize(safeConvertor.makeHtml(data), {
|
||||
FORBID_TAGS: ["a", "style"]
|
||||
})
|
||||
}
|
||||
|
||||
export async function hasher(data:Uint8Array){
|
||||
return Buffer.from(await crypto.subtle.digest("SHA-256", data)).toString('hex');
|
||||
}
|
||||
Reference in New Issue
Block a user