unified

Project: remarkjs/remark-bookmarks

Package: remark-bookmarks@3.0.0

  1. Dependents: 0
  2. remark plugin to manage links
  1. remark 214
  2. unified 181
  3. markdown 154
  4. plugin 140
  5. mdast 88
  6. remark-plugin 82
  7. links 5

remark-bookmarks

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to manage links.

Archived

This project is now archived. A new parser in remark happened, which is 100% compliant to CommonMark. Which means the things this plugin used are no longer available. Rewriting this plugin would be a lot of work, and while it’s a fun idea, this plugin wasn’t used much, and hence I am instead archiving it.

Install

npm:

npm install remark-bookmarks

Use

Say we have the following file, example.md:

`remark-bookmarks` is on [npm][]!

And our script, example.js, looks as follows:

const vfile = require('to-vfile')
const remark = require('remark')
const bookmarks = require('remark-bookmarks')

remark()
  .use(bookmarks, {
    bookmarks: {
      github: 'https://github.com/remarkjs/remark-bookmarks',
      npm: 'https://npmjs.com/package/remark-bookmarks'
    }
  })
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

`remark-bookmarks` is on [npm][]!

[npm]: https://npmjs.com/package/remark-bookmarks

API

remark().use(bookmarks[, options])

Manage links.

options
options.bookmarks

The URLs to share across Markdown documents (Object.<string>). References are case insensitive.

options.overwrite

Pass overwrite: true to ensure that references are used consistently. By default (false), the existing references in the file will take precedence over anything defined globally.

Security

options.bookmarks is used and injected into the tree as definitions when the content references them. This could open you up to a cross-site scripting (XSS) attack if you pass user provided content as bookmarks.

This may become a problem if the Markdown later transformed to rehype (hast) or opened in an unsafe Markdown viewer.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Ben Briggs