calva

2026-03-01T14:48:17.234149Z

LLMs get very good in producing tutorials for Clojure libraries in markdown. By "good" I mean better then me, and far faster. So the "text" I will in practice read through and mostly leave untouched. They contain embedded code blocks as well, which are good , but not perfect. So I would like to "validate / execute / fix" these code blocks (after the markdown file is generated) They are now VScode plugin which nicely render markdown and code side-by-side Just an example:

## Model Utilities

### Loading Datasets

Load example datasets from Smile's repository.

clojure (require '[scicloj.ml.smile.toydata :as toydata]) ;; Load ARFF dataset (def iris-dataset (toydata/get-smile-data "weka/regression/cpu.arff")) ;; Load with custom options (def housing-dataset (toydata/get-smile-data "regression/housing.data" {:column-names [:CRIM :ZN :INDUS :CHAS :NOX :RM] :separator " "}))
So I can "review" the LLM result (= markdown) very comfortable. This is not true, for reviewing of the embedded Clojure blocks, which would be great if working better. This file is "not a .clj" file, so most Calva features don't, work. I would hope that Calva can get "special" support for this type of files. "markdown + clj". Maybe a good start would be a feature of a • running a single code block (on keypress) • runnig all code blocks of such markdown+clojure file

2026-03-01T14:55:04.097339Z

There are external plugins doing this: https://marketplace.visualstudio.com/items?itemName=renathossain.markdown-runner&ssr=false#qna but they don't keep "state" between the blocks. I nearly all my uses cases I would assume to have a "single clojure repl session" for the whole tutorial. This touches as well the topic of enable Calva for "Literate programming"

pez 2026-03-01T15:00:33.100389Z

Worth looking at what we can do about this. Please file an issue. That said: • You can select the code in the markdown block and use the Calva command Evaluate Current for or Selection. It’s not default bound to a keyboard shortcut in a markdown file, but it is still available. • I ask the agent to verify code it suggests, using the repl • You can evaluate code using default keybindings in the Copilot chat. (The Clojure code blocks in Copilot chat are readonly Calva editors.)

2026-03-01T15:01:15.466689Z

> You can select the code in the markdown block and use the Calva command Evaluate Current for or Selection. It’s not default bound to a keyboard shortcut in a markdown file, but it is still available.

2026-03-01T15:03:13.305709Z

Yes I saw that one. Maybe binding this to a key fixes my use cases to a large extend... Of course, ideally the codeblocks have "code completion and other features of Calva".... Some kind of "sync" might as well wok

2026-03-01T15:13:06.475489Z

Issue created: https://github.com/BetterThanTomorrow/calva/issues/3113

🙏 1
seancorfield 2026-03-01T16:47:39.603839Z

There are also testing tools that can run code examples in Markdown as test cases. LazyTest has that ability. There's also com.github.lread/test-doc-blocks {:mvn/version "1.2.21"} which I use to verify all the examples in HoneySQL's docs.

👍 1
2026-03-01T20:06:03.011349Z

Org Babel in Emacs (according to https://orgmode.org/manual/Editing-Source-Code.html) can pop a single code block open in a new, language-specific buffer, with the language's major-mode commands available, and then pop the edited version back into your original babel (literate) babel buffer afterward.

👀 1
2026-03-01T20:10:08.694269Z

yes, that's the emacs solution for this. One of the strong points of "org-mode" See comments in the issue above, where I propose the "other way arround" now Make Calva "render" markdown embeded in comments ";;" in a normal namespace Here we have "Calva supported code editing given", and "markdown editing in comments" is not too bad.

pez 2026-03-01T20:11:33.766589Z

I don’t understand what this means: > Make Calva “render” markdown embeded in comments “;;” in a normal namespace

2026-03-01T20:11:37.769879Z

Both "Clay" and "Clerk" support this syntax, so we have "users" for this.

2026-03-01T20:13:00.963789Z

I write:

;; # my header
(def a 1)
and Calva shows "my header" as "header" (markdown syntax) in a side panel.

2026-03-01T20:14:20.205889Z

Like this: (using the markdown-everywhere plugin)

2026-03-01T20:15:08.326099Z

The "plugin" has a few issues... But maybe we could report it and have it fixed ...

pez 2026-03-01T20:15:18.832819Z

Isn’t this what Calva notebooks is about a bit?

2026-03-01T20:16:22.911799Z

a bit yes...alternative syntax. (and not really working, is it ?) "Clay" and "Clerk" do work with that syntax (and can render it to html) , but as well including evaluation results (which above is not showing, and which is not needed when "concentrating on the text")

pez 2026-03-01T20:17:40.294539Z

There are Clay commands in Calva Power Tools. Tried?

2026-03-01T20:18:38.403569Z

yes. They work as well, but sometimes: • "inside Calva is more convienent" • "every text change requires re-render which is slow...."

2026-03-01T20:19:38.327349Z

The above "syncs" in realtime.... I type left, it updates right.....

pez 2026-03-01T20:20:16.037889Z

Yeah, but that extension also already exists, right?

2026-03-01T20:22:20.537099Z

Yes, its true. I will try to isolate the issues and report them. It's a kind of "setup issue" , and sometimes the initial markdown support does not trigger. But its probably more economic to get it working then re-write it...

pez 2026-03-01T20:35:02.969539Z

I’m not opposed to creating a webview that renders markdown and code like that screenshot. We could leverage the REPL for a more interactive experience. I think it could be pretty sweet. But it is a separate issue from the thread start, right? You are welcome to file an issue about this as well.

2026-03-01T20:37:53.318229Z

yes, it's a different issue. Let's say both are nice to have, but I believe that the original 3113 so "to support well clojure-blocks-in-markdown" is far harder to implement then "support/render" markdown-syntax in clojure comments"

pez 2026-03-01T20:41:14.148799Z

Agree. With some luck the VS Code team will bring the code block widget from the Copilot chat to the markdown previews and that would take care of 3113 beautifully. You could file an issue on VS Code about this. I would upvote and comment with my support for sure.