-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow Mermaid setup function to be async (#1741)
- Loading branch information
Showing
3 changed files
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import type { MermaidOptions } from '@slidev/types' | ||
import { defineMermaidSetup } from '@slidev/types' | ||
import type { MermaidConfig } from 'mermaid' | ||
import { createSingletonPromise } from '@antfu/utils' | ||
import setups from '#slidev/setups/mermaid' | ||
|
||
export default defineMermaidSetup(() => { | ||
const setupReturn: MermaidOptions = { | ||
export default createSingletonPromise(async () => { | ||
const setupReturn: MermaidConfig = { | ||
theme: 'default', | ||
} | ||
|
||
for (const setup of setups) | ||
Object.assign(setupReturn, setup()) | ||
Object.assign(setupReturn, await setup()) | ||
|
||
return setupReturn | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters