Fork me on GitHub

has anyone out there figured out how to automatically klipse-ify code blocks in posts generated by cryogen? I'm thinking that probably the easiest thing to do would be to just stick in some javascript at the end to automatically add klipse classes to all code blocks, but if there's a more straightforward way I'd love to hear it...


oooh, actually, it looks like highlight.js automatically adds classes like "hljs clojure" to code blocks, so it might be as easy as just configuring klipse to look for that.


(although with multiple languages, I'm not sure that would work. does klipse_settings.selector take an array of css selectors?


interesting. using class selectors doesn't seem to work, but selecting code elements does...


ok, the solution is apparently to just put straight html in the markdown and give it a code tag with a klipse class, rather than using the markdown triple-backquote syntax

Yehonathan Sharvit16:10:35

@mynomoto regarding github cache if raw files - usually it works, sometimes I’m appending url params for cache busters you know ?fsafdsfsf etc...

Yehonathan Sharvit16:10:54

Also, opening dev tools and selecting cache=false


I tried disabling cache on dev tools but that wasn't working. I will try adding the query parameter next time, thanks!

Yehonathan Sharvit18:10:32

@gowder why the markdown triple-backquote syntax didn’t work?

Yehonathan Sharvit18:10:45

can you share an html page with the issue

Yehonathan Sharvit18:10:24

Can u try to use ~~~klipse?


I'll give it a shot in a bit. My guess is that the cryogen markdown parser was doing something funny with the classes when it wraps code blocks in <pre> and <code>. The workaround that I just went with is to just use, e.g.,

<code class="clojure">
((comp (partial apply +) (partial map (partial * 3))) [1 2 3])
in the markdown file, and then pass that class to window.klipse_settings


the only weird behavior I see with that is that the linebreak after the code tag adds extraneous whitespace in python code blocks, so I'm doing things like

<code class="python">print [x.upper() for x in ["foo", "bar"]]
in order to avoid having an error in klipse

Yehonathan Sharvit18:10:54

what’s your use casse?


@viebel a blog. But actually, it looks like I can get it working by applying appropriate classes in the markdown code block, as per your suggestion. --- source behaves appropriately, where "clojure" is given as a class in the markdown block and is specified in window.klipse_settings Interestingly, python works fine that way too, and doesn't include extraneous whitespace with markdown, even though it does include extraneous whitespace with a html code tag. I think my original issue, which led me to think that class identification wasn't working, was to try to piggyback the klipse selectors off the classes that highlight.js code identification was doing. And that just flat out was not working... possibly because of some weird javascript async thing involving the order the classes were added or something.

Yehonathan Sharvit18:10:02

Yeah! You should let klipse do its job before highlight.js enters in action!


oh, actually, while we're here: it might be worth noting that pages served over https don't work with loading klipse from -- it looks like you're only serving http there, and modern browsers reject the mixed requests on security grounds. I ended up just hosting local copies of all the javascript and css. (also, the readme doesn't have information for python evaluation, just the other languages) Also, for anyone else interested, interesting strategy I'm trying out is to only load klipse plus all the plugins on posts that have executable code, just by adding a variable to posts. See lines 99-103 of Having so much fun with klipse. this is a freaking amazing innovation. thank you so much for writing it.

Yehonathan Sharvit18:10:03

I’m aware of the issue with https, the solution is to use instead of as specified in


oops. missed that altogether. thanks! 🙂

Yehonathan Sharvit18:10:42

I would recommend not to host klipse locally - as you won’t enjoy the automatic upgrade of new klipse versions

Yehonathan Sharvit18:10:08

I’m trying to maintain a pretty high pace of features


I'm not one to object to a pretty high pace of features 🙂

Yehonathan Sharvit18:10:29

I mean - if you download a local version, your blog wont’ get the new features automatically



Yehonathan Sharvit18:10:37

How did you discover about python?


somewhere floating around in the repo or the blog I think you've got a demo page with plugins for each language. I just grabbed the code from there

Yehonathan Sharvit18:10:13

The reason I didn’t make python official yet is...

Yehonathan Sharvit18:10:41

…that I didn’t find a way to make variables shared between code snippets @gowder

Yehonathan Sharvit18:10:00

I think it make the whole stuff much less useful


Ooooooh. Makes sense. I still think it's pretty useful though, at least for my purposes (occasionally comparing small chunks of code in different languages)

Yehonathan Sharvit18:10:56

I might include it in the README

Yehonathan Sharvit18:10:09

a PR would be much welcome!

Yehonathan Sharvit19:10:49

It’s a nice start!


@viebel yeah, it is, but only really simple stuff works and I think the work to make other things work will be huge.

Yehonathan Sharvit20:10:10

You mean to make hoplon self-host compatible?


Yeah, actually the problem should be javelin that is a lib that hoplon depends on. I'm uncertain about how to fix macros that depends on jvm namespaces even when those are available in cljs.

Yehonathan Sharvit20:10:00

Do you need to access those macros directly inside klipse?


Yeah for the reactive part.


Main on missing is cell= but there is more good macro stuff there that used by users directly.

Yehonathan Sharvit20:10:43

So, you need to port the macros to clojurescript

Yehonathan Sharvit20:10:57

There is the same problem with core.match


The fun part is that javelin was supposed to work on clojure also but atm it only works on cljs. Maybe I can make it work on both when trying to port the macros.