Skip to content

Commit 6717eba

Browse files
committed
Improve regex on callout
1 parent 8597ae3 commit 6717eba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/DocusaurusTweaks.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function notionEmbedsToMDX(input: string): {
9696
// In Notion, you can make a callout and change its emoji. We map 5 of these
9797
// to the 5 Docusaurus admonition styles.
9898
function notionCalloutsToAdmonitions(input: string): string {
99-
const notionCalloutPattern = />\s(||💡||🔥)\s(.*)\n/gmu;
99+
const notionCalloutPattern = />\s(||💡||🔥|.)\s(.*)\n/gmu;
100100
const calloutsToAdmonitions = {
101101
/* prettier-ignore */ "ℹ️": "note",
102102
"💡": "tip",
@@ -118,6 +118,12 @@ function notionCalloutsToAdmonitions(input: string): string {
118118
`:::${docusaurusAdmonition}\n\n${content}\n\n:::\n\n`
119119
);
120120
}
121+
// For Notion callouts with other emojis, pass them through using hte emoji as the name.
122+
// For this to work on a Docusaurus site, it will need to define that time on the remark-admonitions options in the docusaurus.config.js.
123+
// See https://github.com/elviswolcott/remark-admonitions and https://docusaurus.io/docs/using-plugins#using-presets.
124+
else {
125+
output = output.replace(string, `:::${emoji}\n\n${content}\n\n:::\n\n`);
126+
}
121127
}
122128

123129
return output;

0 commit comments

Comments
 (0)