Skip to content

Instantly share code, notes, and snippets.

Created October 28, 2020 16:09
What would you like to do?
TiddlyWiki wikirule for JIRA ticket links
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; = "jiralink";
exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
this.matchRegExp = new RegExp(/[A-Z]+-\d+/, "mg");
exports.parse = function() {
// Get the details of the match
var linkText = this.match[0];
var href = "" + linkText;
// Move past the macro call
this.parser.pos = this.matchRegExp.lastIndex;
return [{
type: "element",
tag: "a",
attributes: {
href: {type: "string", value: href},
"class": {type: "string", value: "tc-tiddlylink-external"},
target: {type: "string", value: "_blank"},
rel: {type: "string", value: "noopener noreferrer"}
children: [{
type: "text", text: this.match[0]
Copy link

Should use type application/javascript and field module-type: wikirule for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment