code-hike / codehike

Build rich content websites with Markdown and React
https://codehike.org
MIT License
4.74k stars 146 forks source link

Astro support #255

Open pomber opened 2 years ago

pomber commented 2 years ago

Astro 1.0 will have better support for MDX. It looks like it adds some custom stuff on top of MDX so I'm not sure Code Hike will still work.

pomber commented 2 years ago

Currently blocked by https://github.com/withastro/astro/issues/4209 and https://github.com/withastro/astro/issues/4389

carvinlo commented 1 year ago

Hi, thanks for this library! When I try to use CH.Section component in astro example it throws an error.

pomber commented 1 year ago

Yes, the Astro integration is still buggy, mostly because of the client directive.

may17 commented 1 year ago

Is this a problem astro needs to solve?

pomber commented 1 year ago

Is this a problem astro needs to solve?

Not sure. I guess other remark-plugins that create client side components will have the same problem, so it would be nice to have some way to default to client:load in some cases.

I may be able to add a workaround in Code Hike but it will have to wait until next month at least.

pomber commented 1 year ago

Found another problem, Astro converts children to static HTML, and Code Hike needs to process them as objects.

pomber commented 1 year ago

We won't have full support for Astro in the near future. I tried, but there were at least 4 different problems blocking the integration.

pomber commented 1 year ago

Main blocker is the inability to pass React children in Astro's MDX. The rest of the issues could be solved from CodeHike's side I think.

codersjj commented 1 year ago

Is Astro v2 supported now?

pomber commented 11 months ago

Is Astro v2 supported now?

It isn't, but there's now an experimental flag in Astro that may help in the future. It's still not working as expected though. Read more here.

mbleigh commented 15 hours ago

What's the current state of Astro support with Code Hike? My personal blog is on Astro and I would love to be able to write posts that leverage Code Hike.

pomber commented 2 hours ago

What's the current state of Astro support with Code Hike?

The TL;DR is: Astro has its own flavor of MDX, Code Hike needs React MDX.

This proposal to allow frameworks to write Astro pages may solve the issue, but doesn't look like it's going to happen.