| 1 | const RE_FRONTMATTER_BLOCK = /^---\n([\s\S]*?)\n---(?:\n|$)/ |
| 2 | |
| 3 | export function parseSideEditorContent(content: string) { |
| 4 | let frontmatterRaw: string | undefined |
| 5 | const contentOnly = content.trim().replace(RE_FRONTMATTER_BLOCK, (_, f) => { |
| 6 | frontmatterRaw = f |
| 7 | return '' |
| 8 | }) |
| 9 | |
| 10 | return { |
| 11 | content: contentOnly, |
| 12 | frontmatterRaw, |
| 13 | } |
| 14 | } |
| 15 |