cljdoc

timothypratley 2025-09-16T21:19:58.006539Z

When cljdoc assembles an API reference, is there any way to associate more than just the docstring to an entry?

✅ 1
timothypratley 2025-09-16T21:22:19.744689Z

Particularly interested in attaching extra narrative (markdown) and examples. I found https://github.com/cljdoc/cljdoc/blob/master/doc/roadmap.adoc#examples is on the roadmap, perhaps something we can talk about?

Ludger Solbach 2025-09-16T21:22:44.742059Z

What would you like to add? The docstring can contain markdown.

timothypratley 2025-09-16T21:23:45.312109Z

one situation is including a chart or detailed example that shouldn't be in the docstring (because that is for REPL consumption). Basically just augmenting the docstring with a bit more information, ideally one that can show an image.

timothypratley 2025-09-16T21:25:16.043689Z

One answer is that everything should go in the docstring, and maybe it's more a question then can images be included in a docstring.

Ludger Solbach 2025-09-16T21:25:55.456799Z

I've never tried it, but maybe it works.

Ludger Solbach 2025-09-16T21:27:10.541399Z

Do you want to have it in the documentation of the code? You could cross-reference code and an external markdown file, for example.

timothypratley 2025-09-16T21:31:06.069889Z

Right. One concrete case is the "Tableplot" library which currently is not on cljdoc. The docstrings are insufficient. Rather the api is documented in this way: https://scicloj.github.io/tableplot/tableplot_book.plotly_reference.html#layer-bar where an example is shown. Cross-referencing is in general a good idea but doesn't quite solve the need to have a bit more than just the docstring.

timothypratley 2025-09-16T21:32:20.824629Z

Ideally we should bring Tableplot to cljdocs regardless of if it can include examples or not, but also if there is an opportunity to add something simple to cljdoc to achieve it, that would be fantastic.

Ludger Solbach 2025-09-16T21:33:11.771549Z

BTW, Claude Sonnet 4 is pretty good in in writing meaningful docstrings with examples.

timothypratley 2025-09-16T21:34:27.908069Z

In the case of Tableplot, one thought is simply if there was a way to provide a mapping of vars to images, that would be enough to show the visualizations that result from the examples.

Ludger Solbach 2025-09-16T21:35:00.432619Z

For the images, you could create a markdown file with referenceable headings per example and reference them from the docstring, if including image links doesn't work.

👍 1
timothypratley 2025-09-16T21:46:45.975609Z

For reference apparently in codox, it was somehow possible to interleave examples with the docstrings. https://generateme.github.io/fastmath/fastmath.signal.html#var-effect though in the case of Fastmath 2 at this link above, generateme did something special to generate those systematically. https://github.com/generateme/fastmath/blob/master/metadoc/fastmath/signal_examples.clj#L35 I haven't read into the details yet.

timothypratley 2025-09-16T21:59:14.102139Z

Maybe the first goal should be to include ![example](example.svg) in the docstring as markdown, and supply an image file that will be present in the final built artifact/site.

timothypratley 2025-09-16T22:21:09.759129Z

Probably that already just works if I put example.svg in /docs 🤔

lread 2025-09-17T00:05:46.916029Z

Markdown is supported in docstrings, and you can reference images. For an idea of what is available take a peek my little playground: https://cljdoc.org/d/org.cljdoc/cljdoc-exerciser/1.0.123/api/cljdoc-exerciser.core

👍 1
timothypratley 2025-09-17T00:24:13.922189Z

awesome, that's very helpful thanks