-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Lit should support multiline string blocks for embedding SQL, JSON, Markdown, regexes, etc. A block can optionally be labeled (@sql, @json, etc.) so editors can apply syntax highlighting, but the label is not required.
Syntax:
[@<label>]
<marker><content>
<marker><content>
...-
The first content line determines the mode:
'''→ raw (no escapes, no interpolation)"""→ interpolated (supports escapes and#{…})
-
Every body line must start with the same marker.
-
Everything after the marker is included verbatim (spaces preserved).
-
A line that is just the marker produces a blank line (
\n). -
To include a literal leading quote, add one extra quote (
''''or""""). -
The block ends at the first line that doesn’t start with the marker.
Examples
Raw SQL:
@sql
'''SELECT *
'''FROM users
'''WHERE id = 42Interpolated SQL:
@sql
"""SELECT *
"""FROM users
"""WHERE id = #{user_id}JSON (no label):
'''{
''' "ok": true,
''' "id": 42
'''}Single-line form:
let query = @sql """SELECT * FROM users WHERE id = #{id}
let json = '''{"ok": true, "id": 42}This design keeps the marker visible on every line (like Zig) while @label provides a clean way for editors to apply language-aware highlighting.