robinst / autolink-java

Java library to extract links (URLs, email addresses) from plain text; fast, small and smart
MIT License
207 stars 40 forks source link

support of git/github links automatic linking #16

Closed McFoggy closed 6 years ago

McFoggy commented 7 years ago

in the context of gitbucket/gitbucket#1323 and extending commonmark-java, I'd like to add the possibility to discover links from:

The "autolinked references" I'd like to detect are those described in github documentation.

I am currently implementing this, but it requires some internal changes in the project because several scanners will be able to be fired for the same characterset (for example for '@' or [a-zA-Z]). Thus I'd like to know if you would accept such changes. The changes I have in mind:

robinst commented 7 years ago

Hey! Interesting.

How would you detect commit hashes without having to check on almost every single character? And then if you have multiple scanners for the same character, I wonder how you can make that efficient enough. It seems like this might be something that a regex might be better for, as the patterns look fairly regular. Have you experimented with that?

(I realize this might sound negative, but I'm just a bit skeptical.)

McFoggy commented 7 years ago

@robinst I do not take it 'negative' ;-) I was expecting this because what I asked/proposed is a bit also against the way (or at least disruptive) your project is currently working. Of course a regexp would play nicely but not less than for existing recognitions (www scanner, URL scanner).

robinst commented 6 years ago

Hey, I'm gonna close this, I've decided that I don't want to expand the scope of this project further. And for the purpose of integrating something like that for Markdown rendering, I think doing another pass over the text is fine.