developit / snarkdown

:smirk_cat: A snarky 1kb Markdown parser written in JavaScript
http://jsfiddle.net/developit/828w6t1x/
MIT License
2.28k stars 110 forks source link

The output for nested italic and bold is incorrect. #113

Open 0smr opened 1 year ago

0smr commented 1 year ago

Hi, it seems the output for ***text*** or ___text___ is incorrect. The correct output should be either <em><strong>text</strong></em> or <strong><em>text</em></strong>. Currently, it is <strong><em>text<strong><em></em></strong></em></strong>.

0smr commented 1 year ago

@NguyenHoangHieu22GIT2 Actually, it's impressive considering its tiny source size, but as it consists solely of a single regular expression, fixing any issues is almost impossible.

AlexanderFarkas commented 1 month ago

@0smr AFAIK any lexer can be rewritten into regular expression, if it operates on a language with regular grammar. I believe, fixing issues is hard due to parser being embedded into the lexing process - it basically does everything in a single run.

0smr commented 1 month ago

@AlexanderFarkas I understand that. I just opened the issue so that the maintainer would be aware of it, and any other developer who sees this. However, I didn't wait for any fixes since I was sure that this wouldn't get fixed in the near future.