@jarenjs/mermaid 0.86.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/to-mermaid.js +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jarenjs/mermaid",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.89.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./dist/types/index.d.ts",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"prepack": "npm run build:types"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@jarenjs/charts": "^0.
|
|
81
|
-
"@jarenjs/core": "^0.
|
|
82
|
-
"@jarenjs/view": "^0.
|
|
80
|
+
"@jarenjs/charts": "^0.89.0",
|
|
81
|
+
"@jarenjs/core": "^0.89.0",
|
|
82
|
+
"@jarenjs/view": "^0.89.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/to-mermaid.js
CHANGED
|
@@ -61,8 +61,8 @@ export function toMermaid(docOrAst) {
|
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region flowchart -------------------------------------------------
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
const RE_NEEDS_QUOTE = /[[\](){}<>|"]/;
|
|
64
|
+
/** Protect delimiters and literal quotes without removing label text. */
|
|
65
|
+
const RE_NEEDS_QUOTE = /[[\](){}<>|"';]/;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @param {any} ast
|
|
@@ -121,7 +121,8 @@ function wrapShape(shape, label) {
|
|
|
121
121
|
// end the statement. Emitting the tag back is what makes a transformed
|
|
122
122
|
// diagram round-trip to source that still parses.
|
|
123
123
|
const text = label.replace(/\n/g, '<br/>');
|
|
124
|
-
const
|
|
124
|
+
const quote = text.includes('"') && !text.includes("'") ? "'" : '"';
|
|
125
|
+
const l = RE_NEEDS_QUOTE.test(text) ? quote + text + quote : text;
|
|
125
126
|
switch (shape) {
|
|
126
127
|
case 'round': return `(${l})`;
|
|
127
128
|
case 'stadium': return `([${l}])`;
|