1.0.0 • Published 8 years ago

rewrite-markdown-urls v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

rewrite-markdown-urls

Make links work both in GitHub README files and on static sites.

npm travis standard conduct

About

This module turns relative links used in GitHub markdown files into links that will work when that markdown is turned into a static site.

Install

npm install --save rewrite-markdown-urls

Usage

This example uses the folder-reader and obj-keypath modules along with rewrite-markdown-urls:

var path = require('path')
var reader = require('folder-reader')
var ok = require('obj-keypath')
var rewrite = require('rewrite-markdown-urls')

var docsDir = path.join(__dirname, 'docs')

var options = {
  map: function (data, cb) {
    data.file = rewrite(data.file, data)
    cb(data)
  }
}

var contents = {}
var stream = reader(docsDir, options)

stream.on('data', function (data) {
  ok.set(contents, data.relname.split('/'), data.file)
})

stream.on('end', function () {
  console.log(contents)
})

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

It is important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct

Contact

  • issues – Please open issues in the issues queue
  • email – Need in-depth support via paid contract? Send an email to sethvincent@gmail.com

License

ISC