[blog][bug] fix parseMarkdown skipping paragraphs with html tags

This commit is contained in:
Andrea 2021-12-26 13:43:45 +01:00
parent 471e3b486f
commit a82c456d4e
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,8 @@ export default async function parseMarkdown(markdown) {
const imgMatch = content.match('<img src="([^"]+)"[^>]*>');
const img = imgMatch ? imgMatch[1] : null;
let intro = [];
for (let introMatch of content.matchAll('<p[^>]*>([^<]+)</p>')) {
for (let introMatch of content.matchAll(/<p[^>]*>(.+?)<\/p>/gms)) {
const p = introMatch[1].replace(/(<([^>]+)>)/ig, '').replace(/\s+/g, ' ');
intro = [...intro, ...p.split(' ')];
}