Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config does not work with docusaurus #67

Closed
layershifter opened this issue Sep 26, 2022 · 2 comments
Closed

Config does not work with docusaurus #67

layershifter opened this issue Sep 26, 2022 · 2 comments

Comments

@layershifter
Copy link

Version

1.3.2

Describe the bug

The issue started as "dark theme does not work".

To Reproduce

  1. Open https://stackblitz.com/edit/github-pwuwsv-hvqsdq
  2. Open "Tutorial" page that uses mermaid
  3. See a graph.

Expected behavior

image

Uses dark theme.

Actual behavior

image

Uses light theme.

Additional context

I debugged it a bit and it seems that configSrc there is always undefined:

const config: Config = useMemo(() => typeof configSrc === 'string' ? JSON.parse(configSrc) : configSrc, [configSrc])

image

This does not seem correct, so in microsoft/griffel#217 I monkey patched it and then it worked, but this does not seem like a proper solution.

Please let me know if it's a setup problem, but in sandbox (https://stackblitz.com/edit/github-pwuwsv-hvqsdq) I have a config exactly like in docs.

@JPeer264
Copy link

Hey I am facing the same issue, according to the patch you attached it seems that the config is always undefined, thus it will never enter the initialize where the dark theme is attached here.

A quickfix for your (or in general every setup) could be to have following in the docusaurus config [mdxMermaid.default, {}] (as seen here: https://stackblitz.com/edit/github-pwuwsv-kx6yjx?file=docusaurus.config.js).

But to fix the actual problem is to have either a default for the config or allow empty configs here in the useEffect as well. If @sjwall agrees in initializing mermaid without config then I can add a PR

@slorber
Copy link

slorber commented Oct 14, 2022

FYI official Docusaurus support is coming with facebook/docusaurus#7490 (with proper dark theme support)

@sjwall sjwall closed this as completed Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants