1.2.0 • Published 9 years ago

markdown-it-diaspora-mention v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

markdown-it-diaspora-mention

Build Status Coverage Status npm version

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

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

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

Install

node.js, bower:

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

Use

var md = require("markdown-it")()
            .use(require("markdown-it-diaspora-mention"), {
              mentions: [
                {
                  diaspora_id: "user@pod.tld",
                  guid: 1337,
                  name: "Alice Awesome"
                },
                {
                  handle: "foo@bar.baz",
                  url: "/my/awesome/url",
                  guid: 42,
                  name: "Foo Bar"
                }
              ],
              allowHovercards: true,
              currentUserId: 1337
            });

md.render("@{User Name; user@pod.tld}"); // => "@<a href='/people/1337' class='mention'>User Name</a>"
md.render("@{user@pod.tld}"); // => "@<a href='/people/1337' class='mention'>Alice Awesome</a>"
md.render("@{Foo Bar; foo@bar.baz}"); // => "@<a href='/my/awesome/url' class='mention hovercardable'>Foo Bar</a>"

Differences in the browser. If you load the script directly into the page, without a package system, the module will add itself globally as window.markdownitDiasporaMention.

License

MIT

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

10 years ago

0.4.0

10 years ago

0.3.0

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago