Skip to content

Commit

Permalink
Merge pull request #48 from jasonblais/patch-4
Browse files Browse the repository at this point in the history
Add examples for autolink plugin
  • Loading branch information
jespino committed May 6, 2019
2 parents c23dab0 + 20dcb22 commit 61c9e1e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<ticket_id>.+)(:)(?P<ticket_info>.*)`, or if the ticket_id is a number, then `(?i)(ticket )(?P<ticket_id>\d+)(:)(?P<ticket_info>.*)`
- 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<repo>.+)/pull/(?P<id>\\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 \\* )`

0 comments on commit 61c9e1e

Please sign in to comment.