code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

Raw Template - Support variant and links in raw

Open amoshydra opened this issue 11 months ago • 0 comments

Describe the feature you'd like:

Currently parseReactDoc is capable of returning variant and link to the CodeConnectJSON https://github.com/figma/code-connect/blob/cfed2bf6f63c5d61d9d358556d3a7117ba9c59ba/cli/src/react/parser.ts#L910-L911

It would be nice to also be able to specify variant and link in the Raw template.

https://github.com/figma/code-connect/blob/cfed2bf6f63c5d61d9d358556d3a7117ba9c59ba/cli/src/commands/connect.ts#L190-L209

Suggestion

Allow usage of frontmatter to specify more data for the CodeConnectJSON

---
url: https://www.figma.com/file/your-file-id/Component?node-id=123
component: Button
variant:
  type: primary
  has outline: true
links:
  - name: Awesome Document
    url: https://example.com
---

const figma = require('figma')
const instance = figma.selectedInstance

it can be kept forward compatible too. yaml parsing can be enabled if the file starts with "---\n".

See POC in #263

amoshydra avatar Mar 15 '25 15:03 amoshydra