1.0.1 • Published 4 years ago

remark-basepath v1.0.1

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

remark-basepath

npm version npm download

remark plugin to convert the base path of image and link.

Install

# npm install remark-basepath
# or
yarn add remark-basepath

Use

This is example code.

const remark = require('remark')
const basepath = require('remark-basepath')

const markdown = `
## Image
![example image](./example.jpg)

## Link
[src](./src)
`

remark()
  .use(basepath, {
      basePath: 'https://github.com/kmkzt/remark-basepath/tree/master'
      baseImagePath: 'https://raw.githubusercontent.com/kmkzt/remark-basepath/master'
  })
  .process(markdown, (err, file) => {
    if (err) throw err
    console.log(String(file))
  })

// ## Image
// ![./aaa.jpg](https://raw.githubusercontent.com/kmkzt/remark-basepath/master/aaa.jpg)
// 
// ## Link
// [./bbb](https://github.com/kmkzt/remark-basepath/tree/master/bbb)