Hello everyone, long time no see!
I looked at the snapshot files for the zig compiler and it occurred to me, they could be syntax highlighted nicely in editors and in github if we use markdown files. The format would be this (very little change from the current syntax):
# SECTION-HERE
~~~language-id-here-for-syntax-highlight
content
~~~
Here is a screenshot of my Zed with if-then-else.txt reformatted:
if-then-else-md.png
And here is one with VSCode. It doesn't pick up roc syntax, but the markdown headers pop out nicely:
image.png
Talked with Luke, and said that I'd implement it, if you like it. Would be a good way for me to get back into contributing.
i think the convention for markdown codeblocks is to use backticks ` instead of tilde ~
{"foo": 1}
https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Great idea, I'm on board!
Romain Lepert said:
i think the convention for markdown codeblocks is to use backticks ` instead of tilde ~
{"foo": 1}https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Yes, that is true. The dsl txt we've been using has ~~~SECTION-NAME as the separator, so I thought it would be more familiar. We could use backticks just as easily. From the markdown spec's perspective, they are interchangeable.
I choose them, because they are easier to spot than the backticks in source code, because they look like section separators, and I think ~ -s will occure less in roc source code than backticks. You can put doc-comments in a roc file which have markdown format i, so searching for "<tripple-backticks-here>roc" has the chance of finding a doc-comment that has some example in them, whereas ppl (as you've noted) don't use ~ for that. Zulip, Github, VSCode, Zed, Obsidian support both all the same (these are the apps I've got that work with md).
There was also a discussion of allowing arbitrary identifiers with backticks, similar to zig's @"my ident" syntax.
These are my rationale, but I don't think there is a wrong answer here.
Just a heads up, I've implemented this, and will create a pr on sunday. The syntax so far is the one I wrote, with the addition of sections being separated with a newline.
The new snapshots as markdown files look :fire:
Here's the hello world one... https://github.com/roc-lang/roc/blob/0b8e141078a499ce5df582bb0bec698c1c0b1948/src/snapshots/hello_world.md
I had another idea while looking at this... what if instead of "PlainText" for rendering problem reports we modified that to "Markdown" renderer.
Then we would have pretty formatted reports in markdown contexts like our snapshots. We would still have TTY for the terminal, LSP for editors, and HTML for hypertext.
Do we need boring old PlainText for anything else?
nah markdown would be nice
Couldn't help myself... https://github.com/roc-lang/roc/pull/7856 :smiley:
description=Hello world with a block
type=file
# Hello world!
# Multiline comments?
app [main!] { pf: platform "../basic-cli/platform.roc" }
import pf.Stdout
main! = |_| {
world = "World"
# Hello
Stdout.line!("Hello, world!")
}
NOT IMPLEMENTED
This feature is not yet implemented: top-level import
UNDEFINED VARIABLE
Nothing is named line! in this scope.
Is there an import or exposing missing up-top?
i hope you slept
err... I may have gone the extra caffeine :coffee: :coffee: approach :sweat_smile:
I told Jared I'd help merge his type checking Problems PR... and It's super cool seeing these nicely formatted problem reports with Types now
Screenshot 2025-06-23 at 11.28.09.png
Woah, looks awesome!
Yeah, nice work on the type unification!
niiiice!
:fire::fire::fire::fire::fire::fire:
it's wild to think that we now have roc check actually reporting a real type mismatch in the Zig compiler :explode:
like we just decided to do this rewrite a few months ago, and now the rewritten version is starting to become a real thing!
Last updated: Jun 16 2026 at 16:19 UTC