Skip to content

Commit

Permalink
Add scale factor option (#72)
Browse files Browse the repository at this point in the history
mermaid-cli includes a scale factor (`-s`) option.
Allow to configure it with `scale` option or `MERMAID_FILTER_SCALE`
environment variable.

Co-authored-by: Raghu <raghur@users.noreply.github.com>
  • Loading branch information
garf1242 and raghur authored Mar 27, 2022
1 parent 035cb39 commit 7489100
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function mermaid(type, value, format, meta) {
background: process.env.MERMAID_FILTER_BACKROUND || 'white',
caption: process.env.MERMAID_FILTER_CAPTION || '',
filename: process.env.MERMAID_FILTER_FILENAME || '',
scale: process.env.MERMAID_FILTER_SCALE || 1,
imageClass: process.env.MERMAID_FILTER_IMAGE_CLASS || ''
};
var configFile = path.join(folder, ".mermaid-config.json")
Expand Down Expand Up @@ -78,7 +79,7 @@ function mermaid(type, value, format, meta) {

var savePath = tmpfileObj.name + "." + options.format
var newPath = path.join(outdir, `${options.filename}.${options.format}`);
var fullCmd = `${cmd} ${confFileOpts} ${puppeteerOpts} -w ${options.width} -f -i ${tmpfileObj.name} -t ${options.theme} -b ${options.background} -o ${savePath}`
var fullCmd = `${cmd} ${confFileOpts} ${puppeteerOpts} -w ${options.width} -s ${options.scale} -f -i ${tmpfileObj.name} -t ${options.theme} -b ${options.background} -o ${savePath}`
// console.log(fullCmd, savePath)
exec(fullCmd);
//console.log(oldPath, newPath);
Expand Down

0 comments on commit 7489100

Please sign in to comment.