This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-30
Channels
- # announcements (31)
- # aws (17)
- # babashka (26)
- # babashka-sci-dev (8)
- # beginners (16)
- # biff (1)
- # calva (9)
- # cider (5)
- # clj-kondo (3)
- # clj-on-windows (38)
- # cljdoc (2)
- # cljs-dev (9)
- # cljsrn (6)
- # clojure (58)
- # clojure-europe (47)
- # clojure-nl (3)
- # clojure-norway (21)
- # clojure-uk (2)
- # clojurescript (25)
- # conjure (2)
- # data-science (7)
- # datomic (3)
- # emacs (12)
- # events (5)
- # fulcro (5)
- # honeysql (10)
- # introduce-yourself (7)
- # lsp (4)
- # meander (3)
- # nbb (18)
- # off-topic (28)
- # rdf (1)
- # releases (2)
- # sci (5)
- # shadow-cljs (23)
- # sql (5)
- # test-check (3)
Hi everyone, So i want to reload this namespace to REPL
(ns reporting-example.reports
(:require [reporting-example.db.core :as db]
[clj-pdf.core :refer [pdf template]]))
but when i want to use the pdf
function after i reload that namespace to REPL, why it's says Unable to resolve symbol: pdf in this context
?
And if i do load file in REPL
the error goes to :
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2633).
Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
I already restart all the applications, but nothing happen. Btw, I use Intellij IDEA Community Edition with Cursive and nREPL run with Leiningen.if you’re using leiningen, does it work if you just run lein repl
at the command line and load the namespace in the repl?
Hey thanks! Sorry for the late reply. Yeah, you right, i think the problem that I've encountered is I have headless jdk, and it solved by :
$ sudo apt install openjdk-11-jdk
and run
$ ldd /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
I hope this help anyone who encountered the same problem, Thanks again!Hello, is there a library I can use to convert HTML to markdown? I found https://github.com/yogthos/markdown-clj but I think this one only converts markdown to html and not the other way around. My use case is that I want to convert html e-mails into markdown files, I already could parse into plain text using https://github.com/owainlewis/clojure-mail, but when converting to plain text I lose the all the formatting such as line breaks.
HTMl -> Markdown might not always be possible. Markdown only has sigils for a subset of HTML tags. Having said that, you could use Hickory to parse HTML into Hiccup and then render that into Markdown yourself maybe? https://github.com/clj-commons/hickory
Another useful tool you should consider is bootleg https://github.com/retrogradeorbit/bootleg
I've come to rely heavily on https://pandoc.org/ for all things markdown, HTML and org-mode. You'll find it in homebrew and packaged for most linux distributions.
$ pandoc -f markdown -t html <<< "# My heading"
<h1 id="my-heading">My heading</h1>
$ pandoc -f html -t markdown <<< '<h1>To action!</h1><p>We like actions.</p>'
# To action!
We like actions.
Here's how to shell out to pandoc with https://github.com/babashka/process to convert org-mode to html:
(require '[babashka.process :refer [process]])
(defn pandoc-org->html
"String -> String, Org-mode to HTML"
[org-markup]
(slurp (:out (process
'[pandoc --from org+smart --to html --standalone]
{:in org-markup}))))
where you can adapt --from
and --to
to your liking for markdown.Downside with pandoc: there's a binary to install; not a JVM package that "just works".
yeah I always used pandoc
and it worked great, I don’t really mind having a separate binary to install but I was not aware you could actually call a shell command from clojure, that’s really interesting, thanks!
do you know if I can use any library from clj in babashka? right know I am using babasha/fs
in my jvm project, but if I can run clojure-mail
on babashka then I can build my solution entirely with babashka and that would be nice
I also just learned that clojure.java.shell` is a thing reading babshka process README
> do you know if I can use any library from clj in babashka?
>
No - unfortunately, not all clojure libraries work on babashka.
babashka/fs
is written specifically to support both JVM Clojure and babashka, though. So in that case, the code should be exactly the same.
Or you can use clojure.java.shell
as you noted 🙂
yeah, but most of my program is parsing/reading emails with clojure-mail
, so I my app will have to run on jvm, but no problem, babashka.process seems very promising I will try it out, thanks for the help
I've been using this for html->markdown: https://github.com/furstenheim/copy-down I use it to render a text version of the html emails I send. I honestly never look at the output though ha ha so I'm not sure how good of a rendering it is, but worth looking at at least.
Thanks! I will check it out