@@ -449,6 +449,7 @@ function processBlockChildrenWithSlots(
449449 const nodes : ComarkNode [ ] = [ ]
450450 let i = startIndex
451451 let currentSlotName : string | null = null
452+ let currentSlotAttrs : Record < string , unknown > = { }
452453 let currentSlotChildren : ComarkNode [ ] = [ ]
453454
454455 while ( i < tokens . length && tokens [ i ] . type !== closeType ) {
@@ -469,22 +470,31 @@ function processBlockChildrenWithSlots(
469470 // Check for slot marker: #slotname creates mdc_block_slot tokens
470471 if ( token . type === 'mdc_block_slot' ) {
471472 // Extract slot name from token.attrs
472- // The attrs array contains [["#slotname", ""]] for open, and null/empty for close
473+ // The attrs array contains [["#slotname", ""], ...props ] for open, and null/empty for close
473474 if ( token . attrs && Array . isArray ( token . attrs ) && token . attrs . length > 0 ) {
474475 const firstAttr = token . attrs [ 0 ]
475476 if ( Array . isArray ( firstAttr ) && firstAttr . length > 0 ) {
476477 const slotKey = firstAttr [ 0 ] as string
477478 // Remove the # prefix to get the slot name
478479 if ( slotKey . startsWith ( '#' ) ) {
479480 const slotName = slotKey . substring ( 1 )
481+ const slotAttrs = processAttributes ( token . attrs . slice ( 1 ) )
480482
481483 // Save previous slot if any
482484 if ( currentSlotName !== null && currentSlotChildren . length > 0 ) {
483- nodes . push ( [ 'template' , { name : currentSlotName } , ...currentSlotChildren ] as ComarkNode )
485+ nodes . push ( [
486+ 'template' ,
487+ {
488+ name : currentSlotName ,
489+ ...currentSlotAttrs ,
490+ } ,
491+ ...currentSlotChildren ,
492+ ] as ComarkNode )
484493 currentSlotChildren = [ ]
485494 }
486495
487496 currentSlotName = slotName
497+ currentSlotAttrs = slotAttrs
488498 i ++
489499 continue
490500 }
@@ -513,7 +523,14 @@ function processBlockChildrenWithSlots(
513523
514524 // Save last slot if any
515525 if ( currentSlotName !== null && currentSlotChildren . length > 0 ) {
516- nodes . push ( [ 'template' , { name : currentSlotName } , ...currentSlotChildren ] as ComarkNode )
526+ nodes . push ( [
527+ 'template' ,
528+ {
529+ name : currentSlotName ,
530+ ...currentSlotAttrs ,
531+ } ,
532+ ...currentSlotChildren ,
533+ ] as ComarkNode )
517534 }
518535
519536 return { nodes, nextIndex : i }
0 commit comments