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

Usage of dangling ] messes up the parser. #12

Open
bogas04 opened this issue Mar 13, 2017 · 2 comments
Open

Usage of dangling ] messes up the parser. #12

bogas04 opened this issue Mar 13, 2017 · 2 comments

Comments

@bogas04
Copy link

bogas04 commented Mar 13, 2017

STR:

  • Use ]] in your string.
  • Observe the markdown output.

Expected:

  • ]] should come up normally.

Actual:

  • ]] doesn't come up.

Demo. Compare it with remarkable

Why I care ?

A Punjabi font uses roman characters to form Punjabi alphabets. It uses ]] for what is know as full stop in Punjabi. It is broken now after I moved from remarkable to snarkdown. I love the perf and size of library, and I understand why this might not be considered to be fixed, but I thought it's worth the shot!

@bogas04
Copy link
Author

bogas04 commented Mar 13, 2017

It's very hard to understand the regex but I guess

/(
  (?:^|\n+)
  (?:\n---+|\* \*(?: \*)+)\n) |
  (?:^```(\w*)\n([\s\S]*?)\n```$) |
  ((?:(?:^|\n+)(?:\t|  {2,}).+)+\n*) |
  ((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+) |

          vvvvv ----> this might be related 
  (?:\!\[([^\]]*?)\]\(([^\)]+?)\)) |

  (\[)|(\](?:\(([^\)]+?)\))?) |
  (?:(?:^|\n+)([^\s].*)\n(\-{3,}|={3,})(?:\n+|$)) |
  (?:(?:^|\n+)(#{1,3})\s*(.+)(?:\n+|$)) |
  (?:`([^`].*?)`) |
  (  \n\n*|\n{2,}|__|\*\*|[_*])
/gm,

PS: Are you considering breaking up the regex into RegExp objects to make it easier to work with it?

@developit
Copy link
Owner

developit commented Mar 13, 2017

@bogas04 impossible to break up the regex due to filesize constraints, but perhaps having a commented out multiline version above would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants