Skip to main content

Command line interface and Python API to generate i18n documents

Project description

Multilingual Markdown Generator

Multilingual Markdown Generator

This package provides a command-line interface to manage multilingual contents and generate i18n markdown from a single base file.

PyPI - Version PyPI - Python Version GitHub code size in bytes PyPI - License

🌏 English | Français | 한국어 | 日本語

Available in Bash, Zsh, and Windows PowerShell.


Table of Contents

  1. Overview
    1. How It Works
    2. Features
  2. Installation
    1. Linux
    2. macOS
    3. Windows
  3. How to Use
  4. Troubleshooting
  5. Changelog
  6. Contributors

Overview 🔎

How It Works

By managing only one Base file, we can reduce the number of errors caused by missing or mismatched translations. Additionally, thanks to editing in a single file, we can expect convenient translation with the auto-completion function of AI tools such as Copilot.

Markdown:

How It Works: Markdown

Jupyter Notebook:

How It Works: Jupyter Notebook

Features

Supports the following features:

  • Markdown, Jupyter Notebook(.ipynb) as input formats
  • As-is, HTML, PDF as ouput formats
  • Command-line interface for Bash, Zsh, Windows PowerShell
  • Python API
  • Recursive traversal mode with -r option (As-is, HTML, PDF are all supported)
  • Batch processing mode with YAML file (Only As-is is supported)
  • IETF language tags
  • UTF-8 encoding
  • Automatic generation of table of contents with level and emoji options (Markdown and Jupyter Notebook are both supported)
  • Base file validation (Check the number of tags of each language)
  • Validation only mode for CI/CD (Disable file generation)

Installation 📦

Linux

pip3 install mmg

macOS

pip3 install mmg

If you have any issues with WeasyPrint, install it with the following command. WeasyPrint is only used to create PDFs.

brew install weasyprint

Windows

  1. MMG uses WeasyPrint to create PDFs. WeasyPrint requires the GTK library, so download and run the latest GTK3 installer. If you are not interested in creating PDFs, you can skip this step. Other features of MMG are available without GTK.

  2. Install MMG using Pip.

    pip3 install mmg
    

How to Use 💡

Please refer to the documentation for detailed usage and examples.

$ mmg --help
Usage: mmg [OPTIONS] [FILE_NAMES]...

  FILE_NAMES: Base file names to convert. `*.base.md` or `*.base.ipynb` are
  available.

  Here are some examples:

      mmg *.base.md

      mmg *.base.ipynb

      mmg *.base.md *.base.ipynb -o pdf --css github-dark

      mmg --recursive

      mmg --recursive --validation-only

      mmg --batch mmg.yml

Options:
  -r, --recursive                 This will search all subfolders based on
                                  current directory.
  -b, --batch FILE                YAML file path for batch conversion.
                                  (Default: None)
  -o, --output-format [as-is|html|pdf]
                                  Output format. (Default: as-is)
  --css TEXT                      CSS file path or preset('github-
                                  light'/'github-dark'). Only for the HTML/PDF
                                  output. (Default: github-light)
  -y, --yes                       This will confirm the conversion without
                                  asking. (Default: False)
  -s, --skip-validation           Skip the health check. (Default: False)
  --validation-only               Only check the health. (Default: False)
  -v, --verbose                   Verbosity level from 0 to 2. --verbose:1,
                                  -v:1, -vv:2 (Default: 0)
  --version                       Show the current version.
  --help                          Show this message and exit.

Troubleshooting 💊

Please refer to the troubleshooting page on the website.

Changelog 📝

CHANGELOG.md

Contributors 🤝

Made with contrib.rocks.

If you are interested in how to contribute, please refer to the contribution guide.

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

mmg-2.0.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

mmg-2.0.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file mmg-2.0.0.tar.gz.

File metadata

  • Download URL: mmg-2.0.0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for mmg-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5b5e322d97b6016c0510fdce5396e402337f0aa97170eee12eaa206222f26268
MD5 9b18fcf68fccdcfc0ecc2e31c30eebb8
BLAKE2b-256 17a9e169447f907652656e5980bab016a7a2988766f7fc08016c20ca8534b7ef

See more details on using hashes here.

File details

Details for the file mmg-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: mmg-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for mmg-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a2ceeb0b5db06b352b4b91936cb75fdd7dbb5ba346afa42d3814231ca3b0158
MD5 3a1b9bf7b58f9958143182f5fb95d2e0
BLAKE2b-256 265be42b68babe1f6fd133cbfd86ab4207899920068fe65794bb48c84b1894f0

See more details on using hashes here.

Supported by

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