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 links and parentheses don't work well together #90

Merged
merged 13 commits into from
Apr 23, 2021

Conversation

gaebel
Copy link
Contributor

@gaebel gaebel commented Apr 22, 2021

Continues #79, Fixes #78

Summary by @AndreasVerhoeven

  • we count the number of opening and closing parentheses in the link
  • if we have more closing parentheses than opening parentheses
  • AND if there are closing parentheses at the end of the link, we assume they should originally have been outside of the link and be part of the regular text

This seems to work well in practice: Almost all links with parentheses have them balanced (e.g. wikipedia links), and links surrounded by () now work correctly as well

I've fixed the merge conflicts and changed the replaceDefault method to use generics

In addition to that:

  • Fixes an issues with inline parentheses of the link text and url
  • Adds https as scheme if it is missing

Planning to add:

  • Ability to provide a default scheme

Copy link
Collaborator

@benjohnde benjohnde left a comment

Choose a reason for hiding this comment

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

LGTM, just one small question arose during that review!

@benjohnde
Copy link
Collaborator

Ah, never mind :) LGTM!

@benjohnde benjohnde merged commit c0706cc into master Apr 23, 2021
@benjohnde benjohnde deleted the AndreasVerhoeven-master branch April 23, 2021 12:46
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.

Links and parentheses don't work well together
3 participants