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

display invalid front-matter

This commit is contained in:
Baptiste Augrain
2018-09-09 11:24:54 +02:00
parent 90f791de1b
commit f9d5c86245
2 changed files with 14 additions and 8 deletions

View File

@@ -4,11 +4,14 @@ export function findNoteTitle (value) {
let isInsideCodeBlock = false
if (splitted[0] === '---') {
let index = 0
while (++index < splitted.length && splitted[index] !== '---') {
}
let line = 0
while (++line < splitted.length) {
if (splitted[line] === '---') {
splitted.splice(0, line + 1)
splitted.splice(0, index + 1)
break
}
}
}
splitted.some((line, index) => {

View File

@@ -7,13 +7,16 @@ module.exports = function frontMatterPlugin (md) {
}
let line = 0
while (++line < state.lineMax && state.src.substring(state.bMarks[line], state.eMarks[line]) !== '---') {
}
while (++line < state.lineMax) {
if (state.src.substring(state.bMarks[line], state.eMarks[line]) === '---') {
state.line = line + 1
return true
}
}
return false
}
md.block.ruler.before('table', 'frontmatter', frontmatter, {
alt: [ 'paragraph', 'reference', 'blockquote', 'list' ]