Skip to main content

Intelligently adds spacing between CJK and alphanumeric characters with special handling for Markdown.

Project description

pangumd

About

This version adds special adaptations for Markdown syntax on top of the original project, ensuring that text spacing works correctly within Markdown documents.

Current Markdown Adaptations

  1. Code Blocks - Preserves code block formatting without adding unwanted spaces
  2. Bold Text - Handles **bold text** syntax correctly, adding appropriate spacing around bold markers
  3. Italic Text - Support for *italic text* syntax
  4. Chinese Links - Proper spacing for hyperlinks containing Chinese characters

Installation

Just clone it.

Usage

In Python

import pangumd

new_text = pangumd.spacing_text('當你凝視著bug,bug也凝視著你')
# new_text = '當你凝視著 bug,bug 也凝視著你'

nwe_content = pangumd.spacing_file('path/to/file.txt')
# nwe_content = '與 PM 戰鬥的人,應當小心自己不要成為 PM'

In CLI

$ pangumd "請使用uname -m指令來檢查你的Linux作業系統是32位元或是64位元"
請使用 uname -m 指令來檢查你的 Linux 作業系統是 32 位元或是 64 位元

$ python -m pangumd "為什麼小明有問題都不Google?因為他有Bing"
為什麼小明有問題都不 Google?因為他有 Bing

$ echo "未來的某一天,Gmail配備的AI可能會得出一個結論:想要消滅垃圾郵件最好的辦法就是消滅人類" >> path/to/file.txt
$ pangumd -f path/to/file.txt >> pangu_file.txt
$ cat pangu_file.txt
未來的某一天,Gmail 配備的 AI 可能會得出一個結論:想要消滅垃圾郵件最好的辦法就是消滅人類

$ echo "心裡想的是Microservice,手裡做的是Distributed Monolith" | pangumd
心裡想的是 Microservice,手裡做的是 Distributed Monolith

$ echo "你從什麼時候開始產生了我沒使用Monkey Patch的錯覺?" | python -m pangumd
你從什麼時候開始產生了我沒使用 Monkey Patch 的錯覺?

Pre-commit Hook

To use pangumd as a pre-commit hook, add the following to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/kingronjan/pangumd
    rev: 0.1.1 
    hooks:
      - id: pangumd
        files: \.(md|txt|rst)$

Then install the hook:

pre-commit install

Now pangumd will automatically run on your Markdown and text files before each commit, ensuring proper spacing between CJK and half-width characters.

License

MIT License

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

pangumd-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

pangumd-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pangumd-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pangumd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 977d2d8e76a0934815da0eddba582f04943742bd10238c0ec4828df907d94d20
MD5 5fb816523e90030525140497da1f5a8f
BLAKE2b-256 98f42226b3572f2e7e89a7f74aafca643514813e9e2c49dc0b0ce436c9f310b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pangumd-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pangumd-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53023b52da709fb59fbd0e2abb8d78fd87f05a085d63673ada8c3375e5de3dd1
MD5 ea0127a5d9ece75a31b01fc06e5dfc4d
BLAKE2b-256 3328e6d3f06bdc2f49268f0eefb390f40efbaf4efb722527063d0974ebbb4426

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