Skip to content
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

convert newline to markdown newline #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

convert newline to markdown newline #3

wants to merge 1 commit into from

Conversation

mes-shahadat
Copy link

1st regex replaces all line breaks with \ characters (one per line), so you don't need to use
tag for line breaks. when converting from md to html it will parse as
tag by default.

2nd regex replaces any \ that is followed by - # * + character with \tab instead. so it escapes tab character instead of those character

This is done so that it at least somewhat looks clean inside both the editor text version and the preview version.

1st regex replaces all line breaks with \ characters (one per line), so you don't need to use <br> tag for line breaks. when converting from md to html it will parse as <br> tag by default.

2nd regex replaces any \ that is followed by - # * + character with \tab instead. so it escapes tab character instead of those character

This is done so that it at least somewhat looks clean inside both the editor text version and the preview version.
@mes-shahadat mes-shahadat changed the title Create convert newline to markdown newline convert newline to markdown newline Sep 21, 2021
Copy link
Author

@mes-shahadat mes-shahadat left a comment

Choose a reason for hiding this comment

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

"^\(\n)(?=[#+])"->"$1⁣$1"

plz change the 2nd regex with this regex, cause in some cases (in \\n+ or \\n*) the \ character is still shown after escaping tab character. so it's better to use U+2063 character instead of tab character.

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.

1 participant