fix: copy button

This commit is contained in:
2026-09-01 12:13:34 +01:00
parent 8ca84e0564
commit a249b32b7d
+7
View File
@@ -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 {