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

Parse GFM Extended autolinks #71

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

stephenreddek
Copy link
Contributor

This ends up breaking tests around the standard autolinks which assert that if it isn't exactly between <> then it shouldn't result in a link.

GFM test 628 isn't passing yet because of my strict interpretation of only allowing http and https. I have written out a question about that in the issue (#57 ). it is trivial to add support for ftp, but opens up the question of what else is possible to support.

I'm still working on how to strip out autolink tokens from html anchor nodes, but I think there's enough here for discussion.

@@ -22,5 +22,5 @@ Should give output:
But instead was:

````````````html
<p><p>Already linked:</p><a href="http://example.com/"><p>http://example.com/</p></a><p>.</p></p><p>Already linked:<a href="http://example.com/">http://example.com/</a>.</p><p>Already linked:<a href="http://example.com/"><p><strong>http://example.com/</strong></p></a>.</p>
<p><p>Already linked:</p><a href="http://example.com/"><p><a href="http://example.com/">http://example.com/</a></p></a><p>.</p></p><p>Already linked:<a href="http://example.com/">http://example.com/</a>.</p><p>Already linked:<a href="http://example.com/"><p><strong><a href="http://example.com/">http://example.com/</a></strong></p></a>.</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test still needs to be fixed.


extendedAutoLinkRegex : Regex
extendedAutoLinkRegex =
-- what if we do this without the negative lookbehind and just make it a sub match?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve this question


extendedAutoLinkTrailingPunctuationRegex : Regex
extendedAutoLinkTrailingPunctuationRegex =
--should this use the isPunctuation helper?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve


````````````html
<p>[email protected]</p><p>[email protected].</p><p>[email protected]</p><p>[email protected]_</p>
<p><a href="http://commonmark.org">http://commonmark.org</a></p><p>(Visit<a href="https://encrypted.google.com/search?q=Markup+(business)">https://encrypted.google.com/search?q=Markup+(business)</a>)</p><p>Anonymous FTP is available at ftp://foo.bar.baz.</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only failing because we restricted autolinks to http and https

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