Skip to content

Commit edd4af2

Browse files
committed
fix: make img tag self-closing pattern optional
1 parent 2adb755 commit edd4af2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/services/mkd-img-extractor.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export interface ImageInfo {
2727
// Related RFC:
2828
// https://datatracker.ietf.org/doc/html/rfc2397
2929

30-
const imgTagDataUrlImgPat = /(<img.*?src\s*=\s*")(data:image\/.*?,[a-zA-Z0-9+/]*?=?=?)("[^/]*?\/>)/g
31-
const imgTagUrlImgPat = /(<img.*?src\s*=\s*")(.*\.(?:png|jpg|jpeg|webp|svg|gif))("[^/]*?\/>)/gi
30+
const imgTagDataUrlImgPat = /(<img.*?src\s*=\s*")(data:image\/.*?,[a-zA-Z0-9+/]*?=?=?)("[^/]*?\/?>)/g
31+
const imgTagUrlImgPat = /(<img.*?src\s*=\s*")(.*\.(?:png|jpg|jpeg|webp|svg|gif))("[^/]*?\/?>)/gi
3232
const mkdDataUrlImgPat = /(!\[.*?\]\()(data:image\/.*?,[a-zA-Z0-9+/]*?=?=?)(\))/g
3333
const mkdUrlImgPat = /(!\[.*?\]\()(.*?\.(?:png|jpg|jpeg|webp|svg|gif))(\))/gi
3434

0 commit comments

Comments
 (0)