ruivieira / nim-slimdown

Nim module that converts Markdown text to HTML using only regular expressions. Based on jbroadway's Slimdown.
MIT License
10 stars 1 forks source link

Cannot handle nested strong and emphasized text #4

Open glennj opened 3 years ago

glennj commented 3 years ago

Hardly worth leaving an issue for this as it is inherently unsolvable with a regex-based approach

$ inim
👑 INim 0.6.1
Nim Compiler Version 1.4.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import slimdown
nim> let html = slimdown.md("this is ___bold and emphasized___ text")
nim> html
this is <strong><em>bold and emphasized</strong></em> text == type string
# .......111111..22......................111111...22

Of course the correct html would be

this is <strong><em>bold and emphasized</em></strong> text
# .......111111..22......................22...111111
ruivieira commented 3 years ago

@glennj thanks. You are are right that's would need an approach beyond regex.

In the meantime, this is __*bold and emphasized*__ text seems to be the way :)