From 9f4ee858bd90bd03e7611af0e078c77cb513888e Mon Sep 17 00:00:00 2001 From: Akis Date: Tue, 29 Nov 2022 17:42:15 +0200 Subject: [PATCH] allow for markdown on announcements --- src/routes/+page.server.ts | 7 +++++-- src/routes/+page.svelte | 5 ++++- src/routes/contact/+page.svelte | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 846d961..28fba08 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -1,8 +1,11 @@ import type { PageServerLoad } from "./$types"; +import { compile } from "mdsvex"; export const load: PageServerLoad = async () => { return { state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()), - announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()) + announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()), + content: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code) } -} \ No newline at end of file +} + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ddfcc4e..927945c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -10,6 +10,7 @@ let announcements = data.announcements; let description: string = "Open source development and hosted services."; + @@ -63,8 +64,10 @@ .format("DD/MM/YYYY HH:mm")} + +
- {announcements.title} +
{@html data.content}
{#if announcements.link} diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte index 23aa112..796746a 100644 --- a/src/routes/contact/+page.svelte +++ b/src/routes/contact/+page.svelte @@ -13,7 +13,7 @@ -

{title}

+

Contact us

{description}