Mermaid built in icons do not lead #7723
Replies: 5 comments
-
You may want to check out this thread: facelessuser/pymdown-extensions#2499 |
Beta Was this translation helpful? Give feedback.
-
@facelessuser I actually checked it, but I cannot reproduce that example for sure, I have checked your most up to date code too. |
Beta Was this translation helpful? Give feedback.
-
@alfredopalhares The main point of the conversation highlights two things. The first is that you need to register the icons with a name. mermaid.registerIconPacks([
{
name: "simple-icons",
loader: () =>
fetch("https://unpkg.com/@iconify-json/logos/icons.json").then(res =>
res.json()
)
}
]) And when you reference them, you need to use the same name you referenced them with:
|
Beta Was this translation helpful? Give feedback.
-
Converting to discussion - this is not officially supported. |
Beta Was this translation helpful? Give feedback.
-
Yes, I got that, but the part i am probably failing is the actually function, because on this example: import mermaid from "mermaid";
mermaid.registerIconPacks([
{
name: "logos",
loader: () =>
fetch("https://unpkg.com/@iconify-json/logos/icons.json")
.then((res) => {
if (!res.ok) throw new Error("Failed to fetch icons");
return res.json();
})
.then((icons) => {
console.log("Icons loaded:", icons);
return icons;
})
.catch((err) => console.error("Error loading icons:", err)),
},
]);
// Initialize Mermaid
mermaid.initialize({
startOnLoad: true,
theme: "default", // or "dark", "neutral"
securityLevel: "loose", // Needed for inline HTML in Mermaid
}); The code inside the function never gets printed on the browser console. |
Beta Was this translation helpful? Give feedback.
-
Context
Hello, first of all thank you so much for working on this project, it has provided me the best way to quickly deploy documentation that actually gets maintained and updated.
I am trying to use the architecture-diagrams, but whenever I try to use icons from iconify.design as described on the doc.
In have tried to load the icons myself by adding this to
docs/src/js/register-mermaid-icons.js
:And load it from
mkdocs.yml
:The codes does run, by mermad.registerIconPacks never runs.. what am I doing wrong ?
Related links
-https://mermaid.js.org/syntax/architecture.html
Reproduction
9.5.44-mermaid-icons.zip
Steps to reproduce
Build the reproduction sample or use the diagram and js provided on the bu
Browser
No response
Before submitting
Beta Was this translation helpful? Give feedback.
All reactions