Home
Softono
document-format-skills

document-format-skills

Open source MIT Python
172
Stars
16
Forks
2
Issues
0
Watchers
4 months
Last Commit

About document-format-skills

Professional Word document formatting toolkit for Chinese documents

Platforms

Web Self-hosted

Languages

Python

Links

๐Ÿ“„ document-format-skills

ไธญๆ–‡็‰ˆๆœฌ README / Chinese Version

๐Ÿ’ก ๆƒณ่ฆๆ— ้œ€่”็ฝ‘ใ€ไธ€้”ฎ่ฟ่กŒไฟฎๅคๆ ผๅผ็š„ๆกŒ้ขๅบ”็”จ็‰ˆๆœฌ๏ผŸ
็ŽฐๅทฒๆŽจๅ‡บ Document Format GUI โ€”โ€” ๆ— ้œ€่”็ฝ‘ใ€ไธ€้”ฎไฟฎๅคๅ…ฌๆ–‡ๆ ผๅผ็š„ๆกŒ้ขๅบ”็”จ๏ผŒๅฐ็™ฝไนŸ่ƒฝ่ฝปๆพไธŠๆ‰‹๏ผ

A Word document formatting toolkit for Chinese documents (docx). Diagnose formatting issues, fix punctuation, and apply standardized styles with one command. Available for Claude Code, Codex, OpenCode.

โœจ Features

Module Description Script
Format Analyzer Detect formatting issues in documents analyzer.py
Punctuation Fixer Fix mixed Chinese/English punctuation punctuation.py
Style Formatter Apply preset formatting standards formatter.py

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • uv (recommended) or pip

Installation

git clone https://github.com/yourusername/document-format-skills.git
cd document-format-skills

Usage

1. Diagnose formatting issues

uv run --with python-docx python scripts/analyzer.py input.docx

2. Fix punctuation

uv run --with python-docx python scripts/punctuation.py input.docx output.docx

3. Apply formatting preset

# Official document format (GB/T 9704-2012)
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset official

# Academic paper format
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset academic

# Legal document format
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset legal

๐Ÿ“‹ What It Fixes

Punctuation Issues

The toolkit intelligently converts punctuation based on context:

Type Incorrect Chinese English
Parentheses Mixed usage ๏ผˆ๏ผ‰ ()
Quotes Straight " "" '' "" ''
Colon Mixed usage ๏ผš :
Comma Mixed usage ๏ผŒ ,
Period Mixed usage ใ€‚ .
Semicolon Mixed usage ๏ผ› ;
Ellipsis ... โ€ฆโ€ฆ ...
Dash -- โ€”โ€” --

Format Issues

  • Paragraph indentation โ€” Detects missing first-line indents
  • Line spacing โ€” Identifies inconsistent spacing
  • Font usage โ€” Flags mixed fonts and sizes
  • Numbering โ€” Catches inconsistent numbering styles (e.g., mixing 1. with 1ใ€)

๐Ÿ“ Formatting Presets

Official Document (GB/T 9704-2012)

Chinese government document standard:

  • Page: A4, margins: top 37mm, bottom 35mm, left 28mm, right 26mm
  • Title: FangZheng XiaoBiaoSong, 22pt, centered
  • Body: FangSong_GB2312, 16pt, 2-character indent, 28pt line spacing
  • Headings: Structured with ไธ€ใ€/ ๏ผˆไธ€๏ผ‰/ 1. / ๏ผˆ1๏ผ‰

Academic Paper

Standard academic formatting:

  • Page: A4, 25mm margins
  • Title: SimHei, 18pt, bold, centered
  • Body: SimSun/Times New Roman, 12pt, 1.5x line spacing

Legal Document

Legal document formatting:

  • Page: A4, margins: top 30mm, bottom 25mm, left 30mm, right 25mm
  • Title: SimSun bold, 22pt, centered
  • Body: SimSun, 14pt, 1.5x line spacing

๐Ÿ“ Project Structure

document-format-skills/
โ”œโ”€โ”€ README.md           # English documentation
โ”œโ”€โ”€ README_CN.md        # Chinese documentation
โ”œโ”€โ”€ SKILL.md            # Skill definition file
โ””โ”€โ”€ scripts/
    โ”œโ”€โ”€ analyzer.py     # Format diagnostics
    โ”œโ”€โ”€ punctuation.py  # Punctuation fixer
    โ””โ”€โ”€ formatter.py    # Style formatter

๐Ÿ”ง Dependencies

Automatically installed when using uv run --with python-docx.

โš ๏ธ Notes

  1. Only supports .docx โ€” Legacy .doc format is not supported
  2. Backup your files โ€” Always keep a backup before processing
  3. Font requirements โ€” Output files require corresponding fonts installed on the system to display correctly
  4. Table content โ€” Text within tables is also processed

๐Ÿ“„ License

MIT License

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.