Skip to content

Commit

Permalink
mermaid fenced metadata in structured field values format (fixes Merm…
Browse files Browse the repository at this point in the history
  • Loading branch information
vstirbu committed Mar 11, 2021
1 parent 8b104b9 commit d7eb58c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.6.0 / 2020-03-11

- support for mermaid metadata in [structured field values](https://www.rfc-editor.org/rfc/rfc8941.html) format
- upgraded mermaid version `8.9.1`

## 1.5.7 / 2020-11-16

- upgraded mermaid version `8.8.3`
Expand Down
4 changes: 2 additions & 2 deletions lib/find-diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ function findDiagram(text, cursor) {
const re = {
html: /<div class="mermaid">([\s\S]*?)<\/div>/g,
hugo: /\{\{<mermaid.*>\}\}([\s\S]*?)\{\{<\/mermaid>\}\}/g,
markdown: /```mermaid([\s\S]*?)```/g,
markdown: /```mermaid[= ,;\(\)\?"\w]*$([\s\S]*?)```/gm,
// the whitespace between ::: and mermaid is for Azure DevOps Wiki
vsts: /::: ?mermaid([\s\S]*?):::/g,
sphinx: /\.\. mermaid::(?:[ \t]*)?$(?:(?:\n[ \t]+:(?:(?:\\:\s)|[^:])+:[^\n]*$)+\n)?((?:\n(?:[ \t][^\n]*)?$)+)?/gm
sphinx: /\.\. mermaid::(?:[ \t]*)?$(?:(?:\n[ \t]+:(?:(?:\\:\s)|[^:])+:[^\n]*$)+\n)?((?:\n(?:[ \t][^\n]*)?$)+)?/gm,
};

return (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Mermaid Preview",
"description": "Previews Mermaid diagrams in Visual Studio Code",
"license": "MIT",
"version": "1.5.7",
"version": "1.6.0",
"publisher": "vstirbu",
"bugs": {
"url": "https://github.com/vstirbu/vscode-mermaid-preview/issues"
Expand Down
2 changes: 1 addition & 1 deletion previewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
"mermaid": "^8.8.3",
"mermaid": "^8.9.1",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/classdiagram-two.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ classDiagram
Class1 <|-- Class2
```

```mermaid
```mermaid test="value"
classDiagram
Class4 <|-- Class3
Expand Down

0 comments on commit d7eb58c

Please sign in to comment.