custom.astro
891 Bytes
---
import { slotPassThrough } from './render.astro'
import Children from './children.astro'
const { props: { wrap = false, wrapAttributes = {}, node, replacers, slotHandler } } = Astro
const { name: Name, attributes, children } = node
const CustomName = `custom-${Name}`
const slotCallback = slotPassThrough(Astro)
//console.log('Got custom match', node)
---
{
wrap ? (
<CustomName {...wrapAttributes}>
{
node.isSelfClosingTag ? <Name {...attributes}/>
: <Name {...attributes}>
<Children parent={node} children={children} replacers={replacers} slotHandler={slotHandler}/>
</Name>
}
</CustomName>
) : (
node.isSelfClosingTag ? <CustomName {...attributes}/>
: <CustomName {...attributes}>
<Children parent={node} children={children} replacers={replacers} slotHandler={slotHandler}/>
</CustomName>
)
}