Skip to content
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

Add JS.Verbatim and JS.Html helpers #1333

Closed
Jand42 opened this issue May 12, 2023 · 3 comments
Closed

Add JS.Verbatim and JS.Html helpers #1333

Jand42 opened this issue May 12, 2023 · 3 comments

Comments

@Jand42
Copy link
Member

Jand42 commented May 12, 2023

To allow printing any code fragments directly (unchecked) to .js output, also html fragments for .jsx.
You can only use constant strings or interpolated strings as argument.

   JS.Verbatim $"console.log({x})" // translated to: `(console.log(x))`
   JS.Html $"<div>{x}</div>" // translated to: `(<div>{x}</div>)`
@granicz
Copy link
Member

granicz commented May 12, 2023

Also, when translating placeholders like:

<{QRCode} message={value} size="0.5"></{QRCode}>

... omit the {}'s from around QRCode, because we can detect that <{...}> and </{...}> placeholders yield custom element names.

@granicz
Copy link
Member

granicz commented Aug 28, 2023

I really find the name JS.Html confusing - since it's a trigger to generate .jsx, I'd rename it to something more explicit such as JS.jsx. One bonus is that when renamed properly, it also becomes compatible with vscode-template-fsharp-hightlight.

@Jooseppi12
Copy link
Member

Added a JS.Jsx function that is equivalent of the JS.Html function and exposed lowercase variants of those two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants