Fixed the issue that theme-switch does not work on docs.

This commit is contained in:
MrCoder 2022-12-03 19:10:05 +11:00
parent abc6ee049d
commit c7471f1755
1 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,9 @@ try {
}
export const render = async (id: string, code: string, config: MermaidConfig): Promise<string> => {
mermaid.initialize(config);
// make a clone of config, so we don't mutate the original
const mermaidConfig = { ...config };
mermaid.initialize(mermaidConfig);
const svg = await mermaid.renderAsync(id, code);
return svg;
};