remark-bookmarks

remark plugin to manage links

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
remark-bookmarks
3.0.04 years ago7 years agoMinified + gzip package size for remark-bookmarks in KB

Readme

remark-bookmarks
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
remarkremark plugin to manage links.

Install

npm install remark-bookmarks
## Use

Say we have the following file, `example.md`:

```markdown
`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][]!

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)xss attack if you pass user provided content as bookmarks.
This may become a problem if the Markdown later transformed to rehyperehype (hasthast) or opened in an unsafe Markdown viewer.

Related

— Transform references and definitions into normal links and images
— Transform links and images into references and definitions with
URI-based identifiers
— Transform links and images into references and definitions
— Remove all links, references and definitions

Contribute

See contributing.mdcontributing in remarkjs/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MITlicense © Ben Briggsauthor