custom.astro 848 Bytes
---

import Children from './children.astro'

const { props: { wrap = false, wrapAttributes = {}, node, replacers, slotHandler, adjuster } } = 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} adjuster={adjuster}/>
          </Name>
      }
    </CustomName>
  ) : (
    node.isSelfClosingTag ? <CustomName {...attributes}/>
    : <CustomName {...attributes}>
        <Children parent={node} children={children} replacers={replacers} slotHandler={slotHandler} adjuster={adjuster}/>
      </CustomName>
  )
}