luisalvesmartins / Markdown-Mermaid-Expand-to-PNG

Expand your markdown mermaid tags to PNG and vice versa
MIT License
7 stars 0 forks source link

Request - Don't convert nested blocks #4

Open JFaulk1434 opened 1 year ago

JFaulk1434 commented 1 year ago

Request to skip nested code blocks

I was making a guide on mermaid in markdown and came across this extension which is amazing. But one thing I noticed is it also converts nested blocks. See examples below:

Will be converted:

```mermaid
sequenceDiagram
  Alice->>Bob: Hello Bob, how are you?
  Bob-->>John: How about you, John?
  John-->>Alice: I am good, thanks!

**Will also be converted but shouldn't:**

`````markdown
````markdown
```mermaid
sequenceDiagram
  Alice->>Bob: Hello Bob, how are you?
  Bob-->>John: How about you, John?
  John-->>Alice: I am good, thanks!

The reason for this is to show mermaid code in markdown along with an example of the rendered image. End result should look like this:

Screenshot 2023-08-22 at 11 38 17 AM
luisalvesmartins commented 1 year ago

Good catch. I'm not doing a parse of the text, I'm doing a "blind" search. As this can be an edge case I would propose to avoid having the mermaid declaration in all pictures. Otherwise, this is probably a lot of work and I will put this as "feature request" for a future version. I would be very happy if you want to contribute...