nextjournal

mkvlr 2022-01-27T16:37:33.983369Z

@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

Carlo 2022-01-27T16:38:49.489709Z

Wow this is awesome! I'll try it out later today 😍

mkvlr 2022-01-27T16:52:42.017349Z

https://clojurians.slack.com/archives/C06MAR553/p1643302352703909

❤️ 2
🎉 5
2022-01-27T18:55:34.196169Z

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

2022-01-27T18:55:49.744909Z

Am I doing something stupid ?

mkvlr 2022-01-27T19:00:45.701059Z

I hope I didn't do something stupid and release a broken thing 😓 will try this in a bit

mkvlr 2022-01-27T19:03:31.786649Z

though https://github.com/nextjournal/clerk-demo was also green on CI. Can you try if that works for you?

2022-01-27T19:10:31.653079Z

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

2022-01-27T19:11:09.252179Z

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: 1

2022-01-27T19:11:27.676339Z

must be something wrong on my end

2022-01-27T19:13:34.764479Z

That sha for the jackrusher/mundaneum is correct.

2022-01-27T19:16:10.240309Z

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.

mkvlr 2022-01-27T19:16:25.915979Z

can you try upgrading your clojure cli? Older versions do not understand the namespaced sha

2022-01-27T19:17:42.962049Z

but all the clerk stuff works on this project, I can eval (clerk/show!) and see it in the browser 🙂

😅 1
2022-01-27T19:17:57.020539Z

I'll look to upgrade my clojure

🙏 1
2022-01-27T19:18:05.378779Z

thank you

mkvlr 2022-01-27T19:19:37.025129Z

still curious to learn what could cause the error on the sample project

2022-01-27T19:23:59.277299Z

Yeah, my deps.edn is literally just

{:paths ["src" "resources"]
 :deps {io.github.nextjournal/clerk {:mvn/version "0.5.346"}
        }}

2022-01-27T19:24:02.343289Z

Is that sufficient ?

mkvlr 2022-01-27T19:41:07.882109Z

@qmstuart nope, that works here…

mkvlr 2022-01-27T19:42:16.310229Z

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

mkvlr 2022-01-27T19:42:24.596709Z

what does this bring in for you?

2022-01-27T19:43:53.314369Z

(base) [19:43]: stuart@stuart-Z87M-D3H:~$ clj -X:deps tree | head
Unqualified function can't be resolved: tree

2022-01-27T19:43:58.819209Z

I'm on Ubuntu if that matters

mkvlr 2022-01-27T19:48:18.046109Z

clj -Stree I think it is for older cli versions

2022-01-27T19:51:50.847729Z

(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

2022-01-27T19:52:08.009269Z

Thats running it in the folder with the deps.edn that only has the nextjournal/clerk entry

mkvlr 2022-01-27T19:54:35.961919Z

thanks, though I’m not seeing a problem yet

2022-01-27T19:42:30.669619Z

Just saw that: https://nextjournal.github.io/clerk-demo/notebooks/semantic.html has a rendering error:

✅ 1
mkvlr 2022-01-27T19:46:06.723769Z

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

mkvlr 2022-01-27T19:47:03.114659Z

@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

👍 1
mkvlr 2022-01-27T20:12:01.187349Z

thanks again, fixed now https://nextjournal.github.io/clerk-demo/notebooks/semantic.html

2022-01-27T19:49:52.056579Z

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

2022-02-01T22:18:55.713649Z

Yes, I went for hiccup generation. It went well, porting was easy. Latest changes of Clerke and nested viewers made certain things possible.

👍 1
mkvlr 2022-01-27T19:52:11.161759Z

I think this should work.

mkvlr 2022-01-27T19:53:16.318039Z

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.

mkvlr 2022-01-27T19:55:54.992639Z

you can certainly generate markdown, code & other things programmatically

2022-01-27T19:56:26.550599Z

Exactly. Which precie markdown dialect does (clerk/md) support ?

mkvlr 2022-01-27T19:56:30.945629Z

though there’s a small known issue where the code viewer when generated right now doensn’t quite have the right size:

mkvlr 2022-01-27T19:57:09.893339Z

we use https://markdown-it.github.io as a markdown parser

mkvlr 2022-01-27T19:57:59.505499Z

with some clojure data layer on top https://github.com/nextjournal/viewers/tree/main/modules/markdown/src/nextjournal

mkvlr 2022-01-27T19:59:34.107869Z

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.

2022-01-27T20:14:11.108289Z

I will give it a try. It looks good, I specialy need support for tables.

👍 1
mkvlr 2022-01-27T20:14:40.402019Z

please let me know how it goes

teodorlu 2022-01-27T21:57:33.613349Z

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.

💯 2
mkvlr 2022-01-27T20:13:54.103679Z

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.

👍 1
➕ 1
2022-01-27T20:14:47.072119Z

I just converted a complex notespace file to clerk, and get this: Uncaught Error: No reader function for tag namespace

mkvlr 2022-01-27T20:16:29.288169Z

(-> 'clojure.core find-ns pr-str read-string)

mkvlr 2022-01-27T20:17:09.011529Z

isn’t that expected if you have a #namespace[,,,] in there?

2022-01-27T20:18:12.772889Z

It could be that somehwere my clojure code prints a namespace... but how to find it

mkvlr 2022-01-27T20:18:26.615819Z

printing shouldn’t be a problem

2022-01-27T20:18:43.871729Z

rendering I meant

mkvlr 2022-01-27T20:18:51.372539Z

no, that should be fine

mkvlr 2022-01-27T20:22:17.480049Z

see:

mkvlr 2022-01-27T20:26:04.626669Z

do you get a stacktrace?

2022-01-27T20:26:52.707719Z

I will try the big file piece-by-piece.

2022-01-27T20:27:10.919789Z

If I find issues, I let you know.

🙏 1
2022-01-27T21:21:00.731379Z

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:

mkvlr 2022-01-28T16:00:44.400799Z

where can I find the api docs for tc/rows?

mkvlr 2022-01-28T16:03:52.194629Z

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)

mkvlr 2022-01-28T16:04:33.536439Z

but given the raw dataset works I don’t see what the benefit would be

2022-01-27T21:21:26.776389Z

It does not happen always....

2022-01-27T21:22:31.032779Z

Not on any dataset object I mean.

mkvlr 2022-01-27T21:23:46.610179Z

interesting…

mkvlr 2022-01-27T21:24:05.149009Z

what happens if you don’t convert it? Should work without the as-maps call I think?

mkvlr 2022-01-27T21:24:51.472919Z

and isn’t ds/info a description of the dataset?

mkvlr 2022-01-27T21:25:32.491229Z

is this a publicly available dataset so I can repro?

2022-01-27T21:37:14.131619Z

It happens after a "second" rendering.

2022-01-27T21:37:29.418349Z

so I think the "cache" does something with it.

2022-01-27T21:41:44.768189Z

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,

2022-01-27T21:43:03.972199Z

Putting "seq" before clerk/table fixes is reliably.

2022-01-27T21:43:43.140999Z

mkvlr 2022-01-27T21:47:26.822019Z

cool, thanks, I'll see what's going on there tomorrow

2022-01-27T21:58:26.083659Z

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 ?

mkvlr 2022-01-28T08:57:41.636979Z

not supported with caching, yet. Also multiple defs in a block isn’t yet supported:

(do (def a 1) (def b 2))

mkvlr 2022-01-28T08:58:31.952309Z

for the latter case we’re at least logging a warning already

2022-01-28T21:46:03.876399Z

This can result in hard to debug wrong calculations. Can we at least detect the first case as well and warn.

mkvlr 2022-01-28T21:49:21.411389Z

sure, could you file an issue?

mkvlr 2022-01-30T20:30:17.424339Z

Thank you!