Skip to content

Instantly share code, notes, and snippets.

@neonxp
Created October 2, 2018 23:41
Show Gist options
  • Save neonxp/695df01a3259b67ce75d077d3c9b4efa to your computer and use it in GitHub Desktop.
Save neonxp/695df01a3259b67ce75d077d3c9b4efa to your computer and use it in GitHub Desktop.
rep(/\n/gi, "<br />");
rep(/\[\[button\s+([a-z0-9\-_]+)(?:\s+(.+?))?\]\]/i,"<a href='#'>WDButton::$1</a>");
rep(/\*\*(.*?)\*\*/gi,"<span style=\"font-weight: bold;\">$1</span>");
rep(/--(.*?)--/gi,"<span style=\"text-decoration: line-through;\">$1</span>");
rep(/\{\{(.*?)\}\}/gi,"<pre>$1</pre>");
rep(/\^\^(.*?)\^\^/gi,"<sup>$1</sup>");
rep(/,,(.*?),,/gi,"<sub>$1</sub>");
rep(/\[\[span(.*)?\]\](.*?)\[\[\/span\]\]/mi,"<span $1>$2</span>");
rep(/\[\[table(.*)?\]\](.*?)\[\[\/table\]\]/mi,"<table$1>$2</table>");
rep(/\[\[row(.*)?\]\](.*?)\[\[\/row\]\]/mi,"<tr$1>$2</tr>");
rep(/\[\[cell(.*)?\]\](.*?)\[\[\/cell\]\]/mi,"<th$1>$2</th>");
rep(/\[\[size ([a-zA-Z]+|.*?(%|em|px))\]\](.*?)\[\[\/size\]\]/gi,"<span style=\"font-size: $1\">$3</span>");
rep(/\#\#([a-zA-Z]+)\|(.+?)\#\#/,"<span style=\"color: $1;\">$2</span>");
rep(/\#\#([0-9A-Fa-f]{6})\|(.+?)\#\#/,"<span style=\"color: #$1;\">$2</span>");
rep(/\/\/(.*?)\/\//gi,"<span style=\"font-style: italic;\">$1</span>");
rep(/__(.*?)__/gi,"<span style=\"text-decoration: underline;\">$1</span>");
rep(/\[\[image ([^\"]*?)\]\]/gi,"<img src=\"$1\" />");
rep(/^\* (.*?)$/gi, "<li>$1</li>");
rep(/\[\[image ([^\"]*?)\]\]/gi,"<img src=\"$1\" />");
rep(/\[([^\]]+) ([\s\S]*?)\]/gi,"<a href=\"$1\">$2</a>");
rep(/\[code\]([\s\S]*?)\[\/code\]/gi,"<pre>$1</pre>&nbsp;");
rep(/(\[\[# )([-_A-Za-z0-9.%]+?)(\]\])/i,"<a name=\"$2\"></a>");
rep(/\(\(bibcite\s([a-z0-9]+)\)\)/i,"Not Yet Supported");
rep(/ _\n/,"<br />\n");
rep(/\n\= (.*?)\n/,'<p style="text-align: center;">$1</p>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment