Fork me on GitHub
#clerk
<
2023-05-31
>
hkjels06:05:55

I've seen the option for tailwind & compiling css from markup, but how do I add an external stylesheet to my notebook?

Sam Ritchie07:05:34

You could use that, or see the source and use the same trick directly

hkjels07:05:49

Nice. Thank you!

mkvlr13:05:11

this is what I’d currently recommend

mkvlr13:05:43

if you want more, chime in on https://github.com/nextjournal/clerk/issues/323 but I’m not not sure special handling is currently worth it

hkjels13:05:05

Looks good. Does the Clerk server have any option to expose a public folder as well?

mkvlr13:05:49

not yet but we ran into this recently and started working on it https://github.com/nextjournal/clerk/pull/481

mkvlr13:05:03

if that’s useful to you, please do let us know

hkjels13:05:57

That's exactly what I want 🙂

teodorlu12:05:57

Hi! I really like this introduction to Clojure: https://learnxinyminutes.com/docs/clojure/ Does anyone happen to have a Clerk version?

mkvlr13:05:21

not that I know

👍 2
mkvlr13:05:07

looks like it would be about dropping the ; => and whatever comes after mainly?

teodorlu18:05:36

Yeah, it shouldn't be too much work! Perhaps the text could be easier to read with markdown. Perhaps there's a use case for (clerk/example ,,,) too.

teodorlu20:05:54

I converted most of the document -- https://github.com/iterate/literate/tree/7cf5c22f88f3b5648ef9c2a59d0b76892c28d997/brevdueklubben/src/learnclojure.clj / https://brevdueklubben.literate.app.iterate.no/src/learnclojure.html. But as I was reading through the document, I was thinking that it might be possible to write a better introduction to Clojure than that guide. I'd probably tone down types (first section name) and java, to focus on functions and data.

respatialized13:05:25

I am trying to get set up with clerk-utils and am encountering an error when I try to connect a cljs repl. This is a new project initialized with the project template, and I am launching the REPL by using bb clerk-watch. When I use cider-connect-cljs, I can connect (I'm using node as the REPL type), but shortly after the REPL connection is established, I get the following error:

clojure.lang.ExceptionInfo: shadow-cljs nREPL initialization failure!
Your nREPL client sent a wrong parameter. A keyword specifying the build-id is expected.
Instead got a #cljs.repl.node.NodeEnv{:host "localhost", :port 52125, :path nil, :socket #atom[nil 0x7c28fd0], :proc #atom[nil 0x7bd05109], :state #atom[{:listeners 0} 0x5a1b1c7f], :debug-port nil}
{}
 at shadow.cljs.devtools.server.nrepl$shadow_cljs_repl.invokeStatic (nrepl.clj:33)
I'm not sure if if this will interfere with my ability to do repl-driven cljs development for custom Clerk viewers, but I figured it was worth raising here.

mkvlr13:05:19

why node as the repl type?

mkvlr13:05:24

shouldn’t this be browser?

respatialized13:05:53

https://github.com/mentat-collective/Clerk-Utils/blob/1e0c4473073cadb35f938c6cea5dceeb3f5f95bd/.dir-locals.el#L3 It wasn't clear from the docs which REPL I should use. I assumed shadow at first because that's the REPL type mentioned by the console output, but also encountered an error with it. So, I looked at the clerk-utils repo for guidance and chose node based on that.

respatialized13:05:56

Specifying browser as the REPL type also returns an error:

clojure.lang.ExceptionInfo: shadow-cljs nREPL initialization failure!
Your nREPL client sent a wrong parameter. A keyword specifying the build-id is expected.
Instead got a #cljs.repl.browser.BrowserEnv{:es #object[java.util.concurrent.ThreadPoolExecutor 0x62b11b08 "java.util.concurrent.ThreadPoolExecutor@62b11b08[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]"], :browser-state #atom[{:return-value-fn nil, :client-js nil} 0x29817a41], :working-dir ".repl-1.11.60", :preloaded-libs [], :launch-browser true, :static-dir ["." "out/"], :src "src/", :port 9000, :ordering #agent[{:status :ready, :val {:expecting nil, :fns {}}} 0x1ab1e6dc], :host "localhost", :server-state #atom[{:socket nil, :listeners 0} 0x4c2122df]}
{}

Sam Ritchie14:05:30

huh, this is almost certainly a bug with my setup since I haven’t done cljs development in a Clerk project…

Sam Ritchie14:05:36

I can look at this later today!

respatialized14:05:34

thanks @U017QJZ9M7W! I'm a little surprised to hear that you "haven’t done cljs development in a Clerk project" - does that mean that emmy and mafs weren't done using cljs (rather instead just using sci)? I guess the XY problem for me here is "how do I get a REPL + tooling that shows me docstrings & information about JS libraries I'm using to write custom Clerk viewers?", and if I can do that without a cljs REPL, that's enough.

Sam Ritchie14:05:06

I did Emmy with a proper cljs repl, tests, etc, but for the Mafs.cljs and friends I was using Clerk as my viewer, and didn’t need to do any REPL interaction — so most likely there is some small setting error that we can get past once I get some time to fix it up

Sam Ritchie14:05:57

Oh I bet the issue is that I don’t put any shadow file in the template by default, as I was trying to hide all of that from the user. That is probably the wrong decision for someone adding their own custom closure, script, code, so maybe we need to generate a shadow file…

respatialized13:06:01

An empty (`{}`) shadow-cljs.edn file fixes the issue, but I have one lingering question: should I be connecting to a browser repl or a node repl?

teodorlu20:05:36

I just introduced some non non-Clojure programmer colleagues to Clojure with Clerk. We spent an hour with an editor and a Clerk instance on a big screen. Clerk made it so much easier to talk about what was happening. See the form, see what it evaluates to. It felt great to get questions and be able to show the answer. gratitude ❤️

🖤 8
❤️ 3
elken20:05:50

I've been slowly stealing some over too 🙂 @U058DHAN3UP may have been wooed by it too

❤️ 2
🖤 2
mkvlr20:05:08

great to hear, thanks for sharing!

❤️ 2
Colin (fosskers)00:06:58

Yeah I'm having fun with it lately. It's like org-babel on steroids and it "just works".

❤️ 2
🖤 2
hiredman20:05:45

when I add {:nextjournal.clerk/visibility {:code :hide :result :show}} as metadata to a form, which I think is what https://book.clerk.vision/#visibility says to do, I get an error

Execution error (ExceptionInfo) at nextjournal.clerk.parser/->visibility (parser.clj:23).
Invalid `:nextjournal.clerk/visibility`, valid values are `#{:hide-ns :fold-ns :hide :show :fold}`.

teodorlu20:05:41

Which Clerk version? Seems to work as expected for me on {:mvn/version "0.13.842"}.

hiredman20:05:07

not entirely sure, just took the version from :deps example in the same document

hiredman20:05:22

which is 0.9.513

teodorlu20:05:38

I think that's quite old, possibly from last year

hiredman20:05:12

I see, I'll upgrade then

👍 2
mkvlr20:05:01

ah yes, sorry forgot the deploy of the book after we fixed the version

mkvlr20:05:05

[io.github.nextjournal/clerk "0.13.842"] is the latest on maven or io.github.nextjournal/clerk {:git/sha "1f6c5331418aaf9c5a4335fc2e6e95f07dc3af6b"} for tools.deps

hiredman20:05:40

I do seem to have completely forgotten why I was trying to hide something, so cannot have been that important 🙂

😄 4
hiredman20:05:00

(new version works for me)

👍 6