{"id":15988684,"url":"https://github.com/michael-simons/java-autolinker","last_synced_at":"2025-03-27T06:31:06.612Z","repository":{"id":1264888,"uuid":"1203876","full_name":"michael-simons/java-autolinker","owner":"michael-simons","description":"An extendable autolinking library","archived":false,"fork":false,"pushed_at":"2018-06-16T11:24:07.000Z","size":151,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T05:52:21.341Z","etag":null,"topics":["autolink","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michael-simons.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-28T20:07:38.000Z","updated_at":"2018-06-16T11:24:09.000Z","dependencies_parsed_at":"2022-08-16T12:50:22.395Z","dependency_job_id":null,"html_url":"https://github.com/michael-simons/java-autolinker","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-simons%2Fjava-autolinker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-simons%2Fjava-autolinker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-simons%2Fjava-autolinker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-simons%2Fjava-autolinker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael-simons","download_url":"https://codeload.github.com/michael-simons/java-autolinker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245797398,"owners_count":20673848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autolink","java"],"created_at":"2024-10-08T04:20:42.377Z","updated_at":"2025-03-27T06:31:05.883Z","avatar_url":"https://github.com/michael-simons.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. An extendable autolinking library\r\n\r\n!https://travis-ci.org/michael-simons/java-autolinker.svg?branch=master!:https://travis-ci.org/michael-simons/java-autolinker !https://maven-badges.herokuapp.com/maven-central/eu.michael-simons/java-autolinker/badge.svg(Maven Central)!:https://maven-badges.herokuapp.com/maven-central/eu.michael-simons/java-autolinker\r\n\r\nUnder the impression that it is nearly impossible to write a robust autolinker without parsing the input text to a dom tree, i've written an autolinker that uses \"Jsoup\":http://jsoup.org/ to build trees and proccess them in a way that new types of links can easily be added.\r\n\r\nThe core service of this project is the _AutoLinkService_ which uses several _AutoLinkers_ to add links to arbitrary text. 3 autolinkers (URLs, E-Mail adresses and Twitter Handles) are build in.\r\n\r\nThe project is a ready to use configured maven project and has nearly 100% test coverage.\r\n\r\n*Important*\r\n\r\nSince version 0.1.1 this project is Java 8 *only*.\r\n\r\nSince version 0.2.1 this project is Java 10+ *only*. In addition, it uses Spring Boots dependency management.\r\n\r\nSince version 0.3.1 I have changed the API of _AutoLinkService_ and removed _Optional\u003c\u003e_ as input parameter as suggested by various people (Joshua Bloch, Simon Harrer and others).\r\n\r\nh2. Usage\r\n\r\nh3. Standalone\r\n\r\n\u003cpre\u003e\u003ccode lang=\"java\"\u003e\r\npublic static void main(String... args) {\r\n\t// Instantiate AutoLinkService using all available autolinkers\r\n\tfinal AutoLinkService autoLinkService = new AutoLinkService(Arrays.asList(\r\n\t\tnew EmailAddressAutoLinker(true, true),\r\n\t\tnew TwitterUserAutoLinker(),\r\n\t\tnew UrlAutoLinker(30)\r\n\t));\r\n\t// Autolink stuff\r\n\tSystem.out.println(autoLinkService.addLinks(\"Maybe there's a link http://michael-simons.eu to @rotnroll666\", Optional.empty()));\r\n}\r\n\u003c/code\u003e\u003c/pre\u003e\r\n\r\nor have a look at the test code.\r\n\r\nThe _AutoLinkService_  can be easily registered as a\r\n\r\nh3. As a Spring bean\r\n\r\n\u003cpre\u003e\u003ccode lang=\"java\"\u003e\r\n@Bean\r\npublic AutoLinkService autoLinkService(\r\n  @Value(\"${dailyfratze.emailAddressAutoLinker.hexEncodeEmailAddress:true}\") boolean hexEncodeEmailAddress,\r\n  @Value(\"${dailyfratze.emailAddressAutoLinker.obfuscateEmailAddress:true}\") boolean obfuscateEmailAddress,\r\n  @Value(\"${dailyfratze.urlAutoLinker.maxLabelLength:30}\") int maxLabelLength\r\n) {\r\n  return new AutoLinkService(Arrays.asList(\r\n  \t\tnew EmailAddressAutoLinker(hexEncodeEmailAddress, obfuscateEmailAddress),\r\n  \t\tnew TwitterUserAutoLinker(),\r\n  \t\tnew UrlAutoLinker(maxLabelLength)\r\n  ));\r\n}\r\n\u003c/code\u003e\u003c/pre\u003e\r\n\r\nI assume you know what you're doing with Spring, so i don't explain that further.\r\n\r\nEnjoy and if you find that library usefull, drop me a line or star it. Thanks.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-simons%2Fjava-autolinker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael-simons%2Fjava-autolinker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-simons%2Fjava-autolinker/lists"}