-
I had tried in the past to display mermaid diagrams using superfences and usage of mermaid.js. Today I have updated to version 8.2.1 and setup mermaid support as explained on the documentation. Maybe is related to the colors of the theme (see below): But on the materials for mkdocs documentation page, it is a much lighter color. Does someone know what is the color that the background of the diagrams uses? But the main problem is that when rendered on a Azure Static Web App where it is published, the background is fully black. Has someone an idea what could be the problem. I had it too. But I thought it would disappear once the functionality would be released. Many thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Update. Locally it works (very will for light theme, keeping black font in grey areas of subgraphs. Still on the web (Azure SWA) it is rendered fully black. But if I download the site generated by the pipeline before publishing it to the web, Does someone an idea if it could be related to the theme colors used? Many thanks. |
Beta Was this translation helpful? Give feedback.
-
I found the colors used for the rendering diagrams. Not a big surprise. I can change the colors and control de behaviour of light and dark modes. They look on the local server as I want in line with the rest of colors. But on the moment that I upload the rendered webpage to the Azure SWA the mermaid diagrams are fully black (background and border). The new colors, work on the links and hovering a side menu entry. Therefore they work. The colors are correctly updated. Just the Mermaid diagrams are black. I am really going into the direction of being a problem of SWA. But I cannot imagine how can it interfere. Unless it is a kind of "block" or "proxy" or "interference" (or whatsoever) with the mermaid.js function. Is there a way to have the mermaid.js locally with this integrated solution? Thanks to all (if you until read here) and specially Martin for the great product and the time he dedicates to all questions. |
Beta Was this translation helpful? Give feedback.
-
Thanks Martin. I tried locally and the problem is the same. Finally I have found the problem. I found this error below on the page rendered on Azure SWA.
This means I have to change something on the "content security policy" on the json settings file. I had this: I have added 'unsafe-inline' to the style-src to have: And it works. But because it was not clear to me if it was too risky to use 'unsafe-inline', even if only for "style-src" I have also tried the option of the hash. But did not managed to make it work. I still do not understand why the local file was not working. But ok. The site is only accessible for users that authenticate on the AAD of the company. I think this reduces the risk. I would be interested what is the setup of others regarding the content security policy when using mermaid to understand if I am doing something wrong. Many thanks. |
Beta Was this translation helpful? Give feedback.
Thanks Martin.
I tried locally and the problem is the same.
Finally I have found the problem. I found this error below on the page rendered on Azure SWA.
This means I have to change something on the "content security policy" on the json settings file. I had this:
"content-security-policy": "object-src 'self' data; style-src 'self'"
I have added 'unsafe-inline' to the style-s…