A CLI tool to fix mathematical equations in markdown files and convert between formats
Project description
Markdown Equations Fixer and Converter
A versatile command-line tool to standardize and fix mathematical equations in Markdown files and convert documents between various formats like Markdown, LaTeX, DOCX, and PDF.
Table of Contents
Key Features
- Fix Markdown Equations: Standardizes common LaTeX-style equations to a consistent Markdown format.
- Converts block equations from
\[...\]to the widely supported$$...$$. - Converts inline equations from
\(...\)to$..$. - Handles both single-line and multi-line equations gracefully.
- Converts block equations from
- Document Conversion: Leverages Pandoc to convert files between a variety of formats, including:
markdown,gfm(GitHub-Flavored Markdown),commonmarklatexorgdocxpdf
- User-Friendly CLI:
- Process multiple files or entire directories at once.
--recursiveflag to scan through subdirectories.--dry-runmode to preview changes without modifying files.- Rich console output with progress bars and status indicators.
Installation
You can install the package directly from PyPI:
pip install markdown-equations-fixer
Or, to install the latest development version from GitHub:
pip install git+https://github.com/dynstat/markdown-equations-fixer.git
Usage
The tool provides two main commands: fix and convert.
Command: fix
Use the fix command to standardize mathematical equations within your Markdown files (.md, .markdown).
Syntax:
meq-fixer fix [OPTIONS] [PATHS]...
Examples:
-
Fix a single file:
meq-fixer fix document.md
-
Fix multiple files and directories:
meq-fixer fix file1.md ./docs/
-
Recursively fix all markdown files in a directory:
meq-fixer fix -r ./my-project/
-
Preview changes without saving them (dry run):
meq-fixer fix --dry-run thesis.md
Options:
--dry-run: Preview changes without modifying files.--verbose,-v: Show detailed, file-by-file progress.--recursive,-r: Process directories recursively.
Command: convert
Use the convert command to translate documents between different formats.
Syntax:
meq-fixer convert [OPTIONS] <INPUT_FILE> <OUTPUT_FILE>
Examples:
-
Convert Markdown to a DOCX document:
meq-fixer convert my-paper.md my-paper.docx --to-format docx
-
Convert a LaTeX file to GitHub-Flavored Markdown (GFM):
meq-fixer convert report.tex report.md --from-format latex --to-format gfm
-
Convert to Markdown and fix equations in one step: The
--fix-equationsflag applies the same logic as thefixcommand to the output file. This is only useful when converting to a Markdown format.meq-fixer convert paper.tex paper.md --to-format markdown --fix-equations
Options:
--from-format,-f: The input format (e.g.,latex,markdown).--to-format,-t: The output format (e.g.,docx,pdf,gfm).--fix-equations: Fix equations in the output file (for Markdown output formats only).
Requirements
Python Packages
The installer will handle these dependencies automatically.
click>=8.0.0rich>=10.0.0pypandoc
System Dependencies
For the convert command to function, especially for DOCX and PDF output, you must have the following software installed on your system:
-
Pandoc: A universal document converter.
- Windows (with Chocolatey):
choco install pandoc - macOS (with Homebrew):
brew install pandoc - Linux (Debian/Ubuntu):
sudo apt-get install pandoc
- Windows (with Chocolatey):
-
A LaTeX Distribution: Required for rendering equations in PDF and DOCX files.
- Windows: MiKTeX (
choco install miktex) - macOS: MacTeX (
brew install --cask mactexorbasictex) - Linux (Debian/Ubuntu): TeX Live (
sudo apt-get install texlive-latex-extra)
- Windows: MiKTeX (
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Issues and pull requests are welcome! Please feel free to open an issue or submit a pull request on the GitHub repository.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markdown_equations_fixer-1.1.7.tar.gz.
File metadata
- Download URL: markdown_equations_fixer-1.1.7.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ee3e3036dcf8a25dbbc338befd78e1bd0c35a4c170018f2e211aabb202dca1
|
|
| MD5 |
fd7dc189ae0b5f2052e464a038e1cb9e
|
|
| BLAKE2b-256 |
e8b30232a4e233e70880e316350e935e4667a2b7655faf59329a7043f5f96214
|
File details
Details for the file markdown_equations_fixer-1.1.7-py3-none-any.whl.
File metadata
- Download URL: markdown_equations_fixer-1.1.7-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e0e41f6fb0ac42253fd55add567a54c24626acf43fecdb518007bc7f94c5178
|
|
| MD5 |
f2342b1e3cc4b3565013d251c819e9eb
|
|
| BLAKE2b-256 |
7d0a6819896cd6fa43190623520171410c265827b92a86ae3e46d9c2dd62f1a6
|