Hey @usasacm, could it be an issue with the URL in <script src="/static/mermaid.esm.min.mjs"></script>? I believe in order to for this to work when hosted via Streamlit, you would need to place that file in Streamlit’s static folder wherever Streamlit is installed. This command should provide the path where you have to copy the file: python -c "import streamlit as st; print(f'{st.__path__[0]}/static/static/')"
If mermaid loads more assets, they have to be placed accordingly.
Note that when you install a new version of Streamlit or do changes to your Python environment, you would need to place the assets again accordingly.
@usasacm for me it works with a test file! A wrong content type hints towards the fact that the file is not found correctly. For the src path you have provided, the file has to be stored under <streamlit_package_path>/static/app/static/mermaid.js
@usasacm Yeah I think that’s the wrong path. You have put it in the folder where your app script is stored, but you have to put it into the folder where the Streamlit library is stored. This is what I meant with
This command should provide the path where you have to copy the file: python -c "import streamlit as st; print(f'{st.__path__[0]}/static/static/')"
@usasacm what’s the output of the command for you? If it points you to the .static folder then you might need to put it there.
For me, the output is for example ~/debug/venv/lib/python3.12/site-packages/streamlit/static/static/ which is where Python packages are installed for me.
@raethlein , Good day/
This manual says that only pictures can be stored in the ./static/ folder, other extensions receive content-type = plain text. And other types of files must be hosted outside the application.
So my question is where should third party javascript libraries like jquery etc be stored.
I apologize for my stupidity
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.