1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Merge pull request #324 from BoostIO/feature_note_title_markdown_sharp

ignore # in the code block
This commit is contained in:
SuenagaRyota
2017-03-17 21:48:16 -07:00
committed by GitHub

View File

@@ -65,10 +65,13 @@ class MarkdownNoteDetail extends React.Component {
findTitle (value) {
let splitted = value.split('\n')
let title = null
let isMarkdownInCode = false
for (let i = 0; i < splitted.length; i++) {
let trimmedLine = splitted[i].trim()
if (trimmedLine.match(/^# .+/)) {
if (trimmedLine.match('```')) {
isMarkdownInCode = !isMarkdownInCode
} else if (isMarkdownInCode === false && trimmedLine.match(/^# +/)) {
title = trimmedLine.substring(1, trimmedLine.length).trim()
break
}