fix(dashboard): parse news messages as markdown
This commit is contained in:
parent
a5a8bb34c6
commit
6ec5031957
3 changed files with 19 additions and 6 deletions
|
|
@ -23,9 +23,12 @@
|
|||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.36.0",
|
||||
"globals": "^15.0.0",
|
||||
"luxon": "^3.5.0",
|
||||
"marked": "^14.1.3",
|
||||
"prettier": "^3.1.1",
|
||||
"prettier-plugin-svelte": "^3.1.2",
|
||||
"sass": "^1.80.1",
|
||||
"snarkdown": "^2.0.0",
|
||||
"svelecte": "^4.3.1",
|
||||
"svelte": "^4.2.7",
|
||||
"svelte-check": "^4.0.0",
|
||||
|
|
@ -34,8 +37,5 @@
|
|||
"vite": "^5.0.3",
|
||||
"vite-plugin-markdown": "^2.2.0"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"luxon": "^3.5.0"
|
||||
}
|
||||
"type": "module"
|
||||
}
|
||||
|
|
@ -7,9 +7,12 @@
|
|||
CardText,
|
||||
} from "@sveltestrap/sveltestrap";
|
||||
import { DateTime } from "luxon";
|
||||
import { marked } from "marked";
|
||||
|
||||
export let message: NewsMessage;
|
||||
|
||||
$: content = marked.parse(message.content, { breaks: true });
|
||||
|
||||
$: postedAt = DateTime.fromISO(message.posted_at).toLocaleString(
|
||||
DateTime.DATETIME_MED,
|
||||
);
|
||||
|
|
@ -20,7 +23,7 @@
|
|||
|
||||
<Card>
|
||||
<CardBody>
|
||||
<CardText>{message.content}</CardText>
|
||||
<CardText>{@html content}</CardText>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
From {message.author} • Posted {postedAt}
|
||||
|
|
|
|||
|
|
@ -1306,6 +1306,11 @@ markdown-it@^12.0.0:
|
|||
mdurl "^1.0.1"
|
||||
uc.micro "^1.0.5"
|
||||
|
||||
marked@^14.1.3:
|
||||
version "14.1.3"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-14.1.3.tgz#42372cffd22e76e0f1d7f3627ebc116d291abbed"
|
||||
integrity sha512-ZibJqTULGlt9g5k4VMARAktMAjXoVnnr+Y3aCqW1oDftcV4BA3UmrBifzXoZyenHRk75csiPu9iwsTj4VNBT0g==
|
||||
|
||||
mdn-data@2.0.30:
|
||||
version "2.0.30"
|
||||
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc"
|
||||
|
|
@ -1590,6 +1595,11 @@ sirv@^3.0.0:
|
|||
mrmime "^2.0.0"
|
||||
totalist "^3.0.0"
|
||||
|
||||
snarkdown@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/snarkdown/-/snarkdown-2.0.0.tgz#b1feb4db91b9f94a8ebbd7a50f3e99aee18b1e03"
|
||||
integrity sha512-MgL/7k/AZdXCTJiNgrO7chgDqaB9FGM/1Tvlcenenb7div6obaDATzs16JhFyHHBGodHT3B7RzRc5qk8pFhg3A==
|
||||
|
||||
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1, source-map-js@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue