Fork me on GitHub
#cljdoc
<
2023-11-07
>
seancorfield05:11:28

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?

lread12:11:16

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.

seancorfield16:11:42

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

lread20:11:35

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?

seancorfield20:11:32

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?

seancorfield20:11:06

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?

seancorfield20:11:02

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

lread22:11:34

> 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.

seancorfield22:11:18

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

lread22:11:38

> 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.

seancorfield22:11:09

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

lread22:11:18

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.

lread22:11:06

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).

seancorfield22:11:53

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

lread22:11:28

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

seancorfield22:11:58

Probably just README...

lread22:11:08

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).

lread22:11:52

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

lread22:11:34

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

lread22:11:05

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

seancorfield22:11:49

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.

seancorfield22:11:48

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...

lread22:11:12

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?

seancorfield22:11:48

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

lread22:11:58

Right. Cool.

seancorfield22:11:38

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.

seancorfield23:11:19

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

lread23:11:37

Ya. Hmm... worth thinking about.

seancorfield23:11:24

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

seancorfield23:11:52

(assuming cljdoc could serve up static html?)

lread23:11:53

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

lread23:11:18

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.

lread23:11:59

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

seancorfield23:11:31

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

👍 1
lread23:11:23

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

seancorfield23:11:58

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

lread23:11:14

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

lread23:11:30

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.

seancorfield17:12:56

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

seancorfield17:12:51

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 🙂

seancorfield17:12:25

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

lread17:12:16

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

seancorfield17:12:37

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