Hello Figma Community,
I’m developing a Figma plugin where the UI sends arbitrary HTML content to the plugin’s main code using parent.postMessage
. The main code is then responsible for dynamically converting the HTML structure into Figma nodes on the canvas.
Goals:
- Parse any valid HTML provided by the user (e.g.,
<div><strong>Hello World</strong></div>
). - Dynamically generate equivalent Figma nodes (like
Frame
,Text
,Group
, etc.) that mirror the HTML structure and styles. - Avoid hardcoding specific tag types (e.g.,
<div>
or<span>
) so that the plugin works with any HTML.
Questions for the Community:
- Are there best practices or libraries for dynamically converting HTML to Figma nodes?
- How can I efficiently handle styles and attributes (e.g., inline
style
orclass
) from HTML in Figma? - Are there any limitations or pitfalls I should be aware of when replicating HTML structures in Figma?