codehike icon indicating copy to clipboard operation
codehike copied to clipboard

Support for `LinkBlock` similar to `ImageBlock`?

Open stern-shawn opened this issue 1 year ago • 3 comments

Hi! I see in the isHikeElement check (source) that paragraph and image nodes are supported and have types exported as well, but links/anchors are not.

In a PoC that I'm building with Code Hike I'm trying to let users declare a custom button, say a call to action that should be styled nicely based on the page template, so I'd want a template something like this:

<PageWrapper>
  Some content

  [!cta Do an action](/link-to-action)
</PageWrapper>

Right now this doesn't work and the wrapper component will just receive children as props. If I change the node to an image, it works, but that'd be a weird syntax to communicate to authors.

eg this is functional and usable, but not syntactically ideal for authors:

<PageWrapper>
  Some content

  ![!cta Do an action](/link-to-action)
</PageWrapper>

I have viable alternatives in terms of passing props directly to the component, etc, but this could be a nice addition if support wasn't omitted for functional reasons 😄

stern-shawn avatar Sep 24 '24 18:09 stern-shawn