Skip to content

define a js_str macro for creating JSONText #433

@hhaensel

Description

@hhaensel

I propose to define a js_str macro to generate JSONText with and without interpolation as below.

Besides a handy short form a big advantage is that in VSCode JS-Syntax-Highlighting can be achieved by triple-quoting, e.g.

js"""
console.log('This looks pretty!')
"""
Image

Many packages that handle js expressions, e.g. GenieFramework or Electron, would benefit (davidanthoff/Electron.jl#154) (GenieFramework currently exports its own version)

js"""alert("Hello World")"""
# JSONText("alert(\"Hello World\")")

Interpolation could be supported via the i flag, such as

js"""alert("1 + 2 == $(1 + 2)")"""i
# JSONText("alert(\"1 + 2 == 3\")")

I'll happily file a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions