-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Customize mermaid module #362
Conversation
@matalo33 what do you think? :) |
@mirisbowring Sorry for not getting to this yet. I've been doing the 'easy' PRs and issues while on the road, I wanted to have a full read of your PR at a desk before merging. |
@matalo33 |
Hi @mirisbowring! Not annoying at all, my apologies for taking so long. I gave this a quick test & found a small issue. For the test I set
When disableMermaid is true in the site config but undefined in the page topmatter the condition is evaluated as true, and mermaid is loaded. Output from the above debug:
This means that for someone to disable mermaid across their whole site they would need to set the disable flag in the site config.toml and in the topmatter of every page. Is there a way for the site setting to become the sitewide setting unless overridden at the page level? By the way, love the feature idea! It's a design we can copy to many of the other included libraries in the theme. |
@matalo33 I fixed the issues you mentioned. If the user globally disabled mermaid and did not configure the frontmatter for the current page, the mermaid module is not being included on the current page. |
@matalo33 any progress on this? |
Ok I think this is almost there. Just two thoughts / questions:
|
Thanks for continuing on this PR.
|
@matalo33 I renamed the variable to customMermaidURL. The CSS Files are no longer referenced and over 2 Years old (so i deleted them). |
This is awesome. Thanks very much 🎉 |
The "alternate syntax" for mermaid (mermaid in code fences) was removed from the docs. Nevertheless, it's still working (only in Chrome, but this is a different topic- #410). So I can't see why it was removed. Is this now deprecated? I always thought it's an elegant way to write mermaid graphs. Some others have had the same feeling Gitlab, Markdown Monster, markdown-it extension |
It is not depracted exactly. But it was not rendered on Edge, IE, Firefox and Safari. The docs should be generic until the issue is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue when trying to detect mermaids URL
<script src="{{ .Params.mermaidurl }}"></script> | ||
{{ else if isset .Site.Params "mermaidurl" }} | ||
<script src="{{ .Site.Params.mermaidurl }}"></script> | ||
{{ if isset .Params "customMermaidURL" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the hugo documentation, this will not work, because the key needs to be lower case!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fixed? Just wondering whether I should patch this PR on my site or is it not stable yet?
`isset` key must be lower case SEE: matcornic#362 (comment)
This MR relates #361
Changes: