{"action":"created","comment":{"url":"https://api.github.com/repos/yegor256/netbout/pulls/comments/48054601","id":48054601,"diff_hunk":"@@ -37,9 +40,51 @@\n  * @since 2.23\n  */\n public final class MarkdownTxtmark implements Markdown {\n+    /**\n+     * Plain link detection pattern.\n+     */\n+    private static final Pattern LINK = Pattern.compile(\n+        \"https?://[a-zA-Z0-9-._~:/\\\\?#@!$&'*+,;=%]+[a-zA-Z0-9-_~/#@$&'*+=%]\"\n+    );\n \n     @Override\n     public String html(@NotNull final String txt) {\n-        throw new UnsupportedOperationException(\"not implemented yet\");\n+        return Processor.process(MarkdownTxtmark.formatLinks(txt));\n+    }\n+\n+    /**\n+     * Replace plain links with Markdown syntax. To be convinced it doesn't\n+     * replace links inside markdown syntax, it ensures that characters\n+     * before and after link do not match to Markdown link syntax.\n+     * @param txt Text to find links in\n+     * @return Text with Markdown-formatted links\n+     */\n+    private static String formatLinks(final String txt) {\n+        final String marker = \"](\";\n+        final String html = \"=\\\"\";\n+        final StringBuilder result = new StringBuilder();\n+        final Matcher matcher = MarkdownTxtmark.LINK.matcher(txt);\n+        int start = 0;\n+        while (matcher.find(start)) {\n+            result.append(txt.substring(start, matcher.start()));\n+            final String prefix = txt.substring(\n+                Math.max(0, matcher.start() - 2),","path":"netbout-web/src/main/java/com/netbout/rest/MarkdownTxtmark.java","position":43,"original_position":43,"commit_id":"55b7ce4826301c36880ebf5460526f44b23ef945","original_commit_id":"55b7ce4826301c36880ebf5460526f44b23ef945","user":{"login":"longtimeago","id":1388994,"avatar_url":"https://avatars.githubusercontent.com/u/1388994?v=3","gravatar_id":"","url":"https://api.github.com/users/longtimeago","html_url":"https://github.com/longtimeago","followers_url":"https://api.github.com/users/longtimeago/followers","following_url":"https://api.github.com/users/longtimeago/following{/other_user}","gists_url":"https://api.github.com/users/longtimeago/gists{/gist_id}","starred_url":"https://api.github.com/users/longtimeago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/longtimeago/subscriptions","organizations_url":"https://api.github.com/users/longtimeago/orgs","repos_url":"https://api.github.com/users/longtimeago/repos","events_url":"https://api.github.com/users/longtimeago/events{/privacy}","received_events_url":"https://api.github.com/users/longtimeago/received_events","type":"User","site_admin":false},"body":"@dmzaytsev what is \"2\" in this case?","created_at":"2015-12-18T18:34:10Z","updated_at":"2015-12-18T18:34:10Z","html_url":"https://github.com/yegor256/netbout/pull/885#discussion_r48054601","pull_request_url":"https://api.github.com/repos/yegor256/netbout/pulls/885","_links":{"self":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/comments/48054601"},"html":{"href":"https://github.com/yegor256/netbout/pull/885#discussion_r48054601"},"pull_request":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/885"}}},"pull_request":{"url":"https://api.github.com/repos/yegor256/netbout/pulls/885","id":54065513,"html_url":"https://github.com/yegor256/netbout/pull/885","diff_url":"https://github.com/yegor256/netbout/pull/885.diff","patch_url":"https://github.com/yegor256/netbout/pull/885.patch","issue_url":"https://api.github.com/repos/yegor256/netbout/issues/885","number":885,"state":"open","locked":false,"title":"#873 implemented MarkdownTxtMark","user":{"login":"dmzaytsev","id":9972909,"avatar_url":"https://avatars.githubusercontent.com/u/9972909?v=3","gravatar_id":"","url":"https://api.github.com/users/dmzaytsev","html_url":"https://github.com/dmzaytsev","followers_url":"https://api.github.com/users/dmzaytsev/followers","following_url":"https://api.github.com/users/dmzaytsev/following{/other_user}","gists_url":"https://api.github.com/users/dmzaytsev/gists{/gist_id}","starred_url":"https://api.github.com/users/dmzaytsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmzaytsev/subscriptions","organizations_url":"https://api.github.com/users/dmzaytsev/orgs","repos_url":"https://api.github.com/users/dmzaytsev/repos","events_url":"https://api.github.com/users/dmzaytsev/events{/privacy}","received_events_url":"https://api.github.com/users/dmzaytsev/received_events","type":"User","site_admin":false},"body":"For #873\r\n\r\n* implemented MarkdownTxtMark\r\n* turned on the unit tests. TxtMark produces more correct html code than Pegdown, that's why I have made some corrections in the unit tests\r\n","created_at":"2015-12-18T05:04:34Z","updated_at":"2015-12-18T18:34:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52d03942edfd7ef6c01ea9624743c14dbc305a65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yegor256/netbout/pulls/885/commits","review_comments_url":"https://api.github.com/repos/yegor256/netbout/pulls/885/comments","review_comment_url":"https://api.github.com/repos/yegor256/netbout/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yegor256/netbout/issues/885/comments","statuses_url":"https://api.github.com/repos/yegor256/netbout/statuses/55b7ce4826301c36880ebf5460526f44b23ef945","head":{"label":"dmzaytsev:873","ref":"873","sha":"55b7ce4826301c36880ebf5460526f44b23ef945","user":{"login":"dmzaytsev","id":9972909,"avatar_url":"https://avatars.githubusercontent.com/u/9972909?v=3","gravatar_id":"","url":"https://api.github.com/users/dmzaytsev","html_url":"https://github.com/dmzaytsev","followers_url":"https://api.github.com/users/dmzaytsev/followers","following_url":"https://api.github.com/users/dmzaytsev/following{/other_user}","gists_url":"https://api.github.com/users/dmzaytsev/gists{/gist_id}","starred_url":"https://api.github.com/users/dmzaytsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmzaytsev/subscriptions","organizations_url":"https://api.github.com/users/dmzaytsev/orgs","repos_url":"https://api.github.com/users/dmzaytsev/repos","events_url":"https://api.github.com/users/dmzaytsev/events{/privacy}","received_events_url":"https://api.github.com/users/dmzaytsev/received_events","type":"User","site_admin":false},"repo":{"id":35738218,"name":"netbout","full_name":"dmzaytsev/netbout","owner":{"login":"dmzaytsev","id":9972909,"avatar_url":"https://avatars.githubusercontent.com/u/9972909?v=3","gravatar_id":"","url":"https://api.github.com/users/dmzaytsev","html_url":"https://github.com/dmzaytsev","followers_url":"https://api.github.com/users/dmzaytsev/followers","following_url":"https://api.github.com/users/dmzaytsev/following{/other_user}","gists_url":"https://api.github.com/users/dmzaytsev/gists{/gist_id}","starred_url":"https://api.github.com/users/dmzaytsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmzaytsev/subscriptions","organizations_url":"https://api.github.com/users/dmzaytsev/orgs","repos_url":"https://api.github.com/users/dmzaytsev/repos","events_url":"https://api.github.com/users/dmzaytsev/events{/privacy}","received_events_url":"https://api.github.com/users/dmzaytsev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmzaytsev/netbout","description":"Private talks made easy","fork":true,"url":"https://api.github.com/repos/dmzaytsev/netbout","forks_url":"https://api.github.com/repos/dmzaytsev/netbout/forks","keys_url":"https://api.github.com/repos/dmzaytsev/netbout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmzaytsev/netbout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmzaytsev/netbout/teams","hooks_url":"https://api.github.com/repos/dmzaytsev/netbout/hooks","issue_events_url":"https://api.github.com/repos/dmzaytsev/netbout/issues/events{/number}","events_url":"https://api.github.com/repos/dmzaytsev/netbout/events","assignees_url":"https://api.github.com/repos/dmzaytsev/netbout/assignees{/user}","branches_url":"https://api.github.com/repos/dmzaytsev/netbout/branches{/branch}","tags_url":"https://api.github.com/repos/dmzaytsev/netbout/tags","blobs_url":"https://api.github.com/repos/dmzaytsev/netbout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmzaytsev/netbout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmzaytsev/netbout/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmzaytsev/netbout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmzaytsev/netbout/statuses/{sha}","languages_url":"https://api.github.com/repos/dmzaytsev/netbout/languages","stargazers_url":"https://api.github.com/repos/dmzaytsev/netbout/stargazers","contributors_url":"https://api.github.com/repos/dmzaytsev/netbout/contributors","subscribers_url":"https://api.github.com/repos/dmzaytsev/netbout/subscribers","subscription_url":"https://api.github.com/repos/dmzaytsev/netbout/subscription","commits_url":"https://api.github.com/repos/dmzaytsev/netbout/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmzaytsev/netbout/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmzaytsev/netbout/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmzaytsev/netbout/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmzaytsev/netbout/contents/{+path}","compare_url":"https://api.github.com/repos/dmzaytsev/netbout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmzaytsev/netbout/merges","archive_url":"https://api.github.com/repos/dmzaytsev/netbout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmzaytsev/netbout/downloads","issues_url":"https://api.github.com/repos/dmzaytsev/netbout/issues{/number}","pulls_url":"https://api.github.com/repos/dmzaytsev/netbout/pulls{/number}","milestones_url":"https://api.github.com/repos/dmzaytsev/netbout/milestones{/number}","notifications_url":"https://api.github.com/repos/dmzaytsev/netbout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmzaytsev/netbout/labels{/name}","releases_url":"https://api.github.com/repos/dmzaytsev/netbout/releases{/id}","created_at":"2015-05-16T20:00:57Z","updated_at":"2015-05-16T20:00:59Z","pushed_at":"2015-12-18T18:02:57Z","git_url":"git://github.com/dmzaytsev/netbout.git","ssh_url":"git@github.com:dmzaytsev/netbout.git","clone_url":"https://github.com/dmzaytsev/netbout.git","svn_url":"https://github.com/dmzaytsev/netbout","homepage":"www.netbout.com","size":17437,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yegor256:master","ref":"master","sha":"93fd560f1fc8a2c966a715966a4ac28c2eb17fb2","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"repo":{"id":9580819,"name":"netbout","full_name":"yegor256/netbout","owner":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yegor256/netbout","description":"Private talks made easy","fork":false,"url":"https://api.github.com/repos/yegor256/netbout","forks_url":"https://api.github.com/repos/yegor256/netbout/forks","keys_url":"https://api.github.com/repos/yegor256/netbout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yegor256/netbout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yegor256/netbout/teams","hooks_url":"https://api.github.com/repos/yegor256/netbout/hooks","issue_events_url":"https://api.github.com/repos/yegor256/netbout/issues/events{/number}","events_url":"https://api.github.com/repos/yegor256/netbout/events","assignees_url":"https://api.github.com/repos/yegor256/netbout/assignees{/user}","branches_url":"https://api.github.com/repos/yegor256/netbout/branches{/branch}","tags_url":"https://api.github.com/repos/yegor256/netbout/tags","blobs_url":"https://api.github.com/repos/yegor256/netbout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yegor256/netbout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yegor256/netbout/git/refs{/sha}","trees_url":"https://api.github.com/repos/yegor256/netbout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yegor256/netbout/statuses/{sha}","languages_url":"https://api.github.com/repos/yegor256/netbout/languages","stargazers_url":"https://api.github.com/repos/yegor256/netbout/stargazers","contributors_url":"https://api.github.com/repos/yegor256/netbout/contributors","subscribers_url":"https://api.github.com/repos/yegor256/netbout/subscribers","subscription_url":"https://api.github.com/repos/yegor256/netbout/subscription","commits_url":"https://api.github.com/repos/yegor256/netbout/commits{/sha}","git_commits_url":"https://api.github.com/repos/yegor256/netbout/git/commits{/sha}","comments_url":"https://api.github.com/repos/yegor256/netbout/comments{/number}","issue_comment_url":"https://api.github.com/repos/yegor256/netbout/issues/comments{/number}","contents_url":"https://api.github.com/repos/yegor256/netbout/contents/{+path}","compare_url":"https://api.github.com/repos/yegor256/netbout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yegor256/netbout/merges","archive_url":"https://api.github.com/repos/yegor256/netbout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yegor256/netbout/downloads","issues_url":"https://api.github.com/repos/yegor256/netbout/issues{/number}","pulls_url":"https://api.github.com/repos/yegor256/netbout/pulls{/number}","milestones_url":"https://api.github.com/repos/yegor256/netbout/milestones{/number}","notifications_url":"https://api.github.com/repos/yegor256/netbout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yegor256/netbout/labels{/name}","releases_url":"https://api.github.com/repos/yegor256/netbout/releases{/id}","created_at":"2013-04-21T14:49:21Z","updated_at":"2015-11-10T19:42:00Z","pushed_at":"2015-12-18T18:02:57Z","git_url":"git://github.com/yegor256/netbout.git","ssh_url":"git@github.com:yegor256/netbout.git","clone_url":"https://github.com/yegor256/netbout.git","svn_url":"https://github.com/yegor256/netbout","homepage":"www.netbout.com","size":17487,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"open_issues_count":90,"forks":20,"open_issues":90,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/885"},"html":{"href":"https://github.com/yegor256/netbout/pull/885"},"issue":{"href":"https://api.github.com/repos/yegor256/netbout/issues/885"},"comments":{"href":"https://api.github.com/repos/yegor256/netbout/issues/885/comments"},"review_comments":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/885/comments"},"review_comment":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/885/commits"},"statuses":{"href":"https://api.github.com/repos/yegor256/netbout/statuses/55b7ce4826301c36880ebf5460526f44b23ef945"}}}}