1.0.1 • Published 4 years ago

markdown-it-disable-url-encode v1.0.1

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

markdown-it-disable-url-encode

Forced decoding image src for non-ascii chars

Build Status Coverage Status GitHub repo size

Getting Started

npm install --save-dev markdown-it-disable-url-encode

Usage

  const md = require("markdown-it")();  
  md.use(require("markdown-it-disable-url-encode"), "./")
  // md.use(require("markdown-it-disable-url-encode"), "*")
  // md.use(require("markdown-it-disable-url-encode"), ".")
  // md.use(require("markdown-it-disable-url-encode"), [...])
  // md.use(require("markdown-it-disable-url-encode"), /.../)        


  const html = md.render("![image.png](图片/image.png)")
  // <p><img src="./图片/image.png" alt="image.png" /></p> 
 
  // without markdown-it-disable-url-encode plugin :
  // <p><img src="%E5%9B%BE%E7%89%87/image.png" alt="image.png" /></p>  

API

config rules: 0. undefined : use rule 1 1. "*" : all paths will be decode

  1. "." : relative paths only

  2. "./" : relative paths only , just like "."

  3. string : as string[] to apply rule 5

  4. string[] : will be apply [].some() as result for detect if it needs to be decoded

  5. REGEXP : will be apply /^/.test() as result for detect if it needs to be decoded