A Clojure powered CLI tool and library for performing moderately complex Markdown to PDF document generation. A great tool for those who desire simple semi-programmatic document creation. Store your content in Markdown, style your document with CSS / fonts, set your document properties with readable EDN files.
You need to install the JRE 1.8+ in order to run this tool. For development it is expected you have JDK 1.8+ and a build tool (i.e. Leiningen or Clojure 1.9+). You will need Leiningen to directly work and/or contribute to this project.
You can now try a run by doing:
java -jar /path/to/clj-md2pdf-<version>.jar /path/to/output/pdf /path/to/markdown/file(s)
You can also create an alias for java -jar /path/to/clj-md2pdf-<version>.jar
so this can be used more conveniently with the CLI. The way to
achieve depends on the OS you are using.
Linux
# Add to your .<shell>rc, e.g. .bashrc if you are using bash
alias clj-md2pdf='java -jar /path/to/clj-md2pdf-<version>.jar'
Planning on releasing to clojars.org repositories in the near future, so stay tuned!
Note: You will need Leiningen for this method of installing.
First clone the GitHub repository:
git clone https://github.com/michael-valdron/clj-md2pdf.git
Fetch dependencies by:
lein deps
To package up in JAR for library use do the following:
lein jar
You can install this locally to your ~/.m2
directory for regular
dependency use in your Clojure projects by performing the following:
lein install
Then you can include in your Leiningen project's project.clj
like so:
(defproject ...
...
:dependencies [...
[clj-md2pdf "x.x.x"]
...]
...)
The usage section I will assume an alias
named clj-md2pdf
, if you
are using java -jar /path/to/clj-md2pdf-<version>.jar
just replace
clj-md2pdf
with this.
To render a simple Markdown into a PDF perform the following:
clj-md2pdf output/pdf markdown/file
You can use multiple Markdown files too:
clj-md2pdf output/pdf markdown/file1 markdown/file2 ...
Note: When passing multiple Markdown files keep in mind that the order that you specify these files is the same order that they are rendered in the PDF file.
More docs to come..
Documentation coming soon..
README.md
with current contentfn
lists supplied with objects.edn
fileCopyright © 2020 Michael Valdron
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close