-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add initial support for Markdown #5
Conversation
src/parser.js
Outdated
if (line.startsWith("# ")) { | ||
var slicedLine = line.slice(2); | ||
return `<h1>${slicedLine}</h1>`; | ||
} else if (line.startsWith("## ")) { | ||
var slicedLine = line.slice(3); | ||
return `<h2>${slicedLine}</h2>`; | ||
} else if (line.startsWith("### ")) { | ||
var slicedLine = line.slice(3); | ||
return `<h3>${slicedLine}</h3>`; | ||
} else if (line.startsWith("_") && line.endsWith("_")) { | ||
var slicedLine = line.slice(1); | ||
slicedLine = slicedLine.slice(0, -1); | ||
return `<i>${slicedLine}</i>`; | ||
} else { | ||
return `<p>${line}</p>`; | ||
} | ||
}) |
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.
I would like you to refer from using var
since it's outdated just use a let
and declare it before the line 42.
Is there a way that you can change this part line 54
your are assuming that italics takes the entire line, could you implement it the way that would allow for something like this hello _italic_ hello
. I think this regex would help(\*|_)(.*?)\1
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.
Used 'let' instead of 'var' variable and added regex to find lines in italics as you mentioned.
Please have a look and let me know if it's okay to merge. Thanks
Looks good |
Fixes #4