samwilson / diagrams-extension

A MediaWiki extension that displays GraphViz, Mscgen, PlantUML, and Mermaid diagrams in wiki pages.
https://www.mediawiki.org/wiki/Extension:Diagrams
GNU General Public License v2.0
8 stars 12 forks source link

ClassDef not working #97

Open keepersdungeon opened 4 months ago

keepersdungeon commented 4 months ago

Hello, I'm trying to use classDef for mermaid like it's on their site test page but it doesn't work on mediawik. It gives mermaid 9.1.1 error at the end of the page. Is it due that it's not the latest version of mermaid or am I missing some lib that I need to install. At the moment I just installed the extension and enabled it Thank u.

samwilson commented 4 months ago

I'm not sure what the issue might be, I'll have a look into it.

So a diagram like this should render a single box with a red background:

<mermaid>
stateDiagram
classDef red fill:#f00
Test
class Test red
</mermaid>

Like this

Screenshot 2024-05-24 at 08-07-11 Online FlowChart   Diagrams Editor - Mermaid Live Editor

Rather than this (as Diagrams current renders it):

Screenshot 2024-05-24 at 08-05-57 Mermaid - Dev wiki1

samwilson commented 4 months ago

It gives mermaid 9.1.1 error at the end of the page.

What is the error?

keepersdungeon commented 4 months ago

I got the error when I use this for example

<mermaid>
   stateDiagram
   direction TB

   classDef notMoving fill:white
   classDef movement font-style:italic
   classDef badBadEvent fill:#f00,color:white,font-weight:bold,stroke-width:2px,stroke:yellow

   [*]--> Still
   Still --> [*]
   Still --> Moving
   Moving --> Still
   Moving --> Crash
   Crash --> [*]

   class Still notMoving
   class Moving, Crash movement
   class Crash badBadEvent
   class end badBadEvent
</mermaid>