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.

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.1.tar.gz (38.4 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.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: criticmarkup-0.1.1.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for criticmarkup-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9f94ff445414c493382e7eb6e5af4aa48055ee1efe8ebedcac30bf1cc74fd41
MD5 3f5c1dad4f2aecf8eda89a444c099973
BLAKE2b-256 7f170c964d484d671e152f5bd5996d21bf6cefe83048b1b514705ed01748a06c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: criticmarkup-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for criticmarkup-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f9d5d2059e6867f7948e8a7c6b0f1f1e3af139ed5ccfa1203b96997f4c6fac
MD5 2517fbad4e76a6d1fb94087adceb8fe1
BLAKE2b-256 cb97837bb7071d0358c03f5861bee6dd831cd28d6a7703cc99801aec0fccdc0b

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