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

em and strong fail if html with _ inside #107

Closed
Cerdic opened this issue Feb 16, 2014 · 10 comments
Closed

em and strong fail if html with _ inside #107

Cerdic opened this issue Feb 16, 2014 · 10 comments

Comments

@Cerdic
Copy link

Cerdic commented Feb 16, 2014

This test case works fine
___em strong <a href="http://parsedown.org/" class='externallink'>Parsedown</a>___

Whereas this fails
___em strong <a href="http://parsedown.org/" class='external_link'>Parsedown</a>___

@wkpark
Copy link
Contributor

wkpark commented Feb 17, 2014

Similar case

**em <a href="#" alt="*">*em*</a>**

Pasedown does not handle these cases correctly.

@wkpark
Copy link
Contributor

wkpark commented Feb 18, 2014

Another case

**[**FOO**](/bar/)**

FOO GFM also fail to parse it.

http://johnmacfarlane.net/babelmark2/?text=**%5B**FOO**%5D(%2Furl%2F)**

@Cerdic
Copy link
Author

Cerdic commented Feb 18, 2014

This last case is a bit different as strong in strong is not supposed to be supported in any case.
For the **em <a href="#" alt="*">*em*</a>**case I thing we could fix it in a similar way of first case
Cerdic@5caabe0

@wkpark
Copy link
Contributor

wkpark commented Feb 18, 2014

@Cerdic all examples are correctly rendered by the Markdown 1.0.2b8

@Cerdic
Copy link
Author

Cerdic commented Feb 18, 2014

@wkpark ok my bad !

@aidantwoods
Copy link
Collaborator

Closing for the reasons outlined in #588

@Cerdic
Copy link
Author

Cerdic commented Mar 29, 2018

Too bad :(
I had to patch last version again in Cerdic@870839b as the use-case I initialy described is quite frequent in the CMS I'm using where URL in plain text are auto-changed into link with a class containing underscore char :
___em strong <a href="http://parsedown.org/" class='external_link'>Parsedown</a>___

I understand that the patch doesn't fix all cases, especialy the one described in #588 but I think that ignoring html tags in the regexp as proposed gives a much better robustness for a not a such perf impact.

@aidantwoods
Copy link
Collaborator

What happens if you try something like ___em strong <a href="http://parsedown.org/" class='external_link'>foo_bar</a>___ with the patched regex?

@Cerdic
Copy link
Author

Cerdic commented Mar 29, 2018

it fails :(

@aidantwoods
Copy link
Collaborator

If there were an easy fix for most cases then I'd definitely be up for getting Parsedown to behave a bit better. I think the regex only really addresses the specific case of delimiters between angle brackets though (which is fine if that's all you need! :) ).

Sure, we could patch the regex to try to find closing tags, but then what about * foo `bar* baz` boo*? If we keep special casing then we'd end up putting an entire copy of the parser in each inline.

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

4 participants