Skip to content

Conversation

@sosukesuzuki
Copy link
Member

I solved the issue.

Before

Previously, a character string beginning with '#' in the code block was treated as the title of the markdown note.
2017-03-17 03 53 24

After

Currently, strings beginning with '#' in the code block are ignored.
2017-03-17 03 52 42

findTitle (value) {
let splitted = value.split('\n')
let title = null
let markdownInCode = false
Copy link
Contributor

@asmsuechan asmsuechan Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codeBlockInMarkdown, isCodeBlockInMarkdown or isCodeBlockInNote?

markdownInCode = false
} else {
markdownInCode = true
}
Copy link
Contributor

@asmsuechan asmsuechan Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markdownInCode = !markdownInCode looks better for me.

if (trimmedLine.match('```')){
  markdownInCode = !markdownInCode
}

title = trimmedLine.substring(1, trimmedLine.length).trim()
break
}
}
Copy link
Contributor

@asmsuechan asmsuechan Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can make this if clause better. Like below:

if(markdownInCode === false && trimmendLine.match(/^# +/)){
  title = trimmedLine.substring(1, trimmedLine.length).trim()
  break
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your advice ! I will fix it soon.

break
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'll fix it soon.

Copy link
Contributor

@asmsuechan asmsuechan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2017-03-17 at 21 33 58

It behaves perfectly! LGTM 👍

@asmsuechan asmsuechan merged commit 41a5858 into master Mar 18, 2017
@asmsuechan asmsuechan deleted the feature_note_title_markdown_sharp branch March 18, 2017 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants