@mermaid-js/mermaid-cli 8.13.5 → 8.13.10

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/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);
@@ -278,7 +294,7 @@ _asyncToGenerator(function* () {
278
294
 
279
295
  if (/\.md$/.test(input)) {
280
296
  const diagrams = [];
281
- const outDefinition = definition.replaceAll(mermaidChartsInMarkdownRegexGlobal, mermaidMd => {
297
+ const outDefinition = definition.replace(mermaidChartsInMarkdownRegexGlobal, mermaidMd => {
282
298
  const md = mermaidChartsInMarkdownRegex.exec(mermaidMd)[1]; // Output can be either a template image file, or a `.md` output file.
283
299
  // If it is a template image file, use that to created numbered diagrams
284
300
  // I.e. if "out.png", use "out-1.png", "out-2.png", etc