File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
packages/myst-transforms/src Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -80,17 +80,12 @@ export function blockMetadataTransform(mdast: GenericParent, file: VFile) {
8080 }
8181 }
8282 if ( block . identifier ) {
83- const codeChildren = selectAll ( 'code' , block ) as Code [ ] ;
84- codeChildren . forEach ( ( child , index ) => {
85- if ( child . identifier ) return ;
86- if ( codeChildren . length === 1 ) {
87- child . identifier = `${ block . identifier } -code` ;
88- } else {
89- child . identifier = `${ block . identifier } -code-${ index } ` ;
90- }
91- } ) ;
83+ const codeNode = selectAll ( 'code' , block ) as any as Code | null ;
84+ if ( codeNode !== null && ! codeNode . identifier ) {
85+ codeNode . identifier = `${ block . identifier } -code` ;
86+ }
9287 const outputsNode = select ( 'outputs' , block ) as GenericNode | undefined ;
93- if ( outputsNode && ! outputsNode . identifier ) {
88+ if ( outputsNode !== undefined && ! outputsNode . identifier ) {
9489 // Label outputs node
9590 outputsNode . identifier = `${ block . identifier } -output` ;
9691 // Enumerate outputs
You can’t perform that action at this time.
0 commit comments