lygneo-style @mention plugin for markdown-it markdown parser.
@{User Name; user@pod.tld}
=> <a href="/people/1337" class="mention">User Name</a>
node.js, bower:
npm install markdown-it-lygneo-mention --save
bower install markdown-it-lygneo-mention --save
var md = require('markdown-it')()
.use(require('markdown-it-lygneo-mention'), {
mentions: [
{
lygneo_id: 'user@pod.tld',
guid: 1337
},
{
handle: 'foo@bar.baz',
url: '/my/awesome/url',
guid: 42
}
],
allowHovercards: true,
currentUserId: 1337
});
md.render('@{User Name; user@pod.tld}'); // => '<a href="/people/1337" class="mention">User Name</a>'
md.render('@{Foo Bar; foo@bar.baz}'); // => '<a href="/my/awesome/url" class="mention hovercardable">Foo Bar</a>'
Differences in browser. If you load the script directly into the page, without
package system, module will add itself globally as window.markdownitLygnoMention
.