diff --git a/Gemfile b/Gemfile
index 0c5bf9629..5f3f5d194 100644
--- a/Gemfile
+++ b/Gemfile
@@ -91,7 +91,7 @@ gem 'rails-assets-jquery', '1.11.1' # Should be kep
gem 'js_image_paths', '0.0.2'
gem 'js-routes', '1.0.0'
gem 'rails-assets-punycode', '1.3.2'
-gem 'rails-assets-markdown-it', '3.0.7'
+gem 'rails-assets-markdown-it', '3.1.0'
gem 'rails-assets-markdown-it-hashtag', '0.2.3'
gem 'rails-assets-markdown-it-diaspora-mention', '0.2.1'
gem 'rails-assets-markdown-it-sanitizer', '0.2.2'
diff --git a/Gemfile.lock b/Gemfile.lock
index 584ca38f0..0dd303616 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -503,7 +503,7 @@ GEM
rails-assets-jquery.slimscroll (1.3.3)
rails-assets-jquery (>= 1.7)
rails-assets-markdown-it--markdown-it-for-inline (0.1.0)
- rails-assets-markdown-it (3.0.7)
+ rails-assets-markdown-it (3.1.0)
rails-assets-markdown-it-diaspora-mention (0.2.1)
rails-assets-markdown-it-hashtag (0.2.3)
rails-assets-markdown-it-sanitizer (0.2.2)
@@ -762,7 +762,7 @@ DEPENDENCIES
rails-assets-jquery-idletimer (= 1.0.1)
rails-assets-jquery-placeholder (= 2.1.1)
rails-assets-jquery-textchange (= 0.2.3)
- rails-assets-markdown-it (= 3.0.7)
+ rails-assets-markdown-it (= 3.1.0)
rails-assets-markdown-it--markdown-it-for-inline (= 0.1.0)
rails-assets-markdown-it-diaspora-mention (= 0.2.1)
rails-assets-markdown-it-hashtag (= 0.2.3)
diff --git a/app/assets/javascripts/app/helpers/text_formatter.js b/app/assets/javascripts/app/helpers/text_formatter.js
index 6f3ef692d..a3733b629 100644
--- a/app/assets/javascripts/app/helpers/text_formatter.js
+++ b/app/assets/javascripts/app/helpers/text_formatter.js
@@ -72,10 +72,8 @@
var sanitizerPlugin = window.markdownitSanitizer;
md.use(sanitizerPlugin);
- // TODO this is a temporary fix
- // remove it as soon as markdown-it fixes its autolinking feature
- var linkifyPlugin = window.markdownitDiasporaLinkify;
- md.use(linkifyPlugin);
+ // xmpp: should behave like mailto:
+ md.linkify.add('xmpp:','mailto:');
// Bootstrap table markup
md.renderer.rules.table_open = function () { return '
\n'; };
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index c1b6c8160..4e8122f05 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -25,7 +25,6 @@
//= require handlebars.runtime
//= require posix-bracket-expressions
//= require markdown-it
-//= require markdown-it-diaspora-linkify
//= require markdown-it-diaspora-mention
//= require markdown-it-for-inline
//= require markdown-it-hashtag
diff --git a/lib/assets/javascripts/markdown-it-diaspora-linkify.js b/lib/assets/javascripts/markdown-it-diaspora-linkify.js
deleted file mode 100644
index 4ffa8f727..000000000
--- a/lib/assets/javascripts/markdown-it-diaspora-linkify.js
+++ /dev/null
@@ -1,120 +0,0 @@
-// TODO this is a temporary fix
-// remove it as soon as markdown-it fixes its autolinking feature
-
-/*! markdown-it-diaspora-linkify 0.1.0 https://github.com/diaspora/markdown-it-diaspora-linkify @license MIT */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.markdownitDiasporaLinkify=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\s]/i.test(str);
-}
-function isLinkClose(str) {
- return /^<\/a\s*>/i.test(str);
-}
-
-module.exports = function linkify_plugin(md) {
- var arrayReplaceAt = md.utils.arrayReplaceAt;
-
- function linkify(state) {
- var i, j, l, tokens, token, text, nodes, ln, pos, level, htmlLinkLevel,
- blockTokens = state.tokens, links, href, url;
-
- if (!state.md.options.linkify) { return; }
-
- for (j = 0, l = blockTokens.length; j < l; j++) {
- if (blockTokens[j].type !== 'inline') { continue; }
- tokens = blockTokens[j].children;
-
- htmlLinkLevel = 0;
-
- // We scan from the end, to keep position when new tags added.
- // Use reversed logic in links start/end match
- for (i = tokens.length - 1; i >= 0; i--) {
- token = tokens[i];
-
- // Skip content of markdown links
- if (token.type === 'link_close') {
- i--;
- while (tokens[i].level !== token.level && tokens[i].type !== 'link_open') {
- i--;
- }
- continue;
- }
-
- // Skip content of html tag links
- if (token.type === 'html_inline') {
- if (isLinkOpen(token.content) && htmlLinkLevel > 0) {
- htmlLinkLevel--;
- }
- if (isLinkClose(token.content)) {
- htmlLinkLevel++;
- }
- }
- if (htmlLinkLevel > 0) { continue; }
-
- if (token.type !== 'text') { continue; }
-
- links = token.content.match(urlRegex);
- if (links === null || !links.length) { continue; }
-
- text = token.content;
-
- // Now split string to nodes
- nodes = [];
- level = token.level;
-
- for (ln = 0; ln < links.length; ln++) {
- url = links[ln].trim();
- href = url;
-
- if (/^www/i.test(href)) { href = 'http://' + href; }
- pos = text.indexOf(url);
-
- if (pos) {
- level = level;
- nodes.push({
- type: 'text',
- content: text.slice(0, pos),
- level: level
- });
- }
- nodes.push({
- type: 'link_open',
- href: href,
- target: '',
- title: '',
- level: level++
- });
- nodes.push({
- type: 'text',
- content: url,
- level: level
- });
- nodes.push({
- type: 'link_close',
- level: --level
- });
- text = text.slice(pos + url.length);
- }
- if (text.length) {
- nodes.push({
- type: 'text',
- content: text,
- level: level
- });
- }
-
- // replace current node
- blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
- }
- }
- }
-
- md.core.ruler.at('linkify', linkify);
-};
-
-},{}]},{},[1])(1)
-});
diff --git a/spec/javascripts/app/helpers/text_formatter_spec.js b/spec/javascripts/app/helpers/text_formatter_spec.js
index a236b2620..0343dc4ed 100644
--- a/spec/javascripts/app/helpers/text_formatter_spec.js
+++ b/spec/javascripts/app/helpers/text_formatter_spec.js
@@ -158,7 +158,6 @@ describe("app.helpers.textFormatter", function(){
"http://www.bürgerentscheid-krankenhäuser.de", // example from issue #2665
"http://bündnis-für-krankenhäuser.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
"http://موقع.وزارة-الاتصالات.مصر/", // example from #3082
- "http:///scholar.google.com/citations?view_op=top_venues",
"http://lyricstranslate.com/en/someone-you-നിന്നെ-പോലൊരാള്.html", // example from #3063,
"http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)", // #3645
"http://wiki.com/?query=Kr%E4fte", // #4874
@@ -168,7 +167,6 @@ describe("app.helpers.textFormatter", function(){
"http://www.xn--brgerentscheid-krankenhuser-xkc78d.de",
"http://xn--bndnis-fr-krankenhuser-i5b27cha.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
"http://xn--4gbrim.xn----ymcbaaajlc6dj7bxne2c.xn--wgbh1c/",
- "http:///scholar.google.com/citations?view_op=top_venues",
"http://lyricstranslate.com/en/someone-you-%E0%B4%A8%E0%B4%BF%E0%B4%A8%E0%B5%8D%E0%B4%A8%E0%B5%86-%E0%B4%AA%E0%B5%8B%E0%B4%B2%E0%B5%8A%E0%B4%B0%E0%B4%BE%E0%B4%B3%E0%B5%8D%E2%80%8D.html",
"http://de.wikipedia.org/wiki/Liste_der_Abk%C3%BCrzungen_(Netzjargon)",
"http://wiki.com/?query=Kr%E4fte",