cljdoc

seancorfield 2023-11-07T05:25:28.383859Z

If I have a library with docs/uberdoc.html (such as generated by Marginalia), what does cljdoc do with that? Can that be used as part of the cljdoc or do I need to find an alternative way to display/link to that?

lread 2023-11-07T12:40:16.415759Z

Hi Sean! Cljdoc currently only supports .adoc, .md, and .txt (plaintext). We'd have to think about what supporting .html might mean. The formats we currently support don't include specific styling, so cljdoc can impose its styling aesthetic on them.

seancorfield 2023-11-07T16:12:42.213569Z

Yeah, that's what I suspected and I was wondering about the styling. I guess you could wrap the HTML in an iframe...

lread 2023-11-07T20:28:35.141749Z

I suppose, but cljdoc has a specific and consistent styling. Random HTML would do its own thing. Can you point me to an example of HTML generated by Marginalia? It might give me some ideas of what we might do to support Marginalia-generated content. BTW, I should also gauge interest. Is this just a curiosity, or are you very interested in cljdoc presenting this content?

seancorfield 2023-11-07T20:36:32.947259Z

Marginalia produces a fully self-contained single-page HTML document by default, with text on the left and code on the right. It would be "nice" to be able to incorporate it somehow with the cljdoc-generated docs so projects don't need two different doc sites. I guess a basic question is: If cljdoc finds files in docs/ that aren't *.md or *.adoc (or *.txt), do they end up copied into the appropriate place on http://cljdoc.org or are they completely ignored? What about images, for example?

seancorfield 2023-11-07T20:38:06.469349Z

And then then next Q is: what happens if *.md files include HTML in their bodies? That's just rendered like regular Markdown does it -- inline?

seancorfield 2023-11-07T20:39:02.073179Z

I don't have a Marginalia-generated HTML file anywhere that serves up HTML right now -- only as raw files in GH: https://github.com/clj-commons/marginalia/blob/master/docs/uberdoc.html

lread 2023-11-07T22:37:34.706529Z

> If cljdoc finds files in docs/ that aren't *.md or *.adoc (or *.txt), do they end up copied into the appropriate place on http://cljdoc.org or are they completely ignored? What about images, for example? They won't end up in your doc tree. Relative images are always sourced from your GitHub (or whatever hosted git you use) repo.

seancorfield 2023-11-07T22:38:18.789419Z

Ah, OK. I wasn't sure...

lread 2023-11-07T22:38:38.521409Z

> And then then next Q is: what happens if *.md files include HTML in their bodies? That's just rendered like regular Markdown does it -- inline? Like GitHub, cljdoc supports a limited subset of HTML embedded in .md files.

seancorfield 2023-11-07T22:39:09.514569Z

Ah, I didn't realize it was limited -- I thought it was just passed through when rendering. TIL.

lread 2023-11-07T22:40:18.596869Z

Yeah, GitHub wants to preserve its vanilla look and feel and wants content to be safe too, I guess. So it is conservative in what HTML it lets pass through.

lread 2023-11-07T22:42:06.675509Z

Unlike cljdoc, GitHub does render .html files tho... so I was curious what a Marginalia file looks like rendered by GitHub (plain old repo rendering not GitHub pages).

seancorfield 2023-11-07T22:42:53.228209Z

Hmm, I couldn't figure out how to view that uberdoc.html rendered on the repo...

lread 2023-11-07T22:43:28.846139Z

Oh maybe I'm wrong... I think it supports README.html.... but... I guess I'll have to double check that.

seancorfield 2023-11-07T22:43:58.104969Z

Probably just README...

lread 2023-11-07T22:45:08.929989Z

Oh right... you gave a link above: https://github.com/clj-commons/marginalia/blob/master/docs/uberdoc.html... ya probably just README.html (if that).

lread 2023-11-07T22:46:52.721459Z

Oh that uberdoc.html also has JavaScript...so.. that would be a security concern for cljdoc.

lread 2023-11-07T22:48:34.709359Z

Spitballing... but... would one viable idea be for cljdoc to generate Marginalia docs on request?

lread 2023-11-07T22:50:05.891969Z

I should learn more about Marginalia tho... cljdoc is currently a tool to document public APIs. Does that mesh with Marginalia's typical usage?

seancorfield 2023-11-07T22:53:49.852839Z

Typically, I think folks generate marg-uberdocs from a subset of the namespaces in their project and it's more suitable as articles than an alternative to API docs.

seancorfield 2023-11-07T22:54:48.220539Z

For example, the old Marginalia uberdoc was originally generated from leiningen.marg plus some of the main Marginalia repo nses -- and I haven't figured out a good way to include that ns since it's part of a different repo...

lread 2023-11-07T22:58:12.434589Z

Ah ok. I've cracked open that uberdoc.html in my browser. So geared toward maybe a reader who is interested in not just learning about the API but also the annotated source?

seancorfield 2023-11-07T22:58:48.417069Z

Yeah, it's very much the "literate programming" thing...

lread 2023-11-07T22:58:58.257979Z

Right. Cool.

seancorfield 2023-11-07T22:59:38.776569Z

I used it for one of the apps I developed at work. Started off with all the prose and then gradually implemented some of the prose as code -- and the document was a good working basis for both business and devs to collaborate.

seancorfield 2023-11-07T23:00:19.613779Z

That's why I was thinking of it as an "article" along with other things.

lread 2023-11-07T23:03:37.742649Z

Ya. Hmm... worth thinking about.

seancorfield 2023-11-07T23:07:24.131279Z

Maybe copy *.html in but treat them as opaque docs and have the nav link target="_blank" ?

seancorfield 2023-11-07T23:07:52.536169Z

(assuming cljdoc could serve up static html?)

lread 2023-11-07T23:09:53.838029Z

Dunno... I don't think I'd want cljdoc to deliver unsanitized HTML... even if delivered opaquely.

lread 2023-11-07T23:11:18.921619Z

Not sure yet what the embedded JavaScript does. Can take a deeper peek sometime. Before looking at that sample HTML you shared, I was wondering if we could have marginalia optionally generate to .md or adoc instead. But... I'm guessing making it look nicey nicey might be a bit of a challenge.

lread 2023-11-07T23:12:59.032069Z

(Lurkers please do chime in if you are also interested in Marginalia support in cljdoc.)

seancorfield 2023-11-07T23:13:31.575079Z

point_up::skin-tone-2 That probably needs to go to the channel for anyone else to see it 🙂

👍 1
lread 2023-11-07T23:15:23.360729Z

Lurkers please do chime in if you are also interested in Marginalia support in cljdoc.

👍 1
seancorfield 2023-11-07T23:19:58.812649Z

FYI: I just regen'd that uberdoc.html with the leiningen.marg ns in -- via https://github.com/clj-commons/marginalia/blob/master/project.clj#L20-L24

lread 2023-11-07T23:21:47.600229Z

tx!

lread 2023-11-07T23:24:14.494669Z

Interesting, so sometimes you'd create namespaces for doc purposes only, like problem-cases.general.

lread 2023-11-07T23:28:30.494469Z

I gotta go for now, but it seems worth exploring to me, Sean. My initial inclination would be to have cljdoc generate Marginalia docs (or Maginalia equivalent docs), but we'd also want to provide an easy/quick way to preview (and the cljdoc preview story is pretty clunky right now). This is just an initial bias, I'm sure there are other ideas worth exploring.

Casey 2024-11-15T15:48:50.501879Z

> Lurkers please do chime in if you are also interested in Marginalia support in cljdoc. Just came across this message from last year while searching for Marginalia support. I'm a lurker and I'm chiming in ;)

seancorfield 2023-12-05T17:10:56.928969Z

Since this came up in the metrics-clojure thread 🙂 Any further thoughts on ways to support HTML or Marginalia in http://cljdoc.org?

seancorfield 2023-12-05T17:11:51.587759Z

I'm still somewhat inclined to push for http://cljdoc.org allowing .html pages to copy into the docs tree and letting maintainers link to them however they want 🙂

seancorfield 2023-12-05T17:12:25.304899Z

(So I could at least add a wrapper in .md that opens the .html in a new window)

lread 2023-12-05T17:41:16.233399Z

there is this old issue https://github.com/cljdoc/cljdoc/issues/433, would it help? means html is hosted elsewhere

seancorfield 2023-12-05T17:44:37.238489Z

Not really. I'm specifically trying to avoid hosting docs elsewhere, so that they can be properly versioned like everything else.

lread 2024-11-18T02:31:42.956159Z

Thanks for chiming in @ramblurr!