Last updated:
0 purchases
pandoctools 2.8.0.5
Pandoctools
CI Artifacts
Pandoctools is a combination of tools that help write reproducible markdown reports. They rely on Pandoc and Jupyter kernels.
Introduction articles:
Best Python/Jupyter/PyCharm/VSCode experience + report generation with Pandoc filters.
Convenient and easily tweakable Atom+Markdown+Pandoc+Jupyter experience (can export to ipynb).
“Glueing” part of pandoctools is a profile manager of text processing pipelines. It stores short crossplatform bash scripts that define chain operations over text. They are mostly Pandoc filters but any CLI text filter is OK.
Update instructions
(Update instructions to v.2.8.0.2)
v2.8.0.2 is not backward compatible,
Default.html was changed and Default_args depends on this new changes (see custom bash functions).
$mathjax var changed meaning, ${mathjax_url} and ${extra_inputs} were removed. But profiles can be easily fixed. Uninstall Pandoctools before updating. Update your custom bash scripts as names and logic changed. References: Default_args, Default (profile), Default_pipe,
fix custom pipes: add --pipe arg to pandoc-crossref (see this for details),
Contents
Pandoctools
Update instructions
Contents
Notable parts of Pandoctools
Examples
Install
Useful tips (reload imported modules in Hydrogen, Python kernel, R kernel, Typescript kernel)
Alternatives to R Markdown (Markdown-based Literate Programming)
Notable parts of Pandoctools
Pandoc, Jupyter, pandoc-crossref (dependence) - classical tools.
Pandoctools CLI app (integrated): profile manager of text processing pipelines. It stores short bash scripts - called profiles - that define chain operations over text. They are mostly Pandoc filters but any CLI text filter is OK. Profiles can be used to convert any document of choise in the specified manner.
Knitty (dependence): Jupyter power in plain Python/Julia/R/any-kernel-lang. Jupyter kernels output as Pandoc filter. Insert python code (or other Jupyter kernel code) to the Markdown document or write in plain Python/Julia/R with block-commented Markdown and have code's results in the output document. Stitch/Knotr fork: reproducible report generation tool via Jupyter, Pandoc and Markdown. Can export to .html, .pdf, Jupyter .ipynb notebooks and any other Pandoc output formats. You can use ipynb-py-convert to convert .ipynb to .py to use with Knitty.
SugarTeX (dependence): SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX.
Pyppdf (dependence): Pyppeteer PDF. Prints html output to pdf via patched Pyppeteer.
Prism.js and github-markdown-css (integrated): used for default to PDF conversion (but with borrowing from Default_args to custom profile you can use them with to HTML conversion too).
libsass-python (dependence): tweak and write css with more convenient sass or scss (see Default.sass).
Open Fonts (dependence): A collection of beautiful free and open source fonts + Unicode fallback chains. With it you can use all fonts listed there in your CSS (except CJK) out of the box and without installing those fonts into OS.
(optional) Tabulate Helper converts tabular data like Pandas dataframe to GitHub Flavored Markdown pipe table.
(optional) Matplotlib Helper: custom helper to tune Matplotlib experience in Atom/Hydrogen and Pandoctools/Knitty.
(optional) Feather Helper: concise interface to cache numpy arrays and pandas dataframes.
(optional) pypugjs: Write HTML via Pug that is much more readable.
Pandoctools is a tool for converting markdown document. But we also need tools for writing markdown and deploying python/Jupyter code blocks.
And the best one for it is:
Atom editor with plugins. It helps easily type Unicode, interactively run highlighed python/Jupyter code blocks and instantly see results (+ completions from the running Jupyter kernel), can convert basic pandoc markdown to html with live preview.
Must have plugins: SugarTeX Completions, Unix Filter, Hydrogen.
Examples
NEW: see automatically generated examples documents (by Travis CI) of the latest Pandoctools version in CI Artifacts (generated on Windows, macOS and Ubuntu).
Here are examples that demonstrate converting documents:
from markdown .md with Jupyter python code blocks, SugarTeX math and cross-references to .ipynb notebook and to PDF.
from Hydrogen/python notebook .py with Atom/Hydrogen code cells, Knitty markdown incerts (again with SugarTeX math and cross-references) to .ipynb notebook and to PDF.
Examples are given for to .ipynb and to .pdf conversion but Pandoctools surely capable of conversion to .html, .md.md or any Pandoc output format.
Extras:
If you need to capture Matplotlib plots please see matplotlibhelper (the approach showed in examples there can be used with other plot libraries).
If you need to autonumber sections see pandoc-crossref or this SE question
If you need criticmarkup support please consider using git repository with git-time-machine for tracking changes, <!-- html comments --> for adding notes, pigments for highlighting text.
Install
Windows notice!
Install 64-bit Git Bash. Main installer there would work out of the box and is a recommended option.
Alternatives: Portable installer would require seting win_bash value in the %APPDATA%\pandoc\pandoctools\Defaults.ini (after it was autocreated by pandoctools-ready). You can also install conda packages with bash to the environment with pandoctools: either conda-forge::git or pkgs/msys2::posix.
If you have an antivirus then the first or two runs may fail - there may be errors like "Permission denied" because of the antivirus checking all the components.
Linux notice!
If on Ubuntu additionally install (Chrome headless doesn't launch on Unix):
sudo apt-get update
sudo apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
macOS notice!
If on macOS 10.13 you should use "py-pandoc-crossref<0.3.6.3". You can modify CLI command into pandoctools "py-pandoc-crossref<0.3.6.3" or istall additionally after the main installation (conda install -c defaults -c conda-forge xxx or pip install xxx). That is the latest version that supports both panflute and macOS 10.13 (though it has this bug).
Short instructions:
Either install 64-bit Miniconda3 and:
conda install -c defaults -c conda-forge pandoctools
Or install 64-bit Python and:
pip install pandoctools
Then:
pandoctools-ready
But it's recommended to create a dedicated environment for the Pandoctools. See below.
Via conda
Create "pandoctools" conda environment (do not set custom prefix unless you want to set root_env in the config):
(on Unix):
cd $root_miniconda_prefix
source ./bin/activate base
conda config --add channels conda-forge
conda config --add channels defaults
conda update conda
conda create -n pandoctools pandoctools
source activate pandoctools
pandoctools-ready
(on Windows):
cd /d %root_miniconda_prefix%
call .\Scripts\activate base
conda config --add channels conda-forge
conda config --add channels defaults
conda update conda
conda create -n pandoctools pandoctools
call activate pandoctools
pandoctools-ready
Just in case: the right way to remove conda environment 'myenv' is to run:
conda remove -n myenv --all
conda env remove -n myenv
(in this particular order)
Via pip
Create pandoctools venv environment:
(on Unix):
cd $root_python_prefix
./bin/python -m venv ./envs/pandoctools
source ./envs/pandoctools/bin/activate
pip install pandoctools
pandoctools-ready
(on Windows):
cd /d %root_python_prefix%
.\python -m venv .\envs\pandoctools
call .\envs\pandoctools\Scripts\activate
pip install pandoctools
pandoctools-ready
In contrast with conda installation Jupyter notebooks in pip do not support activated python kernels (there is a strange bug).
Useful tips (reload imported modules in Hydrogen, Python kernel, R kernel, Typescript kernel)
Useful tips
Alternatives to R Markdown (Markdown-based Literate Programming)
Alternatives to R Markdown
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.