fix: ?<= not work at safari

pull/25/head
fantasticit 2022-04-01 15:02:43 +08:00
parent 159ed5f799
commit 4c071a5573
1 changed files with 3 additions and 3 deletions

View File

@ -18,9 +18,9 @@ export * from './markdown-source-map';
const extractImage = (html) => { const extractImage = (html) => {
let matches = []; let matches = [];
while ((matches = html.match(/(?<=\<p.*?\>)\<img(.|\s)*?\>(?=\<\/p\>)/g))) { while ((matches = html.match(/\<p.*?\>\<img(.|\s)*?\>\<\/p\>/g))) {
const source = html.match(/\<p.*?\>\<img(.|\s)*?\>\<\/p\>/g)[0]; const target = matches[0].match(/<img.*?>/)[0];
html = html.replace(source, matches[0]); html = html.replace(matches[0], target);
} }
return html; return html;