From 8e5f189462d7ac4f492b3805dd19e9924744dcf8 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Fri, 22 Dec 2017 21:32:20 +0100
Subject: [PATCH] Create extension to render JIRA TAG links

See https://github.com/showdownjs/showdown/wiki/Extensions
---
 app/static/js/items.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/static/js/items.js b/app/static/js/items.js
index 850696e..e32d90a 100644
--- a/app/static/js/items.js
+++ b/app/static/js/items.js
@@ -6,7 +6,17 @@ $(document).ready(function() {
     scrollBy(0, -100);
   }
 
+  // Showdown extension to render links to JIRA TAG project
+  var jira_tag = {
+      type: 'lang',
+      regex: /(TAG-\d+)/g,
+      replace: '[$1](https://jira.esss.lu.se/browse/$1)'
+  };
+  // Register the extension
+  showdown.extension('jira_tag', jira_tag);
+
   var converter = new showdown.Converter({
+    extensions: ['jira_tag'],
     simplifiedAutoLink: true
   });
 
-- 
GitLab