mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 04:55:06 +09:00
Removes markdown code block delimiters from JSX the parser utility and adds a new utility to extract code blocks from LLM responses. There was a bug in the previous implementation where we were parsing the JSX stripped out of code blocks delimiters but when extracting the props from the source string we were slicing the original string with delimiters.
JSX Utils
Utilities to work with JSX, including converting it to Webstudio format.
Usage
Install the package
pnpm i @webstudio-is/jsx-utils
Transform a JSX string to Webstudio Embed Template:
import { jsxToWSEmbedTemplate } from "@webstudio-is/jsx-utils";
await jsxToWSEmbedTemplate("<Box>hello</Box>");
Other utils:
traverseTemplateandtraverseTemplateAsyncto traverse a WsEmbedTemplate and work with nodestailwindToWebstudioconverts a templateclassNameprop to Webstudio local stylesheroiconsToSvgEmbedconverts<HeroIcon name="iconName" type="solid">toHtmlEmbedwith inline SVG