Conversation
| findTitle (value) { | ||
| let splitted = value.split('\n') | ||
| let title = null | ||
| let markdownInCode = false |
There was a problem hiding this comment.
codeBlockInMarkdown, isCodeBlockInMarkdown or isCodeBlockInNote?
| markdownInCode = false | ||
| } else { | ||
| markdownInCode = true | ||
| } |
There was a problem hiding this comment.
markdownInCode = !markdownInCode looks better for me.
if (trimmedLine.match('```')){
markdownInCode = !markdownInCode
}
| title = trimmedLine.substring(1, trimmedLine.length).trim() | ||
| break | ||
| } | ||
| } |
There was a problem hiding this comment.
Perhaps you can make this if clause better. Like below:
if(markdownInCode === false && trimmendLine.match(/^# +/)){
title = trimmedLine.substring(1, trimmedLine.length).trim()
break
}
There was a problem hiding this comment.
Thanks for correcting my code. I think that it is readble than my code. I'll rewrite it.
| title = trimmedLine.substring(1, trimmedLine.length).trim() | ||
| break | ||
| } | ||
| } |
There was a problem hiding this comment.
Thanks for corrections! And I recognized 1 point. You can reduce 1 indent like this below:
if (trimmedLine.match('```')){
isMarkdownInCode = !isMarkdownInCode
} else if(isMarkdownInCode === false && trimmedLine.match(/^# +/)) {
title = trimmedLine.substring(1, trimmedLine.length).trim()
break
}
There was a problem hiding this comment.
Thank you for your advice ! I will fix it soon.
| break | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This code doesn't work. Because there is an extra }. And also the indents are not good 😨
if (trimmedLine.match('```')){
isMarkdownInCode = !isMarkdownInCode
} else if (isMarkdownInCode === false && trimmedLine.match(/^# +/)) {
title = trimmedLine.substring(1, trimmedLine.length).trim()
break
}
There was a problem hiding this comment.
Sorry, I'll fix it soon.

I solved the issue.
Before
Previously, a character string beginning with '#' in the code block was treated as the title of the markdown note.

After
Currently, strings beginning with '#' in the code block are ignored.
