3 ms·
I've successfully used it from Clojure (I think it's through JRuby). With a few lines of code you can configure AsciiDoctor to whatever you need. It's way easie
by geokon 4y ago
I've successfully used it from Clojure (I think it's through JRuby). With a few lines of code you can configure AsciiDoctor to whatever you need. It's way easier than fiddling at the command-line (I couldn't immediately understand how to get extensions and how it played with whatever version of the software I got through `apt`). It'd be good to have alternatives just for the sake of it - but I didn't find anything particularly lacking
Here is how I made some reveal slides
(import [org.asciidoctor
Asciidoctor
OptionsBuilder
SafeMode])
(let [input-file (clojure.java.io/file
"path/to/adoc/file")
adoctor (org.asciidoctor.Asciidoctor$Factory/create)
reveal-option (doto
(org.asciidoctor.OptionsBuilder/options)
(.backend
"revealjs")
(.safe
org.asciidoctor.SafeMode/UNSAFE)
(.attributes
(.attribute
(org.asciidoctor.AttributesBuilder/attributes)
"revealjsdir"
"../reveal.js")))]
(.requireLibrary
adoctor
(into-array
String
["asciidoctor-revealjs"]))
(.convertFile
adoctor
input-file
reveal-option))
You get all the codez from Maven so you don't need to install anything on your system
{'org.asciidoctor/asciidoctorj-revealjs {:mvn/version "5.0.0.rc1"}
'org.asciidoctor/asciidoctorj-pdf {:mvn/version "1.6.2"}
'org.asciidoctor/asciidoctorj {:mvn/version "2.5.3"}
The maintainers seem very responsive and active on Github. It's not as nice as a spec and multiple implementations - and I guess you're locked in to one library, but at least it's not as bad as Orgmode - where you're locked in to an editor as well
- toastal 4y agoYes, the maintainer is great. I have at this point just used Nix and post-processed Asciidoctor instead of trying any sort of other tools, but it gets tricker as you noted if you want to use it inside something else. It's not a compiled binary nor is it a C lib other languages could get at. Much of that could be attributed to the spec being quite.