@mermaid-js/mermaid-cli 8.13.6 → 8.14.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/README.md CHANGED
@@ -95,7 +95,7 @@ docker run -it -v /path/to/diagrams:/data minlag/mermaid-cli -i /data/diagram.mm
95
95
 
96
96
  ## Install locally
97
97
 
98
- Some people are [having issue](https://github.com/mermaidjs/mermaid.cli/issues/15)
98
+ Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15)
99
99
  installing this tool globally. Installing it locally is an alternative solution:
100
100
 
101
101
  ```
package/index.bundle.js CHANGED
@@ -26,6 +26,10 @@ const error = message => {
26
26
  process.exit(1);
27
27
  };
28
28
 
29
+ const warn = message => {
30
+ console.log(_chalk.default.yellow(`\n${message}\n`));
31
+ };
32
+
29
33
  const checkConfigFile = file => {
30
34
  if (!_fs.default.existsSync(file)) {
31
35
  error(`Configuration file "${file}" doesn't exist`);
@@ -212,7 +216,19 @@ const parseMMD = /*#__PURE__*/function () {
212
216
  }
213
217
 
214
218
  if (output.endsWith('svg')) {
215
- const svg = yield page.$eval('#container', container => container.innerHTML);
219
+ const svg = yield page.$eval('#container', (container, backgroundColor) => {
220
+ var _container$getElement, _container$getElement2;
221
+
222
+ const svg = (_container$getElement = container.getElementsByTagName) === null || _container$getElement === void 0 ? void 0 : (_container$getElement2 = _container$getElement.call(container, 'svg')) === null || _container$getElement2 === void 0 ? void 0 : _container$getElement2[0];
223
+
224
+ if (svg.style) {
225
+ svg.style.backgroundColor = backgroundColor;
226
+ } else {
227
+ warn("svg not found. Not applying background color.");
228
+ }
229
+
230
+ return container.innerHTML;
231
+ }, backgroundColor);
216
232
  const svg_xml = convertToValidXML(svg);
217
233
 
218
234
  _fs.default.writeFileSync(output, svg_xml);