I think having a standard annotation for strings containing other languages would be a helpful addition to roc, this could either be a language feature or a community convention, like always naming functions that injest that data the name of the language eg:
jsonData=
json
"""
{"data":10}
"""
htmlData=
html
"""
{"data":10}
"""
Having some level of standardization here lets us do some very cool things:
My preference would be similar to markdown code blocks..
htmlData=
"""html
{"data":10}
"""
I did think that but it creates some weirdness in cases like this :
"""html"""
like do we include it? or not?
I could imagine a specific syntax like:
%html"""
<div>
"""
%html"<div>"
One thing i really like about the function version is that you will often want to parse or ingest or validate the data in some way anyway
like do we include it? or not?
I thought the multi-line content starts on the next line so it wouldn't be an issue.
This sounds nice!
You can have a single line string that uses triple quotes
I like having the language after the “”” too. I think it would be fine to just not enable it for single line triple quote strings
This is currently valid roc:
html=
"""<div>
</div>
"""
I do agree it's be nice having it like markdown I'm just very leery of putting anything inside the quotes that isn't part of the string, I think it's unintuitive and could definitely cause gotchas
I like the original idea as a convention! Some nice things about it:
html, json, etc.) to be a no-op, so it won't have any runtime overhead or anythingI like the idea of the heuristic for "should we enable syntax highlighting?" being "is it an unqualified function call with exactly 1 argument, and that one argument is a triple-quoted string"
Cool, all reasons I agree with. I'll add the feature to tree sitter sometime soon and put it on an eventual to-do list for the language server.
This is in the latest version of the tree sitter Grammer, for the vscode folks... Well I'll take a look at adding this to the extension :)
Well I've been running this for a while and it has a problem.
A bunch of usual functions are also file formats tree-sitter recognizes. Such as "panic". so the highlighting goes all weird
Last updated: Jun 16 2026 at 16:19 UTC