TTokenySpace
返回 Skills 列表

Doc Beautifier

Beautify Word documents (.docx) using a professional general template. Trigger when the user asks to: beautify/美化/排版/格式化 a Word document, apply a template/style to a .docx file, make a document look p

#中文
0

安装到 Tokeny(自动)

下载 ZIP
安装"doc-beautifier"技能
技能信息:
- 名称: Doc Beautifier
- 标识: doc-beautifier
- 描述: Beautify Word documents (.docx) using a professional general template. Trigger when the user asks to: beautify/美化/排版/格式化 a Word document, apply a template/style to a .docx file, make a document look p
- 版本: 1.0.0
下载地址:
https://www.tokeny.space/api/skills/doc-beautifier/download
继续

复制上方内容到 Tokeny 客户端并在会话中发送即可自动安装;也可直接 下载 ZIP并拖动到技能窗口安装。

SKILL.md

doc-beautifier

Beautify .docx files with a professional general template. Preserves all original text content while applying consistent formatting.

Quick Start

python3 scripts/beautify.py <input.docx> <output.docx>
# Optional template:
python3 scripts/beautify.py input.docx output.docx --template elegant

Features

  • Structure Detection: Heuristically identifies titles, headings (3 levels), and body paragraphs based on text patterns, length, and existing formatting
  • 3 Built-in Templates:
    • standard — Default professional template (A4, 微软雅黑 headings, 宋体 body, 1.5 line spacing)
    • compact — Tighter spacing, smaller margins, 1.25 line spacing (for dense documents)
    • elegant — Larger margins, refined colors, spacious layout (for formal reports)
  • Page Layout: Sets A4 page size, proper margins, centered page numbers in footer
  • Content Preservation: ALL original text is preserved; no content is added, removed, or reordered

Template Specification

Settingstandardcompactelegant
Page margins2.54/3.18 cm2.0/2.5 cm3.0/3.5 cm
Title size22pt18pt26pt
H1 size16pt14pt16pt
H2 size14pt12pt14pt
H3 size12pt11pt12pt
Body size12pt(小四)11pt(五号)12pt(小四)
Line spacing1.51.251.5
Body font宋体宋体宋体
Heading font微软雅黑微软雅黑微软雅黑

Workflow

  1. Locate the user's input .docx file
  2. Run beautify.py with desired template
  3. Validate the output by unpacking or checking with python-docx
  4. Deliver the beautified document path to the user

Structure Detection Heuristics

The script identifies paragraph roles using:

  • First non-empty paragraph → Document title
  • Already styled as Heading 1-3 → Preserve heading level
  • Bold + large font + short text (< 50 chars) without ending punctuation → Heading
  • Starts with Chinese number (一、二、) or decimal (1.1, 2.3) → Heading
  • Bold paragraphs under 60 chars → Heading
  • Everything else → Body text

Customization

Edit the TEMPLATES dictionary in scripts/beautify.py to:

  • Change colors, fonts, sizes
  • Add new template variants
  • Adjust line spacing or indentation
  • Modify page margins

Requirements

  • python-docx (install: pip install python-docx)
  • Python 3.8+

评论

加载中…