renanlecaro / mermaid-gdocs

Mermaidsjs wrapper for gdocs.
https://mermaid-gdocs.lecaro.me/
86 stars 14 forks source link

Add support for "rect" (Upgrade to Mermaid 8.4.0) #2

Closed ericwastaken closed 4 years ago

ericwastaken commented 4 years ago

First, thank you so much for writing this. I love mermaid and am beyond excited to see your add-on support these right inside google docs.

In any case, on my initial testing, I noticed the following diagram throws an error in the editor:

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you?
    alt is sick
        Bob->>Alice: Not so good :(
    else is well
        Bob->>Alice: Feeling fresh like a daisy
    end
    rect rgb(216, 241, 251)
      opt Extra response
        Bob->>Alice: Thanks for asking
      end
    end

Whereas, if you remove the rect block, it works fine:

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you?
    alt is sick
        Bob->>Alice: Not so good :(
    else is well
        Bob->>Alice: Feeling fresh like a daisy
    end
    opt Extra response
        Bob->>Alice: Thanks for asking
    end

Background Highlighting (rect) I believe is a recent addition to the Mermaid sequence diagram specification.

See https://mermaidjs.github.io/#/sequenceDiagram?id=background-highlighting

PR #3 addresses the issue here as well as a few other minor changes.

renanlecaro commented 4 years ago

I merged your PR and the first block of code now works, thanks for the help

ericwastaken commented 4 years ago

I can confirm that rect now works in the 8.4.0 release. Thanks!