imgui_markdown icon indicating copy to clipboard operation
imgui_markdown copied to clipboard

Support square brackets in link text

Open jasmaa opened this issue 2 years ago • 1 comments

Add support for nested square brackets in link text.

ex.

[alice [at] example dot com](https://example.com) previously parsed as:

TEXT: alice [at
LINK: https://example.com

This will now parse as:

TEXT: alice [at] example dot com
LINK: https://example.com

jasmaa avatar May 15 '22 02:05 jasmaa

Thanks for submitting this PR. We've done further testing using markdownlivepreview.com and redditpreview.com, and realised that neither the current imgui_markdown nor your suggested fix completely match the expected markdown behaviour. See the test below.

If you would like to amend your PR so it passes the test we will review it. Otherwise we will keep the current code so we don't break people's implementation.

Test square brackets in link text

Input

01. [link](https://www.github.com)  
02. [lin[]k](https://www.github.com)
03. [li[n]k](https://www.github.com)  
04. [lin][k](https://www.github.com)  
05. [lin[k](https://www.github.com)  
06. [lin[][k](https://www.github.com) 
07. [lin]k](https://www.github.com)  
08. [lin]]k](https://www.github.com)  
09. [li[n]]k](https://www.github.com)  
10. [link (https://www.github.com)  
11. [lin]k (https://www.github.com)

Expected Output - using markdownlivepreview.com:

1.  link
2.  lin[]k
3.  li[n]k
4.  [lin]k
5.  [link
6.  [lin[]k
7.  [lin]k](https://www.github.com)
8.  [lin]]k](https://www.github.com)
9.  [li[n]]k](https://www.github.com)
10. [link (https://www.github.com)
11. [lin]k (https://www.github.com/)

Actual - current imgu_markdown:

1.  link - P
2.  lin[
3.  li[n
4.  lin
5.  lin[k
6.  lin
7.  lin
8.  lin
9.  [li[n
10. [link (https://www.github.com/) - P
11. lin

Actual - this PR:

1.  link - P
2.  lin[]k - P
3.  li[n]k - P
4.  lin
5.  [lin[k](https://www.github.com)  
6.  [lin[][k](https://www.github.com) 
7.  lin
8.  lin
9.  li[n]
10. [link (https://www.github.com) - P
11. lin  

juliettef avatar Apr 02 '23 17:04 juliettef