Skip to content

Scheduling infrastructure for absolutely everyone.

Fixed description by manually implementing asSafeHTML (#5321)

Alex van Andel98f6fd836e59
diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx
index 398e8e8c188..01102656e83 100644
--- a/apps/web/pages/[user]/[type].tsx
+++ b/apps/web/pages/[user]/[type].tsx
@@ -1,3 +1,4 @@
+import MarkdownIt from "markdown-it";
import { GetStaticPaths, GetStaticPropsContext } from "next";
import { JSONObject } from "superjson/dist/types";
import { z } from "zod";
@@ -112,6 +113,14 @@ async function getUserPageProps(context: GetStaticPropsContext) {
},
});
+ const md = new MarkdownIt("zero").enable([
+ //
+ "emphasis",
+ "list",
+ "newline",
+ "strikethrough",
+ ]);
+
if (!user || !user.eventTypes) return { notFound: true };
const [eventType]: (typeof user.eventTypes[number] & {
@@ -139,6 +148,7 @@ async function getUserPageProps(context: GetStaticPropsContext) {
metadata: EventTypeMetaDataSchema.parse(eventType.metadata || {}),
recurringEvent: parseRecurringEvent(eventType.recurringEvent),
locations: privacyFilteredLocations(locations),
+ descriptionAsSafeHTML: eventType.description ? md.render(eventType.description) : null,
});
return {