@@ -183,6 +183,19 @@ export async function transformMdast(
183183 // This needs to come before basic transformations since it may add labels to blocks
184184 liftCodeMetadataToBlock ( session , vfile , mdast ) ;
185185
186+ if ( execute && ! frontmatter . skip_execution ) {
187+ const cachePath = path . join ( session . buildPath ( ) , 'execute' ) ;
188+ await kernelExecutionTransform ( mdast , vfile , {
189+ basePath : session . sourcePath ( ) ,
190+ cache : new LocalDiskCache < ( IExpressionResult | IOutput [ ] ) [ ] > ( cachePath ) ,
191+ sessionFactory : ( ) => session . jupyterSessionManager ( ) ,
192+ frontmatter : frontmatter ,
193+ ignoreCache : false ,
194+ errorIsFatal : false ,
195+ log : session . log ,
196+ } ) ;
197+ }
198+
186199 const pipe = unified ( )
187200 . use ( reconstructHtmlPlugin ) // We need to group and link the HTML first
188201 . use ( htmlPlugin , { htmlHandlers } ) // Some of the HTML plugins need to operate on the transformed html, e.g. figure caption transforms
@@ -226,18 +239,6 @@ export async function transformMdast(
226239 // Combine file-specific citation renderers with project renderers from bib files
227240 const fileCitationRenderer = combineCitationRenderers ( cache , ...rendererFiles ) ;
228241
229- if ( execute && ! frontmatter . skip_execution ) {
230- const cachePath = path . join ( session . buildPath ( ) , 'execute' ) ;
231- await kernelExecutionTransform ( mdast , vfile , {
232- basePath : session . sourcePath ( ) ,
233- cache : new LocalDiskCache < ( IExpressionResult | IOutput [ ] ) [ ] > ( cachePath ) ,
234- sessionFactory : ( ) => session . jupyterSessionManager ( ) ,
235- frontmatter : frontmatter ,
236- ignoreCache : false ,
237- errorIsFatal : false ,
238- log : session . log ,
239- } ) ;
240- }
241242 transformRenderInlineExpressions ( mdast , vfile ) ;
242243 await transformOutputsToCache ( session , mdast , kind , { minifyMaxCharacters } ) ;
243244 liftOutputs ( session , mdast , vfile , {
0 commit comments