diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js
index fe28939..f293603 100644
--- a/WebKit/scripts/helper/Core.js
+++ b/WebKit/scripts/helper/Core.js
@@ -3,11 +3,12 @@ define([
"helper/APICalls",
"lib/URI",
"helper/HostApp",
+ "lib/Markdown",
"lib/Timeago",
"lib/SingleDoubleClick"
],
-function(jQuery, APICalls, URI, HostApp) {
+function(jQuery, APICalls, URI, HostApp, Markdown) {
function Core() {
this.saveScrollTop = 0;
@@ -660,14 +661,8 @@ function(jQuery, APICalls, URI, HostApp) {
}
Core.prototype.replaceURLWithHTMLLinks = function(text, entities, message_node) {
- // FIXME: this has to be done better so one can nest that stuff and escape with \
- return text.replace(/_([^_]+)_/g, "$1")
- .replace(/\*([^\*]+)\*/g, "$1")
- .replace(/`([^`]+)`/g, "$1
")
- .replace(/~([^~]+)~/g, "$1")
- .replace(/\#([^\s]+)/g, "#$1")
- .replace(/(^|[^\^])\[([^\]]+)\]\(([^\)]+)\)/g, "$1$2")
- .replace(/\^\[([^\]]+)\]\((\d+)\)/g, "$1");
+ return Markdown.toHTML( text, 'Tent', { footnotes: entities } )
+ .replace(/\^