From a249b32b7db7211fdee90496819f15563a11b260 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 1 Sep 2026 12:13:34 +0100 Subject: [PATCH] fix: copy button --- src/data/event-parser.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/data/event-parser.ts b/src/data/event-parser.ts index 8b4ea47..1c3f656 100644 --- a/src/data/event-parser.ts +++ b/src/data/event-parser.ts @@ -3,6 +3,13 @@ import MarkdownIt from 'markdown-it'; import { EventSchema } from './event-schema'; import type { EventData, EventMetadata } from '../types/event'; +// gray-matter casts the source with Buffer.from() on every parse, and browsers have +// no Buffer, so without this the client throws before the app mounts. The result is +// only kept as an unused `orig` field, so a plain string stands in for it. +if (typeof globalThis.Buffer === 'undefined') { + (globalThis as { Buffer?: unknown }).Buffer = { from: (value: string) => value }; +} + const markdown = new MarkdownIt({ html: false, linkify: true, typographer: true }); export function parseEventSource(source: string, sourceName = 'event'): EventData {