mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
- hide front-matter in preview
- skip front-matter when looking for note's title
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
const frontMatterRegex = /^\-{3,}/
|
||||
|
||||
export function findNoteTitle (value) {
|
||||
const splitted = value.split('\n')
|
||||
let title = null
|
||||
let isInsideCodeBlock = false
|
||||
|
||||
if (frontMatterRegex.exec(splitted[0])) {
|
||||
let index = 0
|
||||
while (++index < splitted.length && !frontMatterRegex.exec(splitted[index])) {
|
||||
}
|
||||
|
||||
splitted.splice(0, index + 1)
|
||||
}
|
||||
|
||||
splitted.some((line, index) => {
|
||||
const trimmedLine = line.trim()
|
||||
const trimmedNextLine = splitted[index + 1] === undefined ? '' : splitted[index + 1].trim()
|
||||
|
||||
@@ -149,6 +149,7 @@ class Markdown {
|
||||
})
|
||||
this.md.use(require('markdown-it-kbd'))
|
||||
this.md.use(require('markdown-it-admonition'))
|
||||
this.md.use(require('markdown-it-front-matter'), fm => {})
|
||||
|
||||
const deflate = require('markdown-it-plantuml/lib/deflate')
|
||||
this.md.use(require('markdown-it-plantuml'), '', {
|
||||
|
||||
Reference in New Issue
Block a user