123456789101112131415161718192021 |
- /*
- * @Author: your name
- * @Date: 2021-08-24 11:48:53
- * @LastEditTime: 2021-08-24 14:17:57
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: \md-\test\markdownParseImage.js
- */
- let imageReg = /^\!\[\S+\]\(\S+\)/mg
- let testMdText = `
- # docsify使用图片
- 
- 
- 
- `
- let dom = testMdText.match(imageReg).reduce((acc,current)=>{
- return acc += current.replace(/^\!\[/,`<img src="`)
- .replace(/\]\(/,`" title="`)
- .replace(/\)/,`"></img>\n`)
- },'')
- console.log(dom)
|