diff --git a/src/components/article/article_body/ArticleBody.astro b/src/components/article/article_body/ArticleBody.astro index 93af240..be5e52b 100644 --- a/src/components/article/article_body/ArticleBody.astro +++ b/src/components/article/article_body/ArticleBody.astro @@ -9,10 +9,10 @@ const html = await Astro.slots.render("default"); // 3. If a line ends without [a-zA-Z] and its next line starts with [a-zA-Z], // add a heading space to the next line. // 4. If a line does not start in ASCII chars, join it to its previous line. -// 5. If a line starts with or , add a heading space to this -// line. -// 6. If a line ends with or , add a tailing space to this -// line. +// 5. If a line starts with or or , add a heading space to +// this line. +// 6. If a line ends with or or , add a tailing space to +// this line. // This is important in using one newline character to wrap Chinese. const arr = html.split("\n"); let articleHTMLFinal = arr[0]; @@ -47,11 +47,11 @@ for (let i = 1; i < arr.length; i++) { arr[i] += " "; } // rule 5 - if (arr[i].match(/^(|)/) !== null){ + if (arr[i].match(/^(||)/) !== null){ arr[i] = " " + arr[i]; } // rule 6 - if (arr[i].match(/(<\/em>|<\/strong>)$/) !== null){ + if (arr[i].match(/(<\/em>|<\/strong>|<\/a>)$/) !== null){ arr[i] = arr[i] + " "; } // -------- combine lines