Skip to content

feat: support component, variant and links for raw file #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amoshydra
Copy link

@amoshydra amoshydra commented Mar 15, 2025

Preface:

I have read the contributing guidelines

However, we are currently not accepting any PRs at this time.

Understood if the PR will be closed. I am creating this PR to share a code reference that supports the feature request highlighted in #262.

Summary

This PR will allow additional CodeConnectJSON attribute to be defined via frontmatter syntax in the raw file.

Currently it is limited to the following properties only:

  • url
  • component
  • variant
  • links

This PR will add yaml as a dependency

Usage

/*---
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

Frontmatter is wrapped in comment block

Syntax highlighting in VS Code will not work correctly out of the box with the original suggested usage in #262

image

After wrapping in a comment block (changed in https://github.com/figma/code-connect/compare/8e2607ac42afbf6a47c86cc64310afb86872e752..b0088e339e6e613c65bbe3f5bbbc6aad7df534ef)

image


close #262

@amoshydra amoshydra force-pushed the frontmatter-for-raw-template branch from b0088e3 to e7ab659 Compare March 15, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raw Template - Support variant and links in raw
1 participant