-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Pandoc in Termux
Pandoc’s precompiled, static ARM binary works with Termux the terminal emulator app for Android:
To make pandoc
available in Termux follow the steps below.
-
Create the directory
${HOME}/bin
and put it in yourPATH
if you haven’t done so already. -
Download the ARM
.tar.gz
archive from Pandoc’s release page. -
Unpack the archive. (
tar -xzvf <archive>
) -
cd
to thebin
subdirectory in the unpacked directory. -
mv
orcp
thepandoc
binary to${HOME}/bin
(mv pandoc ${HOME}/bin
). -
Do
cd ${HOME}/bin
-
Make sure
pandoc
is executable (chmod +x pandoc
). -
WARNING! Pandoc’s interactive Lua mode doesn’t work in Termux. It hangs the session and the only way out is to kill Termux in Android’s Settings/Apps interface.
pandoc lua <filename>
works fine! -
You may want to define an environment variable with the path to the default Pandoc data directory..In my
~/.zshenv
file I haveexport PDC_DATA_DIR="$HOME/.local/share/pandoc"
; others may want to put it in~/.bashrc
. Don’t forget tomkdir -p $HOME/.local/share/pandoc/filters
etc. -
You may not want to install LaTeX support which requires some huge packages. IMO the best way to produce PDF with Pandoc in Termux is html/weasyprint. There is no Termux package for weasyprint so you will have to install Python 3 and [other dependencies][] and install it with
pip.install weasyprint
. -
If you are using filters
- You may want to make sure
luarocks
is installed. - You want to set your
LUA_PATH
variable properly. - External C libraries don’t work with Lua via the static pandoc binary. The helper modules included with pandoc are pretty comprehensive though, and pipes work fine, so you may be able to work around some limitations with external tools and scripts. Note in particular that you can create and pass around JSON to/from external scripts.
- You may want to make sure