figma / code-snippet-editor-plugin

Translate component variants, properties, and more into dynamic code snippets for your design system.
https://www.figma.com/community/plugin/1311777988952403297/code-snippet-editor
MIT License
126 stars 11 forks source link

Escaping `{{` and`}}` #9

Closed gossi closed 5 months ago

gossi commented 5 months ago

I'm using this to generate code for Ember, which uses handlebars as their templating language, so very similar to what this plugin is using. Ember code can look like this:

<IconButton @label={{t "some-variable}}" />

I want to generate the label part and want to let engineers fill in the string. Here is the code I use for the template of this plugin:

<IconButton @label={{t "..."}} />

which fails, as I think it can't interpret the t "..." part between the curlies.

Is there a way to escape the sequence of {{and }}?

I'm linking handlebars escaping mechanism for reference: https://handlebarsjs.com/guide/expressions.html#escaping-handlebars-expressions

jake-figma commented 5 months ago

I'll add this soon! I think what handlebars proposes is great and would work nicely with the existing language, a single \ in front of the first curly eg.

<IconButton @label=\{{t "..."}} />
jake-figma commented 5 months ago

There was a bug here, reopening