From b08ee503ef74b636c76273ddc0127ea83e5e052c Mon Sep 17 00:00:00 2001 From: Jason Blais <13119842+jasonblais@users.noreply.github.com> Date: Thu, 4 Apr 2019 07:35:44 -0400 Subject: [PATCH 1/2] Add examples for autolink plugin I'm aware that some of these are in the usage list above, but I want to start a list of examples that we share with communities and build it out over time. --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index bf914612..d56859a8 100755 --- a/README.md +++ b/README.md @@ -89,3 +89,17 @@ Below is an example of regexp patterns used for autolinking, modified in the `co } }, ``` + +## Examples + +1. Autolinking `Ticket ####:text with alphanumberic characters and spaces` to a ticket link. Use: + - Pattern: `(?i)(ticket )(?P)( : )(?P.*)` + - Template: `(ticket ${ticket_id}:${ticket_info})` + +2. Autolinking a link to a GitHub PR to a link with format "pr-repo-id". Use: + - Pattern: `https://github\\.com/mattermost/(?P.+)/pull/(?P\\d+)` + - Template: `[pr-${repo}-${id}](https://github.com/mattermost/${repo}/pull/${id})` + +3. Using autolinking to create group mentions. Use: + - Pattern: `@customgroup*` + - Template: `[@customgroup]( \\* @user1 @user2 @user3 \\* )` From 20dcb22f0ea13cfe07a69538f5588fafe4a991a4 Mon Sep 17 00:00:00 2001 From: Jason Blais <13119842+jasonblais@users.noreply.github.com> Date: Fri, 12 Apr 2019 00:59:13 -0400 Subject: [PATCH 2/2] Update example 1 based on feedback --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d56859a8..8ddfaf8a 100755 --- a/README.md +++ b/README.md @@ -93,8 +93,8 @@ Below is an example of regexp patterns used for autolinking, modified in the `co ## Examples 1. Autolinking `Ticket ####:text with alphanumberic characters and spaces` to a ticket link. Use: - - Pattern: `(?i)(ticket )(?P)( : )(?P.*)` - - Template: `(ticket ${ticket_id}:${ticket_info})` + - Pattern: `(?i)(ticket )(?P.+)(:)(?P.*)`, or if the ticket_id is a number, then `(?i)(ticket )(?P\d+)(:)(?P.*)` + - Template: `[Ticket ${ticket_id}: ${ticket_info}](https://github.com/mattermost/mattermost-server/issues/${ticket_id})` 2. Autolinking a link to a GitHub PR to a link with format "pr-repo-id". Use: - Pattern: `https://github\\.com/mattermost/(?P.+)/pull/(?P\\d+)`