cljdoc

Ludger Solbach 2025-06-27T16:02:06.895639Z

Is it possible or feasible to integrate clay generated tutorials? For QClojure, I'm writing a tutorial with Clay, to show features, code and results. Clay generates html (or other outputs via quarto) from a clojure namespace via the clay/make! command. I've commited the tutorial clojure namespace and also the generated html resources. So there would be two options to integrate clay content: 1. embed the generated html from the repository 2. use Clay to generate the output in the cljdoc build process. What do you think of this? If it's generally a good idea, we could talk with @daslu about this.

Ludger Solbach 2025-09-15T07:03:15.301619Z

With the recent version of clay (https://clojars.org/org.scicloj/clay/versions/2-beta56), it's now possible to publish notebook style documentation to cljdoc. The :gfm format target produces markdown and SVG visualization provided in hiccup format will be rendered as static SVG files and included as images. For an example, see https://cljdoc.org/d/org.soulspace/qclojure/0.17.0-SNAPSHOT/doc/tutorial. Thanks @timothypratley for making this happen. gratitude

🥳 1
🙌 3
🙌🏻 1
seancorfield 2025-06-27T16:39:09.802839Z

The ability to incorporate HTML documentation has come up before, as I recall (I think for Marginalia, at least). Let me see if I can find the issue for that...

lread 2025-06-27T17:35:04.766769Z

For security reasons, my thought was that user-provided JavaScript running on cljdoc was not a great idea. But maybe there is some safe way to do it.

seancorfield 2025-06-27T17:36:29.706839Z

(I didn't find a relevant issue -- there was a Marginalia-specific issue but that was more about literate programming than adding HTML pages)

seancorfield 2025-06-27T17:38:15.348929Z

Clay can generate Markdown tho' can't it? Maybe that's a path to get Clay-generated tutorials into cljdoc?

lread 2025-06-27T17:38:22.122109Z

We certainly discussed it here, @seancorfield... https://clojurians.slack.com/archives/C8V0BQ0M6/p1699334728383859

seancorfield 2025-06-27T17:42:12.683329Z

Ah, but the HTML doc part never made it into an issue, just the Marginalia-specific aspect... I remember the discussion (vaguely) but hadn't gone looking for it here.

seancorfield 2025-06-27T17:57:51.095789Z

Clay can produce *.qmd files (for input to Quarto, I think?). Which aren't "real" Markdown files that cljdoc could understand (and there's JS files generated too, so that gets us back to the security issue above and really the general issue of embedding HTML etc into cljdoc stuff). 😞

Ludger Solbach 2025-06-27T18:28:24.930339Z

some supported kinds for showing output rely on JS, for example vega output, I suppose. Currently I have nothing in the tutorial where JS is necessary, the output is SVG wrapped in kind/html. I understand your security concerns, but maybe there's a way to get a subset of clay supported. At least we have all parts of the picture under control. Can we support different kinds as "embedded formats" (e.g. SVG, or TeX) in markdown? Maybe as fallback by rendering them as images? Going that route would at least address the HTML problem.

lread 2025-06-27T18:42:33.336899Z

If the JavaScript is not generated, we could have cljdoc include that static JS (as needed) for clay articles. I think cljdoc supports SVG... It might support Tex because https://cljdoc.org/d/lread/cljdoc-exerciser/1.0.57/doc/document-tests/asciidoctor-features#_math, if that's relevant. QMD is an extension of MD, so we could, technically, support it through custom extensions.

lread 2025-06-27T18:43:52.239019Z

Not sure if it is relevant, but cljdoc uses an older version of MathJax (v2.7.9), because that is what AsciiDoc requires.

Ludger Solbach 2025-06-27T19:02:05.631229Z

maybe we can check with Daniel, he should know. I've notified him about this thread.

Ludger Solbach 2025-06-27T19:03:24.481599Z

but I really think, having clay tutorials on cljdoc is a nice additional way to document libs.

lread 2025-06-27T19:28:38.777419Z

To gauge general interest, I'd love for others to chime in if they are interested in this feature.

seancorfield 2025-06-27T20:19:07.084829Z

Having been recently exposed to Clay -- and publishing the transducers article on Civitas -- I can definitely see value in being able to write docs that way and have them included in cljdoc. Could cljdoc include a Quarto step to handle those .qmd files perhaps? So the workflow for users would be to run clojure -M:clay -A:markdown and commit the generated .qmd files (under docs/, alongside any regular .md files), and then cljdoc would use Quarto on those as part of generating the HTML etc?

lread 2025-06-27T20:25:41.310239Z

Without understanding specifics of Clay, from a cljdoc perspective, that seems like a good approach to me.

Daniel Slutsky 2025-06-27T20:43:35.685409Z

Thanks for this discussion, very encouraging. A few of the relevant visualization kinds can be rendered in a way that will not require Javascript, and in principle, Clay should eventually support such Javascript-free targets. We are not sure when this will happen, though. (In general, the future of Clay is to replace its rendering engine with https://github.com/scicloj/kindly-render by @timothypratley. There, we have a modular system to support various target formats. Supporting different markdown flavors, as well as Javascript-free HTML, has been a goal. As far as I know, Timothy did have cljdoc as a future use case in mind. At the moment, we are unsure about our capacity to develop these additional features in the near future. None of it is a lot of code, actually, but there are some delicate details of compatibility that will need some careful thinking.)

❤️ 2
Daniel Slutsky 2025-06-27T20:44:13.582799Z

I'll be glad to keep thinking about it. 🙏

Daniel Slutsky 2025-06-27T20:52:03.601639Z

In the meantime, we could experiment with an ad-hoc solution on the Clay side that will create the desired flavor of markdown and just work with the visualization kinds which are currently needed. But maybe we should think a bit about what it requires, to see how much of a tech debt it might be.

Ludger Solbach 2025-06-27T20:57:40.192829Z

I'm not in favor of solutions that add to the technical dept. I wouldn't rush things but wait for a well designed solution.

👍 1
lread 2025-06-27T21:05:03.287289Z

Coolio, when you are ready, we can explore how cljdoc might someday support Clay.

🙏 1