* @param {string} content * @return {?string}
(content)
| 34 | * @return {?string} |
| 35 | */ |
| 36 | function getFrontmatter(content) { |
| 37 | const end = content.search(/(\n-|\n#)/m); |
| 38 | if (end < 0) { |
| 39 | return null; |
| 40 | } |
| 41 | const withWhitespace = content.substr(0, end); |
| 42 | if (withWhitespace.trim().length < 1) { |
| 43 | return null; |
| 44 | } |
| 45 | return withWhitespace; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @param {?string} maybeComment |