Skip to content

Commit

Permalink
✨ better note block parse
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwind committed Jan 3, 2024
1 parent 9a584d6 commit 829ffab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/transform-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const transformMarkdown = (content: string, slug: string) =>
.replace(/<img(.*)\/>/, `<img$1 loading="lazy" />`)
// {% note %} 轉換
.replace(
/<p>{% note (.*?) %}<\/p>(.*?)<p>{% endnote %}<\/p>/gs,
/<p>\s*{% note (.*?) %}\s*<\/p>(.*?)<p>\s*{% endnote %}\s*<\/p>/gs,
(match, noteClass, content) => {
const newContent = content.trim().replace(/^\s+|\s+$/g, '');
return `</p><div class=\"note ${noteClass}\">${newContent}</div><p>`;
Expand Down

0 comments on commit 829ffab

Please sign in to comment.