// Markdown `content` is a JSON string. Records created via the API (or
// legacy/corrupt data) may not be valid JSON; an unguarded JSON.parse in a
// render path throws and white-screens the whole page (including the public
// /pg/* route). Parse defensively and degrade to a readable fallback.
export function parseMarkdownContent(raw) {
    try {
        return JSON.parse(raw);
    } catch (e) {
        return { markdown: "> ⚠️ This document could not be displayed: its stored content is not valid." };
    }
}
