Skip to main content

Fast CriticMarkup preprocessor with multiple output formats.

Project description

criticmarkup

Fast CriticMarkup preprocessor with multiple output formats (AsciiDoc, Markdown, LaTeX).

Install

With uv:

uv tool install criticmarkup

With pip:

python -m pip install criticmarkup

Dev install (uv)

uv sync --extra dev

Usage

Convert a file (format inferred from extension):

criticmarkup convert input.md --in-place

Read from stdin, write to stdout:

cat input.md | criticmarkup convert --format markdown

Override a preset template:

criticmarkup convert input.md --addition-replacement-template "<ins>{CURRENT}</ins>"

Change list placeholder

If the input contains {+-~TOC-CHANGES~-+}, it will be replaced with a generated list of change IDs/notes.

Examples

Markdown → Markdown

Input (doc.md):

Intro paragraph.

{+-~TOC-CHANGES~-+}

We {++add new text++} here.
We {--remove old text--} here.
We {~~replace this~>with that~~} here.
We can {==highlight==} something.
And leave a {>>reviewer note<<} comment.

Command:

criticmarkup convert doc.md --in-place

Output (doc.md):

Intro paragraph.

- [addition-1](#addition-1): Added "add new text"
- [deletion-1](#deletion-1): Deleted "remove old text"
- [substitution-1](#substitution-1): Changed "replace this" to "with that"

We <a id="addition-1"></a><!-- Added "add new text" -->
<ins>add new text</ins> here.
We <a id="deletion-1"></a><!-- Deleted "remove old text" -->
<del>remove old text</del> here.
We <a id="substitution-1"></a><!-- Changed "replace this" to "with that" -->
<del>replace this</del><ins>with that</ins> here.
We can <mark>highlight</mark> something.
And leave a <!-- reviewer note --> comment.

AsciiDoc → AsciiDoc

Input (doc.adoc):

Intro paragraph.

{+-~TOC-CHANGES~-+}

We {++add new text++} here.
We {--remove old text--} here.
We {~~replace this~>with that~~} here.
We can {==highlight==} something.
And leave a {>>reviewer note<<} comment.

Command:

criticmarkup convert doc.adoc --in-place

Output (doc.adoc):

Intro paragraph.

- <<addition-1>>
- <<deletion-1>>
- <<substitution-1>>

We [[addition-1, Added "add new text"]]
[red]#*add new text*# here.
We [[deletion-1, Deleted "remove old text"]]
footnote:[In previous version this said "remove old text"] here.
We [[substitution-1, Changed "replace this" to "with that"]]
[red]#*with that*#
footnote:[In previous version this said "replace this"] here.
We can [yellow]#highlight# something.
And leave a footnote:[reviewer note] comment.

LaTeX → LaTeX

Input (doc.tex):

Intro paragraph.

{+-~TOC-CHANGES~-+}

We {++add new text++} here.
We {--remove old text--} here.
We {~~replace this~>with that~~} here.
We can {==highlight==} something.
And leave a {>>reviewer note<<} comment.

Command:

criticmarkup convert doc.tex --in-place

Output (doc.tex):

Intro paragraph.

\item addition-1: Added "add new text"
\item deletion-1: Deleted "remove old text"
\item substitution-1: Changed "replace this" to "with that"

We % addition-1: Added "add new text"
\underline{{add new text}} here.
We % deletion-1: Deleted "remove old text"
\sout{{remove old text}} here.
We % substitution-1: Changed "replace this" to "with that"
\sout{{replace this}}\underline{{with that}} here.
We can \fbox{{highlight}} something.
And leave a % NOTE: reviewer note comment.

Publishing (PyPI)

Build:

uv build

Publish (token):

uv publish -t "$UV_PUBLISH_TOKEN"

Publish (GitHub Actions trusted publishing):

  • Tag a release like v0.1.0; the workflow in .github/workflows/publish.yml will build and publish.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

criticmarkup-0.1.0.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

criticmarkup-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file criticmarkup-0.1.0.tar.gz.

File metadata

  • Download URL: criticmarkup-0.1.0.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for criticmarkup-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1a8928ab5d0bdb9b2e9e5085e39c853ce0c887b2dae1f3d1ab5a00956ef9fb2
MD5 ef27d52ce82bc752df7d4937da9034e2
BLAKE2b-256 0e9cf2575285ae2472e43e924121efb0b72b2bca27ade47adeb7fb7abce636d7

See more details on using hashes here.

File details

Details for the file criticmarkup-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: criticmarkup-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for criticmarkup-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cb281bd4891ad56c4641b88b4921990510ceaf6d2b13ce421b1fbc513d972fb
MD5 9157e504a676e878baeb0f10c9bb821b
BLAKE2b-256 a2f5c02dabe09899ab469d7db5d04a02d64776640671f2e1cf50c68b4dfd3806

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page