Coder Social home page Coder Social logo

remark-bookmarks's Introduction

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.

Related

  • remark-inline-links — Transform references and definitions into normal links and images
  • remark-defsplit — Transform links and images into references and definitions with URI-based identifiers
  • remark-reference-links — Transform links and images into references and definitions
  • remark-unlink — Remove all links, references and definitions

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

remark-bookmarks's People

Contributors

ben-eb avatar murderlon avatar nd0ut avatar wooorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.