diff --git a/package.json b/package.json index d0f3ca5c..82654d0b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "axios": "^0.24.0", + "discord-markdown": "^2.5.1", "svelte-icons": "^2.1.0", "svelte-navigator": "^3.1.5", "sveltestrap": "^5.6.3" diff --git a/src/functions.ts b/src/functions.ts deleted file mode 100644 index dd21fc51..00000000 --- a/src/functions.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { currentUser, loggedIn } from "./stores"; -import PKAPI from "./api"; -import type Sys from './api/system'; - - -function blockQuote(text: string) { - let match = text.match(/(?<=\n|^)(> [^\n]*(?:\n>[^\n]*)*)/gim); - let parse: string[] = []; - for (let i = 0; i < match.length; i++) { - parse[i] = match[i].replace(/(?<=\n|^)> ?/gim, ""); - text = text.replace(match[i], `
${parse[i]}
`); - } - return text; -} - -export function parseMarkdown(text: string) { - text = blockQuote(text); - text = text.replace(/\*{3}(.*?)\*{3}/gim, '$1'); - text = text.replace(/\*{2}(.*?)\*{2}/gim, '$1'); - text = text.replace(/\*{1}(.*?)\*{1}/gim, '$1'); - text = text.replace(/\n/gim, '
') - return text; -} \ No newline at end of file diff --git a/src/lib/cards/System.svelte b/src/lib/cards/System.svelte index 80580ed3..deeadf92 100644 --- a/src/lib/cards/System.svelte +++ b/src/lib/cards/System.svelte @@ -1,10 +1,10 @@