remark-basepath
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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)

Readme

Keywords

Package Sidebar

Install

npm i remark-basepath

Weekly Downloads

8

Version

1.0.1

License

MIT

Unpacked Size

6.44 kB

Total Files

8

Last publish

Collaborators

  • kameikazuto