File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/myst-cli/src/transforms Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,21 @@ async function renderMermaidToBase64(
5050 }
5151
5252 try {
53+ // Create puppeteer config file for CI environments
54+ // See https://github.com/mermaid-js/mermaid-cli/blob/master/docs/linux-sandbox-issue.md
55+ const useNoSandbox = process . env . MERMAID_NO_SANDBOX === 'true' || process . env . CI === 'true' ;
56+ let puppeteerConfigFlag = '' ;
57+
58+ if ( useNoSandbox ) {
59+ const puppeteerConfigPath = path . join ( tempFolder , 'puppeteer-config.json' ) ;
60+ const puppeteerConfig = { args : [ '--no-sandbox' ] } ;
61+ await fs . writeFile ( puppeteerConfigPath , JSON . stringify ( puppeteerConfig , null , 2 ) ) ;
62+ puppeteerConfigFlag = ` -p "${ puppeteerConfigPath } "` ;
63+ }
64+
5365 // Render using Mermaid CLI with stdin input
5466 await execAsync (
55- `echo '${ mermaidCode . replace ( / ' / g, "'\"'\"'" ) } ' | mmdc -i - -o "${ outputFile } " -t ${ theme } -b transparent` ,
67+ `echo '${ mermaidCode . replace ( / ' / g, "'\"'\"'" ) } ' | mmdc -i - -o "${ outputFile } " -t ${ theme } -b transparent${ puppeteerConfigFlag } ` ,
5668 ) ;
5769
5870 // Read the generated file
You can’t perform that action at this time.
0 commit comments