mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
display invalid front-matter
This commit is contained in:
@@ -4,11 +4,14 @@ export function findNoteTitle (value) {
|
|||||||
let isInsideCodeBlock = false
|
let isInsideCodeBlock = false
|
||||||
|
|
||||||
if (splitted[0] === '---') {
|
if (splitted[0] === '---') {
|
||||||
let index = 0
|
let line = 0
|
||||||
while (++index < splitted.length && splitted[index] !== '---') {
|
while (++line < splitted.length) {
|
||||||
}
|
if (splitted[line] === '---') {
|
||||||
|
splitted.splice(0, line + 1)
|
||||||
|
|
||||||
splitted.splice(0, index + 1)
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
splitted.some((line, index) => {
|
splitted.some((line, index) => {
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ module.exports = function frontMatterPlugin (md) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let line = 0
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state.line = line + 1
|
return false
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
md.block.ruler.before('table', 'frontmatter', frontmatter, {
|
md.block.ruler.before('table', 'frontmatter', frontmatter, {
|
||||||
|
|||||||
Reference in New Issue
Block a user