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

Fix for #258 "Mixing italic and Link Markdown destroyes the link." #271

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HuFlungDu
Copy link

@HuFlungDu HuFlungDu commented Apr 27, 2016

This commit changes the link parser to handle it's text parsing in a new strong_state/em_state context, as well as ensuring that it will only parse the text in between the [] for the link text.

Before, the parser em state would break when you put _ in a link, and it would cause broken HTML when you would do something like this:

[some_link](http://link_address)

That would output:

<p>[some<em>link](http://link</em>address)</p>

Which is hot nonsense. The same thing would also happen if you wanted to emphasize an entire link, but wanted _ or * in your link text/address or also put emphasis on link text (Not usual, but possible if you are using this for user input).

This now more closely resembles the original markdown.pl (it still is different because this one will allow emphasis on the entire link while having underscores in the link text, while the original markdown.pl would output something like <p><em><a href="http://link_address">some</em>link</a>_</p>. This library never output that anyway, so this is closer than it used to be).

I also updated the package.json to use grunt-node-tap 1.0.0 , because I was otherwise unable to run the tests, and it doesn't seem to break anything. If that's a problem, I can remove that from the commit and merge that.

… * or _ in link text and link name

Also changed grunt-node-tap version in package.json to 1.0.0, since it doesn't break anything and the old version has troubles on newer node versions.

This commit fixes evilstreak#258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant