The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | const LEADING_FRONTMATTER = |
| 2 | /^\uFEFF?---[ \t]*(?:\r\n|\r|\n)(?:[\s\S]*?(?:\r\n|\r|\n))?(?:---|\.\.\.)[ \t]*(?=\r\n|\r|\n|$)/; |
| 3 | |
| 4 | /** |
| 5 | * Blanks a leading YAML frontmatter block so rendered previews skip it instead |
| 6 | * of showing a rule and a setext heading. Masked characters become spaces and |
| 7 | * line breaks stay, so source offsets (task checkbox edits) stay valid. |
| 8 | */ |
| 9 | export function maskMarkdownFrontmatter(markdown: string): string { |
| 10 | return markdown.replace(LEADING_FRONTMATTER, (block) => block.replace(/[^\r\n]/g, " ")); |
| 11 | } |