Mermaid & Bookstack #4938

Closed
opened 2026-02-05 09:27:37 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @ishaulov on GitHub (Sep 6, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hi. My friends want to use Mermaid in Bookstack to work with diagrams. I found this solution here, but for some reason it doesn't work: https://github.com/BookStackApp/BookStack/issues/566#issuecomment-2009445049

I use this script.

There are no errors in /var/www/bookstack/storage/logs/laravel.log and /var/www/log/apache2/, there is access from Bookstack server to mjs-file.

The browser Console is empty.

Can you please help me, what else can I check?

image

image

In the my browser:
image

Exact BookStack Version

v24.05.1

Log Content

No response

Hosting Environment

Ubuntu 22.04.4 LTS

PHP 8.1.2-1ubuntu2.18 (cli) (built: Jun 14 2024 15:52:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.18, Copyright (c), by Zend Technologies

Originally created by @ishaulov on GitHub (Sep 6, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hi. My friends want to use Mermaid in Bookstack to work with diagrams. I found this solution here, but for some reason it doesn't work: https://github.com/BookStackApp/BookStack/issues/566#issuecomment-2009445049 I use this [script](https://mermaid.js.org/config/usage.html#installing-and-hosting-mermaid-on-a-webpage). There are no errors in `/var/www/bookstack/storage/logs/laravel.log` and `/var/www/log/apache2/`, there is access from Bookstack server to [mjs-file](https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs). The browser Console is empty. Can you please help me, what else can I check? ![image](https://github.com/user-attachments/assets/6f79ff52-c811-4b07-9913-1573e41f6acb) ![image](https://github.com/user-attachments/assets/d01dca21-1465-4f95-825e-342ba4aed8cf) In the my browser: ![image](https://github.com/user-attachments/assets/16affdd2-067f-4c78-a9a7-fcf5316f933d) ### Exact BookStack Version v24.05.1 ### Log Content _No response_ ### Hosting Environment Ubuntu 22.04.4 LTS PHP 8.1.2-1ubuntu2.18 (cli) (built: Jun 14 2024 15:52:55) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2-1ubuntu2.18, Copyright (c), by Zend Technologies
OVERLORD added the 🐕 Support label 2026-02-05 09:27:37 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 7, 2024):

Hi @ishaulov,
Mermaid, and this customization, isn't officially supported at all so support may be limited and/or I may soon close this off.

It'd be worth checking the browser developer tools console log for errors, since this code is running all in-browser.
Also, how are you adding the mermaid code into the page? Looks like it needs to be tagged in a specific way using a class.

@ssddanbrown commented on GitHub (Sep 7, 2024): Hi @ishaulov, Mermaid, and this customization, isn't officially supported at all so support may be limited and/or I may soon close this off. It'd be worth checking the browser developer tools console log for errors, since this code is running all in-browser. Also, how are you adding the mermaid code into the page? Looks like it needs to be tagged in a specific way using a class.
Author
Owner

@ishaulov commented on GitHub (Sep 7, 2024):

@ssddanbrown thanks for reply!

Oh, I check the browser developer tools console log, and many other tools.

Code into the page:
image

Browser console:
image

Source:
image

@ishaulov commented on GitHub (Sep 7, 2024): @ssddanbrown thanks for reply! Oh, I check the browser developer tools console log, and many other tools. Code into the page: ![image](https://github.com/user-attachments/assets/dff068ad-dec1-4f6b-8f8f-e7b42aec9efb) Browser console: ![image](https://github.com/user-attachments/assets/5e5af781-9c77-42bf-88db-64d0a37a425e) Source: ![image](https://github.com/user-attachments/assets/872163c4-a5c9-49cf-b2a9-ab89b55320fa)
Author
Owner

@ishaulov commented on GitHub (Sep 9, 2024):

@ssddanbrown Hi!

I use div and the mermaid is working! 😃

image

image

@ishaulov commented on GitHub (Sep 9, 2024): @ssddanbrown Hi! I use div and the mermaid is working! 😃 ![image](https://github.com/user-attachments/assets/cc567beb-a842-4a5a-b4ed-58daa29e59ec) ![image](https://github.com/user-attachments/assets/fdb51237-6542-4b7f-812a-3cfb63841c27)
Author
Owner

@mewejo commented on GitHub (Sep 20, 2024):

How are you putting HTML into the book without BookStack escaping it @ishaulov ? I've tried WYSIWYG, both markdown editors and div/pre tags.

Only way I can get it to render is edit the book directly in the DB.

@mewejo commented on GitHub (Sep 20, 2024): How are you putting HTML into the book without BookStack escaping it @ishaulov ? I've tried WYSIWYG, both markdown editors and div/pre tags. Only way I can get it to render is edit the book directly in the DB.
Author
Owner

@ishaulov commented on GitHub (Sep 20, 2024):

@mewejo Hi! I use markdown editor:

For example:
image

image

@ishaulov commented on GitHub (Sep 20, 2024): @mewejo Hi! I use markdown editor: For example: ![image](https://github.com/user-attachments/assets/423ae8bc-f92e-4b76-9a32-86f1047c4a86) ![image](https://github.com/user-attachments/assets/90a37076-88d9-4f9c-bfd0-8d8fb51489e3)
Author
Owner

@AidasK commented on GitHub (May 22, 2025):

This does not work on more complex mermaid diagrams as they might involve custom markdown syntax which forces makrdown to include custom html. Would love to see some other solution which would allow us to extend CommonMark editor.

@AidasK commented on GitHub (May 22, 2025): This does not work on more complex mermaid diagrams as they might involve custom markdown syntax which forces makrdown to include custom html. Would love to see some other solution which would allow us to extend CommonMark editor.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4938