How to Dynamically Convert HTML to Figma Nodes Without Hardcoding? 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.