aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-11-17 11:15:07 -0500
committercel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-11-17 11:39:49 -0500
commit459eba02cf0dda726f884a72d4446afbcaddc973 (patch)
tree410857ea085e7bb3a80f4ebc510d6a519279b87f
parent28771e2b31bd45a7412d5dbc09b9622710126094 (diff)
downloadpatchfoo-459eba02cf0dda726f884a72d4446afbcaddc973.tar.gz
patchfoo-459eba02cf0dda726f884a72d4446afbcaddc973.zip
Linkify more protocols
-rw-r--r--vendor/ssb-marked.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/ssb-marked.js b/vendor/ssb-marked.js
index fbc6523..cd693cc 100644
--- a/vendor/ssb-marked.js
+++ b/vendor/ssb-marked.js
@@ -510,6 +510,20 @@ inline.pedantic = merge({}, inline.normal, {
* GFM Inline Grammar
*/
+var urlPrefix = '(?:' + [
+ 'dat://',
+ 'finger://',
+ 'ftp://',
+ 'gemini://',
+ 'gopher://',
+ 'https?://',
+ 'hyper://',
+ 'ipfs://',
+ 'ipns://',
+ 'magnet:\\?',
+ 'ssb:',
+].join('|') + ')';
+
inline.gfm = merge({}, inline.normal, {
escape: replace(inline.escape)('])', '~|])')(),
url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
@@ -521,6 +535,9 @@ inline.gfm = merge({}, inline.normal, {
()
});
+inline.gfm.url = replace(inline.gfm.url)('https?:\\/\\/', urlPrefix)()
+inline.gfm.text = replace(inline.gfm.text)('https?:\\/\\/', urlPrefix)()
+
/**
* GFM + Line Breaks Inline Grammar
*/