Fixed description by manually implementing asSafeHTML (#5321)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>pull/5208/head^2
parent
a8710ce625
commit
98f6fd836e
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue