Replies: 1 comment
-
You might want to try |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm exploring different ways to do markdown to jsx with ISG. I receive the markdown through
getStaticProps
.(initial goal => rewrite
<a>
tags to<NextLink />
for in-app smooth navigation)But here I am with a question I can't solve.
Is there a benefit from parsing markdown strings in getStaticProps ? (to mdast or hast)
I currently have two situations:
One with
remark-react
: Receive md string withgetStaticProps
=> pass it as a prop => useremark-react
to have jsx. In this situation, the md string isn't parsed ingetStaticProps
but directly rendered withremark-react
in the app. This gives me aconsole.timeEnd
of approx 20ms (up to 40). Haven't configured personal elements rewrites yet (<a>
to<Link />
, or<img />
to<CloudinaryImg />
).Second with own config: Receive md string with
getStaticProps
=> parse it to mdast/hast => pass it as a prop =>use my own mdast/hast to jsx tool (untested etc ...). In this situation, the md string is parsed ingetStaticProps
to mdast/hast and rendered with my own tool in the app. This gives me aconsole.timeEnd
of approx 1ms (0.9 to 1.3). Haven't configured personal elements rewrites yet (<a>
to<Link />
, or<img />
to<CloudinaryImg />
).I know 20ms isn't that big of a deal, but I'm trying to get the fastest thing possible, and need a better understanding of SSG and how things render.
Have a good day !
Beta Was this translation helpful? Give feedback.
All reactions