aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorcel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-11-27 12:18:06 -0500
committercel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-11-27 12:18:06 -0500
commit567a75309f69d495ff55a1dc6b43a4774c69fe31 (patch)
tree44e8b9d7c8a4bd3350e541da60e6149d2a034d9c /vendor
parente6bb8bd53b7045b8bfcbeaa8936ab7a3ff1760e1 (diff)
downloadpatchfoo-567a75309f69d495ff55a1dc6b43a4774c69fe31.tar.gz
patchfoo-567a75309f69d495ff55a1dc6b43a4774c69fe31.zip
Add mentions for ssb URIs
Diffstat (limited to 'vendor')
-rw-r--r--vendor/ssb-mentions.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/ssb-mentions.js b/vendor/ssb-mentions.js
index b01bf9a..37e7678 100644
--- a/vendor/ssb-mentions.js
+++ b/vendor/ssb-mentions.js
@@ -2,6 +2,7 @@
ssb-mentions
Copyright (c) 2016 Dominic Tarr
+Copyright (c) 2020 Charles Lehner
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
@@ -27,6 +28,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var ref = require('ssb-ref')
var marked = require('./ssb-marked')
+var u = require('../lib/util')
function noop(){}
var onLink = noop
var extractor = new marked.Renderer()
@@ -91,6 +93,10 @@ module.exports = function (text, opts) {
var emoji = opts && opts.emoji
var a = []
links(text, function (link) {
+ if (link.target && typeof link.target === 'string'
+ && link.target.substr(0, 4) === 'ssb:') {
+ link.target = u.translateFromURI(link.target) || link.target
+ }
var result = link.target && ref.parseLink(link.target)
if (result) {
result.name = link.label && link.label.replace(/^@/, '')