Skip to content

gumpyyyy/rails-assets-markdown-it-lygneo-mention

Repository files navigation

markdown-it-lygneo-mention

Build Status Coverage Status npm version

lygneo-style @mention plugin for markdown-it markdown parser.

@{User Name; user@pod.tld} => <a href="/people/1337" class="mention">User Name</a>

Install

node.js, bower:

npm install markdown-it-lygneo-mention --save
bower install markdown-it-lygneo-mention --save

Use

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.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published