April 5, 2019
Using CriticMarkup with pandoc. It serves both as a wrapper and a pre-processor.
Install using
pancritic provides a pandoc-like cli. Pandoc users will feel right at home. See help from
A typical use of pancritic will be like
--engine
The default engine is markdown
. Valid options are markdown
, markdown2
, panflute
, pypandoc
. You need to install the respective package in order to use them. markdown
and markdown2
are pure Python, hence useful for other CPU architechture. panflute
and pypandoc
both uses pandoc as backend.
-m
|--critic-mode
a/accept, r/reject: accept/reject changes.
-m m
should be used with LaTeX output.
This is completely rewritten in Python. The cli has been completely changed too. The former options of -a
, -r
, -d
are replaced with -m a
, -m r
, -m d
, and added a -m m
.
criticParser_CLI.py
This is a heavy fork of criticParser_CLI.py
, with these differences:
Examples,
criticParser_CLI.py input.md -m2 -o output.html --css css.html
# is equivalent to
pancritic -o output.html input.md --critic-template css.html --engine markdown2
A somewhat surprising behavior is when the to-format and output extension is different. In pancritic, the to-format indicates the CriticMarkup parsing behavior (mainly tex vs. html). And the output extension controls the final output’s format (e.g. markdown, html, etc.)
An interesting use of this is to use pancritic as a pandoc preprocessor instead, like this
This will be useful if more advanced pandoc args are needed.
Nesting CriticMarkup might have unexpected behavior, especially in LaTeX output. See the caveats section in the spec of CriticMarkup.
mainly tested with HTML and LaTeX output. RST output almost works, but injecting CSS/JS into the output causes some problems. Currently, it can be get arround with --critic-template
and injecting the CSS/JS manually. See pancritic/template.py
for the template used.
Note that the LaTeX output requires the LaTeX packages changes>=3
.1
One can tell pandoc to use this package by either using a custom template or --include-in-header
option. Or you can use the trick of putting the following in your YAML front matter, like this file:
Markdown within the CriticMarkup will not be rendered in LaTeX output. If you want to change this behavior, you can take a look at: LaTeX Argument Parser.
CriticMarkup | LaTeX |
---|---|
{--[text]--} |
\deleted{[text]} |
{++[text]++} |
\added{[text]} |
{~~[text1]~>[text2]~~} |
\replaced{[text2]}{[text1]} |
{==[text]==} |
\highlight{[text]} |
{>>[text]<<} |
\comment{[text]} |
The version of the package in TeXLive 2018 is still v2. TeXLive 2019 should be available on 2019-4-30, meanwhile you need to
# sudo is needed in most cases, depending on where you put it
sudo tlmgr update --self
sudo tlmgr update changes
# check it is >=3
tlmgr info changes