@@ -4,6 +4,7 @@ import { Notice, TFile } from 'obsidian';
44import { convertToBase64 } from './convertImage' ;
55import { join , normalize } from 'path' ;
66import fixPath from 'fix-path' ;
7+ import { getEngine } from './engine' ;
78
89const imgPathReg = / ! \[ [ ^ \] ] * \] \( ( [ ^ ) ] + ) \) / g;
910
@@ -21,6 +22,7 @@ export async function exportSlide(
2122 if ( ! file ) return ;
2223 const filePath = normalize ( join ( basePath , file . path ) ) ;
2324 const tmpPath = join ( exportDir , `${ file . basename } .tmp` ) ;
25+ const tmpEnginePath = join ( exportDir , 'engine.js' ) ;
2426
2527 let fileContent = await readFile ( filePath , 'utf-8' ) ;
2628
@@ -43,6 +45,7 @@ export async function exportSlide(
4345 await mkdir ( exportDir , { recursive : true } ) ;
4446 try {
4547 await writeFile ( tmpPath , fileContent ) ;
48+ await writeFile ( tmpEnginePath , getEngine ( ) ) ;
4649 } catch ( e ) {
4750 console . error ( e ) ;
4851 }
@@ -53,18 +56,19 @@ export async function exportSlide(
5356 cmd = `npx -y @marp-team/marp-cli@latest --bespoke.transition --stdin false --allow-local-files --theme-set "${ themeDir } " -o "${ join (
5457 exportDir ,
5558 file . basename ,
56- ) } .${ ext } " -- "${ tmpPath } "`;
59+ ) } .${ ext } " --engine ${ tmpEnginePath } -- "${ tmpPath } "`;
5760 } catch ( e ) {
5861 cmd = `npx -y @marp-team/marp-cli@latest --stdin false --allow-local-files --bespoke.transition -o "${ join (
5962 exportDir ,
6063 file . basename ,
61- ) } .${ ext } " -- "${ tmpPath } "`;
64+ ) } .${ ext } " --engine ${ tmpEnginePath } -- "${ tmpPath } "`;
6265 }
6366
6467 fixPath ( ) ;
6568 new Notice ( `Exporting "${ file . basename } .${ ext } " to "${ exportDir } "` , 20000 ) ;
6669 exec ( cmd , ( ) => {
6770 new Notice ( 'Exported successfully' , 20000 ) ;
6871 rm ( tmpPath ) ;
72+ rm ( tmpEnginePath ) ;
6973 } ) ;
7074}
0 commit comments