Write your exam with Markdown + AsciiMath, deliver a PDF
I sometimes need to write documents with equations in it. Word is way too cumbersome to use. LaTeX is awesome but complex. Why not just use the simplicity of Markdown syntax and intuitiveness of AsciiMath ? That's what this little bash script provides.
Clone the repo:
$ git clone --recursive https://github.com/pldiiw/examdown.git
First, check that you have all the dependencies:
$ make -s checkdeps
getopt from util-linux 2.28.2
cmark 0.27.1 - CommonMark converter
wkhtmltopdf 0.12.3.2
vendor/github-markdown-css/github-markdown.css
vendor/MathJax/MathJax.js
If the output looks like this, then you have all the dependencies needed.
If cmark
is missing, two recipes are provided to help you obtain it:
$ make -s build-cmark
$ sudo make -s install-cmark
If wkhtmltopdf
is missing, install it with your favorite package manager,
like apt
:
$ sudo apt install wkhtmltopdf
If the two last ones are missing, just run these two commands:
$ git submodule init
$ git submodule update --recursive
Now that you have all the dependencies, run make -s build
to set up the hierarchy
needed for examdown to work.
$ make -s build
From there, you can run the tests to check that everything is ok:
$ make -s test
If the tests went right, you can now install the hierarchy generated by our
build recipe to /usr/local
by default:
$ sudo make -s install
If you wish to install it somewhere else, just override the PREFIX
variable:
$ make -s install PREFIX="$HOME/.local"
If you installed examdown to some gloomy path, like above, be sure that the
bin
folder where examdown
lies is in your $PATH
variable.
Check that the installation worked:
$ examdown --help
You're done!
If you want to uninstall examdown, use the uninstall
recipe:
$ sudo make -s uninstall
Do not forget to specify the PREFIX
variable again if you modified it during
the installation.
The following syntax is supported in the Markdown files:
- CommonMark: http://commonmark.org/help/
- Tables: https://github.github.com/gfm/#tables-extension-
- Strikethrough: https://github.github.com/gfm/#strikethrough-extension-
- Autolinks: https://github.github.com/gfm/#autolinks-extension-
- Underlining using
~~
:~~I'm underlined~~
- Equations using AsciiMath: http://asciimath.org/ -- equations are delimited
using
$
:$x^2$
See test/test.md for an example.
$ examdown --help
Markdown + AsciiMath -> PDF
Usage:
examdown [options] <input-file>
Options:
-o, --out <file> - Save output to <file>. Defaults to 'out.pdf'.
-O - Save output to a file with the same name and
in the same directory as the input file.
-s, --css <file> - Use <file> as the CSS for the output document.
If unspecified, will use a built-in CSS file.
-t, --title <title> - Set title of document to <title>.
-d, --delay <ms> - Wait specified amount of milliseconds for the
javascript to render the math equations.
Defaults to 3000.
-h, --help - Display this help notice.
Any suggestion or improvement is welcome!
Open an issue and we will discuss about it!
For the code style, please stick to Bahamas10' Bash Style Guide and use Shellcheck as a linter.
This repository is under the Unlicense, see LICENSE file for more information.