custom.astro 798 Bytes
---

import Children from './children.astro'

const { props: { wrap = false, wrapAttributes = {}, node, replacers, slotHandler } } = Astro
const { name: Name, attributes, children } = node

const CustomName = `custom-${Name}`

//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>
  )
}