@meditans we’ve just released https://clojars.org/io.github.nextjournal/clerk/versions/0.5.346 with plenty of good things (https://github.com/nextjournal/clerk/blob/main/CHANGELOG.md#05346-2022-01-27), including the ability to nest other viewers in e.g. html and table s. Check it out in action at https://snapshots.nextjournal.com/clerk/build/b9f35eb58a32f9b13d50d74143b9e2418dd2d1db/index.html#/notebooks/viewers_nested.clj
Wow this is awesome! I'll try it out later today 😍
https://clojurians.slack.com/archives/C06MAR553/p1643302352703909
I'm following the Using Clerk section on the github. I've added it to my deps.edn and it downloaded a bunch of stuff. I saw no errors.
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
io.github.nextjournal/clerk {:mvn/version "0.5.346"}}}
Then I try to add it to the require
(ns stuartstein777.scratch
(:require [clojure.set :as set]
[clojure.string :as str]
[stuartstein777.handy-functions :as helpers]
[nextjournal.clerk :as clerk]))
Eval the ns and I get the error:
Syntax error compiling at (nextjournal/clerk/hashing.clj:2:1). namespace 'nextjournal.markdown' not found
Am I doing something stupid ?
I hope I didn't do something stupid and release a broken thing 😓 will try this in a bit
though https://github.com/nextjournal/clerk-demo was also green on CI. Can you try if that works for you?
I can't jack into a repl on that. I get a different error
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error building classpath. Library jackrusher/mundaneum has missing :sha in coordinate.
Jack-in process exited. Status: 1
If I select to Jack in using the clerk alias I get the error
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}' -A:nextjournal/clerk -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error building classpath. Unknown alias key: :exec-fn
Jack-in process exited. Status: 1must be something wrong on my end
That sha for the jackrusher/mundaneum is correct.
ok, took the mundaneum stuff out and the projecf works now, repl jacks in and I can eval the ns on user.clj with no error.
can you try upgrading your clojure cli? Older versions do not understand the namespaced sha
but all the clerk stuff works on this project, I can eval (clerk/show!) and see it in the browser 🙂
I'll look to upgrade my clojure
thank you
still curious to learn what could cause the error on the sample project
Yeah, my deps.edn is literally just
{:paths ["src" "resources"]
:deps {io.github.nextjournal/clerk {:mvn/version "0.5.346"}
}}
Is that sufficient ?
@qmstuart nope, that works here…
clj -X:deps tree | head
org.clojure/clojure 1.10.3
. org.clojure/spec.alpha 0.2.194
. org.clojure/core.specs.alpha 0.2.56
io.github.nextjournal/clerk 0.5.346
. weavejester/dependency 0.2.1
. org.clojure/tools.analyzer.jvm 1.1.0
. org.clojure/tools.analyzer 1.0.0
. org.clojure/core.memoize 1.0.236
. org.clojure/core.cache 1.0.207
. org.clojure/data.priority-map 1.0.0what does this bring in for you?
(base) [19:43]: stuart@stuart-Z87M-D3H:~$ clj -X:deps tree | head
Unqualified function can't be resolved: tree
I'm on Ubuntu if that matters
clj -Stree I think it is for older cli versions
(base) [19:49]: stuart@stuart-Z87M-D3H:~/Source/clojure/cljcodewars$ clj -Stree
DEPRECATED: Libs must be qualified, change deps-deploy => deps-deploy/deps-deploy (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change expectations => expectations/expectations (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change criterium => criterium/criterium (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change proto-repl => proto-repl/proto-repl (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change nrepl => nrepl/nrepl (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change deps-deploy => deps-deploy/deps-deploy (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change compliment => compliment/compliment (/home/stuart/.clojure/deps.edn)
org.clojure/clojure 1.10.3
. org.clojure/spec.alpha 0.2.194
. org.clojure/core.specs.alpha 0.2.56
io.github.nextjournal/clerk 0.5.346
. weavejester/dependency 0.2.1
. org.clojure/tools.analyzer.jvm 1.1.0
. org.clojure/tools.analyzer 1.0.0
. org.clojure/core.memoize 1.0.236
. org.clojure/core.cache 1.0.207
. org.clojure/data.priority-map 1.0.0
. org.ow2.asm/asm 5.2
X org.clojure/tools.reader 1.3.2 :superseded
. rewrite-clj/rewrite-clj 1.0.699-alpha
. org.clojure/tools.reader 1.3.6 :newer-version
. io.github.nextjournal/markdown 0.2.44
X org.clojure/data.json 0.2.6 :superseded
. org.graalvm.js/js 21.3.0
. org.graalvm.regex/regex 21.3.0
. org.graalvm.truffle/truffle-api 21.3.0
. org.graalvm.truffle/truffle-api 21.3.0
. org.graalvm.sdk/graal-sdk 21.3.0
. org.graalvm.sdk/graal-sdk 21.3.0
. com.ibm.icu/icu4j 69.1
. applied-science/js-interop 0.2.6
. appliedscience/js-interop 0.2.6-MOVED
. org.graalvm.js/js-scriptengine 21.3.0
. org.graalvm.sdk/graal-sdk 21.3.0
X lambdaisland/uri 1.10.79 :older-version
. com.nextjournal/beholder 1.0.0
. io.methvin/directory-watcher 0.15.0
. net.java.dev.jna/jna 5.7.0
. org.slf4j/slf4j-api 1.7.30
. hiccup/hiccup 2.0.0-alpha2
. org.clojure/java.classpath 1.0.0
. org.clojure/tools.deps.alpha 0.11.905
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-spi 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-impl 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-spi 1.6.1
. org.apache.maven.resolver/maven-resolver-util 1.6.1
. org.apache.commons/commons-lang3 3.8.1
. org.slf4j/slf4j-api 1.7.30
. org.apache.maven.resolver/maven-resolver-util 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-connector-basic 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-spi 1.6.1
. org.apache.maven.resolver/maven-resolver-util 1.6.1
. org.slf4j/slf4j-api 1.7.30
. org.apache.maven.resolver/maven-resolver-transport-file 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-spi 1.6.1
. org.slf4j/slf4j-api 1.7.30
. org.apache.maven.resolver/maven-resolver-transport-http 1.6.1
. org.apache.maven.resolver/maven-resolver-api 1.6.1
. org.apache.maven.resolver/maven-resolver-spi 1.6.1
. org.apache.maven.resolver/maven-resolver-util 1.6.1
. org.apache.httpcomponents/httpclient 4.5.12
. org.apache.httpcomponents/httpcore 4.4.13
. commons-codec/commons-codec 1.11
. org.apache.httpcomponents/httpcore 4.4.13
. org.slf4j/jcl-over-slf4j 1.7.30
. org.slf4j/slf4j-api 1.7.30
. org.slf4j/slf4j-api 1.7.30
. org.apache.maven/maven-resolver-provider 3.6.3
. org.apache.maven/maven-model 3.6.3
. org.codehaus.plexus/plexus-utils 3.2.1
. org.apache.maven/maven-model-builder 3.6.3
. org.codehaus.plexus/plexus-utils 3.2.1
. org.codehaus.plexus/plexus-interpolation 1.25
. javax.inject/javax.inject 1
. org.apache.maven/maven-model 3.6.3
. org.apache.maven/maven-artifact 3.6.3
. org.apache.maven/maven-builder-support 3.6.3
. org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
. org.apache.maven/maven-repository-metadata 3.6.3
. org.codehaus.plexus/plexus-utils 3.2.1
X org.apache.maven.resolver/maven-resolver-api 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-spi 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-util 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-impl 1.4.1 :older-version
. org.codehaus.plexus/plexus-utils 3.2.1
. javax.inject/javax.inject 1
X org.slf4j/slf4j-api 1.7.29 :older-version
. org.apache.maven/maven-core 3.6.3
. org.apache.maven/maven-model 3.6.3
. org.apache.maven/maven-settings 3.6.3
. org.codehaus.plexus/plexus-utils 3.2.1
. org.apache.maven/maven-settings-builder 3.6.3
. org.apache.maven/maven-builder-support 3.6.3
. javax.inject/javax.inject 1
. org.codehaus.plexus/plexus-interpolation 1.25
. org.codehaus.plexus/plexus-utils 3.2.1
. org.apache.maven/maven-settings 3.6.3
. org.sonatype.plexus/plexus-sec-dispatcher 1.4
X org.codehaus.plexus/plexus-utils 1.5.5 :older-version
. org.sonatype.plexus/plexus-cipher 1.4
. org.apache.maven/maven-builder-support 3.6.3
. org.apache.maven/maven-repository-metadata 3.6.3
. org.apache.maven/maven-artifact 3.6.3
. org.codehaus.plexus/plexus-utils 3.2.1
. org.apache.commons/commons-lang3 3.8.1
. org.apache.maven/maven-plugin-api 3.6.3
. org.apache.maven/maven-model 3.6.3
. org.apache.maven/maven-artifact 3.6.3
. org.eclipse.sisu/org.eclipse.sisu.plexus 0.3.4
. org.codehaus.plexus/plexus-utils 3.2.1
. org.codehaus.plexus/plexus-classworlds 2.6.0
. org.apache.maven/maven-model-builder 3.6.3
. org.apache.maven/maven-resolver-provider 3.6.3
X org.apache.maven.resolver/maven-resolver-impl 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-api 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-spi 1.4.1 :older-version
X org.apache.maven.resolver/maven-resolver-util 1.4.1 :older-version
. org.apache.maven.shared/maven-shared-utils 3.2.1
. commons-io/commons-io 2.5
. org.eclipse.sisu/org.eclipse.sisu.plexus 0.3.4
. javax.enterprise/cdi-api 1.0
. javax.annotation/jsr250-api 1.0
. javax.inject/javax.inject 1
. org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
X org.codehaus.plexus/plexus-component-annotations 1.5.5 :older-version
X org.codehaus.plexus/plexus-classworlds 2.5.2 :older-version
X org.codehaus.plexus/plexus-utils 3.0.17 :older-version
. org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
. com.google.inject/guice$no_aop 4.2.1
. javax.inject/javax.inject 1
. aopalliance/aopalliance 1.0
. com.google.guava/guava 25.1-android
. com.google.code.findbugs/jsr305 3.0.2
. org.checkerframework/checker-compat-qual 2.0.0
. com.google.errorprone/error_prone_annotations 2.1.3
. com.google.j2objc/j2objc-annotations 1.1
. org.codehaus.mojo/animal-sniffer-annotations 1.14
. javax.inject/javax.inject 1
. org.codehaus.plexus/plexus-utils 3.2.1
. org.codehaus.plexus/plexus-classworlds 2.6.0
. org.codehaus.plexus/plexus-component-annotations 2.1.0
. org.apache.commons/commons-lang3 3.8.1
. org.clojure/data.xml 0.2.0-alpha6
. org.clojure/data.codec 0.1.0
. org.clojure/tools.gitlibs 2.1.144
. org.clojure/tools.cli 1.0.206
. com.cognitect.aws/api 0.8.505
. org.clojure/data.json 1.0.0 :newer-version
. org.clojure/tools.logging 1.1.0
. com.cognitect/http-client 0.1.106
. org.clojure/core.async 1.3.610
. org.eclipse.jetty/jetty-client 9.4.36.v20210114
. org.eclipse.jetty/jetty-http 9.4.36.v20210114
. org.eclipse.jetty/jetty-io 9.4.36.v20210114
. org.eclipse.jetty/jetty-util 9.4.36.v20210114
. org.eclipse.jetty/jetty-http 9.4.36.v20210114
. org.eclipse.jetty/jetty-util 9.4.36.v20210114
. org.eclipse.jetty/jetty-io 9.4.36.v20210114
. org.eclipse.jetty/jetty-util 9.4.36.v20210114
. org.clojure/data.xml 0.2.0-alpha6
. org.clojure/core.async 1.3.610
. org.clojure/tools.analyzer.jvm 1.1.0
. com.cognitect.aws/endpoints 1.1.11.969
. com.cognitect.aws/s3 811.2.858.0
. javax.inject/javax.inject 1
. mvxcvi/multihash 2.0.3
. mvxcvi/alphabase 1.0.0
. borkdude/edamame 0.0.11
X org.clojure/tools.reader 1.3.4 :older-version
. com.taoensso/nippy 3.1.1
X org.clojure/tools.reader 1.3.4 :older-version
. com.taoensso/encore 3.9.2
X org.clojure/tools.reader 1.3.3 :older-version
. com.taoensso/truss 1.6.0
. org.iq80.snappy/snappy 0.4
. org.tukaani/xz 1.8
. org.lz4/lz4-java 1.7.1
. lambdaisland/uri 1.11.86
. babashka/fs 0.1.2
. javax.xml.bind/jaxb-api 2.3.1
. javax.activation/javax.activation-api 1.2.0
. http-kit/http-kit 2.5.3
Thats running it in the folder with the deps.edn that only has the nextjournal/clerk entry
thanks, though I’m not seeing a problem yet
Just saw that: https://nextjournal.github.io/clerk-demo/notebooks/semantic.html has a rendering error:
Thanks for the heads up! It works for the latest (released) sha on https://snapshots.nextjournal.com/clerk-demo/build/bd74d652a8dddbdddb42b62fe8043cf1f4b4e65d/notebooks/semantic.html so I think we just need to rebuild it using that
@carsten.behring did you see that hide-result now works with metadata? Though there should be no more cases now (I hope 🤞) where hiding the result is needed for performance reasons thanks to the new print budget
thanks again, fixed now https://nextjournal.github.io/clerk-demo/notebooks/semantic.html
Do you think Clerk can be used for "meta programming" ? I used notebook to "programmatically" generate markdown which generates the html on rendering in notespace. Example: https://scicloj.github.io/scicloj.ml-tutorials/userguide-models.html Every "block" (= the documentation of a model) is autogenerated from "data".
Yes, I went for hiccup generation. It went well, porting was easy. Latest changes of Clerke and nested viewers made certain things possible.
I think this should work.
one of the next things I want to try & build is a var viewer that generates a different view of a namespace, more like what codox or cljdoc generate.
you can certainly generate markdown, code & other things programmatically
Exactly. Which precie markdown dialect does (clerk/md) support ?
though there’s a small known issue where the code viewer when generated right now doensn’t quite have the right size:
we use https://markdown-it.github.io as a markdown parser
with some clojure data layer on top https://github.com/nextjournal/viewers/tree/main/modules/markdown/src/nextjournal
see it in action here https://storage.googleapis.com/nextjournal-snapshots/viewers/build/a20c8b54d1f0b15008d101d7a1ed86dea296d451/index.html#/devcards/nextjournal.viewer.markdown
and we’re working on https://github.com/nextjournal/clerk/pull/62 to make the markdown rendering also completely customizable using the same viewer api. One of the goals is allowing to e.g. switch to MathJax from KaTeX for maths but you can really do anything at that point.
I will give it a try. It looks good, I specialy need support for tables.
please let me know how it goes
Note - if you want to generate something that clerk can show, hiccup might be a better option. I find it's easier to generate data than strings.
Btw, I can really recommend setting up a hotkey for clerk/show! as described in https://github.com/nextjournal/clerk#editor-workflow. I prefer this to working via the file watcher.
I just converted a complex notespace file to clerk, and get this: Uncaught Error: No reader function for tag namespace
(-> 'clojure.core find-ns pr-str read-string)
isn’t that expected if you have a #namespace[,,,] in there?
It could be that somehwere my clojure code prints a namespace... but how to find it
printing shouldn’t be a problem
rendering I meant
no, that should be fine
see:
do you get a stacktrace?
I will try the big file piece-by-piece.
If I find issues, I let you know.
I found an issue converting a techml dataset into a list of maps and try to render this via clerk/table This only works by explicitly converting the "reified" result to seq:
where can I find the api docs for tc/rows?
I’m not sure there’s something actionable there besides changing tc/rows to return something that can be read (if the goal is to display it in a Clerk table)
but given the raw dataset works I don’t see what the benefit would be
It does not happen always....
Not on any dataset object I mean.
interesting…
what happens if you don’t convert it? Should work without the as-maps call I think?
and isn’t ds/info a description of the dataset?
is this a publicly available dataset so I can repro?
It happens after a "second" rendering.
so I think the "cache" does something with it.
I think you can reproduce it with any tech.ml.dataset But it is not on every rendering. It has something to do with the cache,
Putting "seq" before clerk/table fixes is reliably.
cool, thanks, I'll see what's going on there tomorrow
I have a clear notbook which def's a variable 2 times , and uses it: (def a 1) ... ... (def a 2) (+ a 1) I had the impressions that sometimes it renders 2 and sometimes 3. Is this fully supported by the dependency management ?
not supported with caching, yet. Also multiple defs in a block isn’t yet supported:
(do (def a 1) (def b 2))for the latter case we’re at least logging a warning already
This can result in hard to debug wrong calculations. Can we at least detect the first case as well and warn.
sure, could you file an issue?
Thank you!