123456789101112131415161718192021 |
- /*
- * @Author: 你好
- * @Date: 2021-08-24 11:48:53
- * @LastEditTime: 2021-08-25 11:22:37
- * @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)
|