2021-03-13 18:15:14 +01:00
|
|
|
# Add a custom linkifier
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2017-01-17 18:54:19 +01:00
|
|
|
{!admin-only.md!}
|
|
|
|
|
2018-10-01 19:20:28 +02:00
|
|
|
Linkifiers make it easy to refer to issues or tickets in third
|
2018-07-18 18:40:08 +02:00
|
|
|
party issue trackers, like GitHub, Salesforce, Zendesk, and others.
|
2021-03-13 18:15:14 +01:00
|
|
|
For instance, you can add a linkifier that automatically turns `#2468`
|
2018-07-18 18:40:08 +02:00
|
|
|
into a link to `https://github.com/zulip/zulip/issues/2468`.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2019-04-03 01:12:26 +02:00
|
|
|
If the pattern appears in a message topic, Zulip adds a little button to the
|
|
|
|
right of the topic that links to the appropriate URL.
|
|
|
|
|
2021-03-13 18:15:14 +01:00
|
|
|
### Add a custom linkifier
|
2019-04-03 01:12:26 +02:00
|
|
|
|
|
|
|
{start_tabs}
|
|
|
|
|
2021-03-13 18:15:14 +01:00
|
|
|
{settings_tab|linkifier-settings}
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-11-21 06:03:49 +01:00
|
|
|
1. Under **Add a new linkifier**, enter a **Pattern** and
|
2018-07-18 18:40:08 +02:00
|
|
|
**URL format string**.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-10-01 19:20:28 +02:00
|
|
|
1. Click **Add linkifier**.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2019-04-03 01:12:26 +02:00
|
|
|
{end_tabs}
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-11-21 06:03:49 +01:00
|
|
|
## Understanding linkification patterns
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-07-18 18:40:08 +02:00
|
|
|
This is best explained by example.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-07-18 18:40:08 +02:00
|
|
|
Hash followed by a number of any length.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-11-21 06:03:49 +01:00
|
|
|
* Pattern: `#(?P<id>[0-9]+)`
|
2018-07-18 18:40:08 +02:00
|
|
|
* URL format string: `https://github.com/zulip/zulip/issues/%(id)s`
|
|
|
|
* Original text: `#2468`
|
|
|
|
* Automatically links to: `https://github.com/zulip/zulip/issues/2468`
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-07-18 18:40:08 +02:00
|
|
|
String of hexadecimal digits between 7 and 40 characters long.
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2018-11-21 06:03:49 +01:00
|
|
|
* Pattern: `(?P<id>[0-9a-f]{7,40})`
|
2018-07-18 18:40:08 +02:00
|
|
|
* URL format string: `https://github.com/zulip/zulip/commit/%(id)s`
|
|
|
|
* Original text: `abdc123`
|
|
|
|
* Automatically links to: `https://github.com/zulip/zulip/commit/abcd123`
|
2017-01-02 18:00:23 +01:00
|
|
|
|
2019-04-03 01:12:26 +02:00
|
|
|
Generic GitHub `org/repo#ID` format:
|
2018-12-17 21:44:44 +01:00
|
|
|
|
2018-11-21 06:03:49 +01:00
|
|
|
* Pattern: `(?P<org>[a-zA-Z0-9_-]+)/(?P<repo>[a-zA-Z0-9_-]+)#(?P<id>[0-9]+)`
|
2018-12-17 21:44:44 +01:00
|
|
|
* URL format string: `https://github.com/%(org)s/%(repo)s/issues/%(id)s`
|
|
|
|
* Original text: `zulip/zulip#2468`
|
|
|
|
* Automatically links to: `https://github.com/zulip/zulip/issues/2468`
|
|
|
|
|
2021-12-31 02:07:27 +01:00
|
|
|
Linkifier patterns are regular expressions, using the
|
|
|
|
[re2](https://github.com/google/re2/wiki/Syntax) regular expression
|
|
|
|
engine.
|
2020-06-03 23:04:20 +02:00
|
|
|
|
|
|
|
If you have any trouble setting these up, please [contact
|
|
|
|
us](/help/contact-support) with details on what you're trying to do,
|
|
|
|
and we'll be happy to help you out.
|