1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

front-matter must be delimited by ---

This commit is contained in:
Baptiste Augrain
2018-09-08 10:43:02 +02:00
parent bfd4d7ffe1
commit 90f791de1b
5 changed files with 24 additions and 10 deletions

View File

@@ -1,13 +1,11 @@
const frontMatterRegex = /^\-{3,}/
export function findNoteTitle (value) {
const splitted = value.split('\n')
let title = null
let isInsideCodeBlock = false
if (frontMatterRegex.exec(splitted[0])) {
if (splitted[0] === '---') {
let index = 0
while (++index < splitted.length && !frontMatterRegex.exec(splitted[index])) {
while (++index < splitted.length && splitted[index] !== '---') {
}
splitted.splice(0, index + 1)