(content)
| 846 | } |
| 847 | |
| 848 | function parseFrontmatter(content) { |
| 849 | if (!content.startsWith("---\n") && !content.startsWith("---\r\n")) { |
| 850 | return null; |
| 851 | } |
| 852 | |
| 853 | const normalized = content.replace(/\r\n/g, "\n"); |
| 854 | const end = normalized.indexOf("\n---", 4); |
| 855 | if (end === -1) return null; |
| 856 | return normalized.slice(4, end); |
| 857 | } |
| 858 | |
| 859 | function readFrontmatterField(frontmatter, field) { |
| 860 | const pattern = new RegExp(`^${field}\\s*:(.*)$`); |
no outgoing calls
no test coverage detected