Fork me on GitHub
#cljdoc
<
2024-05-08
>
Noah Bogart13:05:39

Is hot-reloading of documentation possible when running cljdoc locally?

martinklepsch13:05:10

Not really I’m afraid

martinklepsch13:05:41

You can write a shell command that will build your jar, ingest it locally, and open the browser

martinklepsch13:05:07

I think that would be be the closest you can get to a hot reload type of experience

cjohansen13:05:30

I tried viewing docs locally recently, but found the setup quite complicated. Would be very cool if I could just point something at a local checkout and work on it with live reload.

martinklepsch13:05:16

Yeah it’s not ideal, contritbutions in this direction are very much welcome. Jar building will be necessary though.

lread15:05:52

I've written a cljdoc-preview task that I adapt for various projects. It abstracts the complexity for me. Here's https://github.com/lread/test-doc-blocks/blob/main/script/cljdoc_preview.clj. But yeah, it is currently a pretty big setup and operation to preview locally. And nope @UEENNMX0T no hot re-loading support yet. As I took the time to document the current howtos for cljdoc local previewing, I am pretty familiar with the whole thing. So, if folks have questions or want to brainstorm ideas, I'm around!

Noah Bogart15:05:23

Restarting isn't so bad (starts up pretty quick), but having to rely on a commit is a little awkward. I don't know cljdocs' internals enough to know if pulling out just the docs/ generation logic into a cli would be possible or not lol

lread15:05:45

Yeah, cljdoc local preview is currently a full integration test that literally mimics productions. I usually preview my articles' rendering with Visual Studio Code (I'm a Doom emacs user, but it has a nice preview) and then do my final API docstrings and article (and links-between-them) checks using cljdoc local preview.

lread16:05:43

So, if I understand your current focus, you are wanting to very quickly see how cljdoc would render your articles as you write them. During this workflow you don't really care about full production preview of your docs.

Noah Bogart16:05:53

Yeah, I can do some previews locally as well. I reach for this when I want to make sure the cljdoc.edn file is properly configured and everything links together correctly

👍 1
lread16:05:26

Ideally, I'd like a simple and fast local preview with automatic hot-reload that tells me what my docs will look like (and how they will behave) after I release my lib.

💯 1
👍 1
lread16:05:11

Cljdoc's source of truth is the jar and the revision in the remote git repo the jar points to. That's fine for production but imposes a real burden for local preview. We might consider a preview mode that is not 100% representative of cljdoc production, which could be followed by an optional full preview should the doc author wish to go that far... dunno.

cjohansen16:05:52

I mostly want to see how my namespaces are treated and what the docstrings look like. I don't really care about versions, packaging, etc.

lread16:05:22

Yeah, that's a good point. When I have some slightly complex Markdown in a docstring (that might include string escaping) it would be nice to quickly see what it would look like.

lread16:05:47

There are different times when I care about different things. I do care about versions and packaging in my final checks before I release a lib. But while I'm writing a docstring or an article, not so much!

teodorlu17:05:57

Hi! I'm having a bit of a hard time reading cljdoc docs from my phone, screenshots attached. Do you want an issue? (not sure if phones are a design target)

lread18:05:30

Hi @U3X7174KS! Yes, please! We do render differently for a smaller screen (on your desktop, you can see this by bringing your docs up and sizing the window really small). Perhaps your phone is on the cusp of what cljdoc considers small. We can adjust. Please share screen rez.

👍 1
lread14:05:10

Thanks!

❤️ 1
teodorlu14:05:36

Thank you for cljdoc :)

lread15:05:17

Well thank @U050TNB9F, it is his baby! I'm just a nurturing uncle. simple_smile

teodorlu15:05:28

Thank you both! 😊

teodorlu06:05:38

Looks like I’m getting desktop in landscape! (meant to send this message along the screenshot, but it looks like I got distracted by something 😅)

lread11:05:43

yes that’s good news, thanks for following up!

❤️ 1