-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ignore # in the code block #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,12 +65,16 @@ 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(/^# .+/)) { | ||
| title = trimmedLine.substring(1, trimmedLine.length).trim() | ||
| break | ||
| if (trimmedLine.match('```')){ | ||
| isMarkdownInCode = !isMarkdownInCode | ||
| } else if (isMarkdownInCode === false && trimmedLine.match(/^# +/)) { | ||
| title = trimmedLine.substring(1, trimmedLine.length).trim() | ||
| break | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your advice ! I will fix it soon. |
||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code doesn't work. Because there is an extra
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'll fix it soon. |
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
ifclause better. Like below:There was a problem hiding this comment.
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.