Text to Link Configuration - Nicologies/GitHubBuddy GitHub Wiki

This page describes how to configure the GitHubBuddy extension to convert text to hyperlink. More specifically convert Issue to the link to an external system such as TFS, JIRA, Trac. Of course you could possibly use it to do something else as well.

Let's say we want to convert JIRA-178 in the pull request title/commit title to a hyperlink to https://JIRAServer/browser/JIRA-178. We can use the following rule to achieve it where the

  • from is the text (JavaScript's regex is supported) to be converted. Please bear in mind that the \ needs to be escaped
  • to is the hyperlink target
  • displayAs is the new text to display
[
  {
    "from": "\\b([A-Z]{2,3})-(\\d+)\\b",
    "to": "https://JIRAServer/browser/$1-$2",
    "displayAs": "$1-$2"
  }
]

You can add as many rules as you want by separating them with comma e.g.

[
  {
    "from": "JIRA-(\\d+)",
    "to": "https://JIRAServer/browser/JIRA-$1",
    "displayAs": "JIRA-$1 "
  },
  {
    "from": "PBI-(\\d+)",
    "to": "https://TFSServer/xxx?id=$1",
    "displayAs": "PBI-$1"
  }
]