Chuyển đến nội dung
Skillpedia
PDF, Word và slide7.8k · #12861

document-gen-unicode-safe

Skill này làm gì

Skill này hướng dẫn AI tạo tài liệu nhiều định dạng khi văn bản có ký tự đặc biệt hoặc công cụ thông thường bị lỗi. Dành cho người gặp lỗi khi xuất tệp vì ký hiệu hoặc dấu.

Khi nào nên dùng

  • ✓Khi tài liệu của tôi có dấu gạch dài, dấu nháy cong, mũi tên hoặc chữ có dấu làm hỏng PDF.
  • ✓Khi công cụ tài liệu thông thường trả về một lỗi không rõ ràng.
  • ✓Khi tôi cần cùng một tài liệu dưới dạng Word, PDF và HTML cùng lúc.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tài liệu của tôi có dấu nháy cong và chữ có dấu, và xuất PDF liên tục thất bại. Hãy tạo phiên bản Word, PDF và HTML chạy được.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI quyết định nên đi đường đơn giản hay đường thủ công cẩn thận, thay các ký tự mà công cụ PDF không hiển thị được, chuyển đổi từng định dạng và kiểm tra tệp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Document Generation Fallback Workflow (Unicode-Safe)

When to Use

First, assess whether to delegate to shell_agent or use manual workflow:

✅ Use shell_agent Directly When:

  • Document is straightforward (no special Unicode characters, symbols, or non-ASCII text)
  • Single format output needed (e.g., just .docx)
  • Content is primarily ASCII text with standard punctuation
  • No complex formatting requirements (tables, equations, custom templates)
  • You want quick iteration and shell_agent has succeeded on similar tasks before

⚠️ Use Manual Workflow When:

  • shell_agent returns unknown or unclear errors
  • Document contains special characters, symbols, or non-ASCII text (see Unicode table below)
  • Generating multiple formats simultaneously (e.g., .docx, .pdf, .html)
  • PDF generation fails due to LaTeX encoding issues
  • You need fine-grained control over each conversion step
  • Previous shell_agent attempts failed on similar content

📋 Decision Checklist

1. Does the document contain: em-dashes (—), curly quotes (" "), arrows (→), 
   checkmarks (✓), or other special symbols? → Use Manual Workflow

2. Is non-ASCII text present (é, ñ, ü, 中文,العربية)? → Use Manual Workflow with sanitization

3. Did shell_agent already fail on this or similar content? → Use Manual Workflow

4. Need multiple output formats with guaranteed success? → Use Manual Workflow

5. Simple ASCII document, single format, first attempt? → Try shell_agent First

Core Technique

Quick Path (for straightforward documents): Delegate directly to shell_agent with clear instructions:

shell_agent
task: Create a Word document from markdown content. Write the markdown to 
      /tmp/document.md, then convert to .docx using pandoc, and verify the output exists.

Manual Path (for complex/Unicode-heavy documents): Split the workflow into discrete, observable steps:

  1. Content creation → Use write_file to create source document (Markdown)
  2. Unicode sanitization → Preprocess markdown to replace problematic characters before PDF conversion
  3. Format conversion → Use run_shell with pandoc for each target format
  4. Verification → Check output files exist and are valid

Why This Adaptive Approach?

Scenario Recommended Approach Rationale
Simple ASCII doc, single format shell_agent Faster, less manual overhead
Unicode symbols present Manual workflow Prevents LaTeX encoding failures
Previous shell_agent failure Manual workflow Avoids repeat failures
Multiple formats needed Manual workflow Granular control per format
Time-sensitive, low-risk shell_agent first Try fast path, fallback if needed
  1. Content creation → Use write_file to create source document (Markdown)
  2. Unicode sanitization → Preprocess markdown to replace problematic characters before PDF conversion
  3. Format conversion → Use run_shell with pandoc for each target format
  4. Verification → Check output files exist and are valid

⚠️ Unicode & LaTeX Compatibility Warning

Critical: PDF generation via pandoc typically uses LaTeX (pdflatex or xelatex), which has limited Unicode support. Common problematic characters include:

Character Issue Safe Replacement
— (em dash) May not render -- or -
– (en dash) May not render -
" " (curly quotes) Encoding errors " " (straight quotes)
' ' (curly apostrophe) Encoding errors ' (straight apostrophe)
… (ellipsis) May not render ...
→ ← ↑ ↓ (arrows) LaTeX incompatibility -> <- ^ v
✓ ✗ (checkmarks) May not render [x] [ ]
★ ● (symbols) May not render * -
© ® ™ May require packages (c) (r) (tm)
Non-ASCII letters (é, ñ, ü) Font-dependent Use xeLaTeX or replace

Step-by-Step Workflow

Step 1: Create Source Content with write_file

Write your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.

write_file
path: /tmp/document_source.md
content: |
  # Document Title
  
  ## Section 1
  Content here...
  
  ## Section 2
  More content...

Step 2: Sanitize Unicode Characters (Pre-PDF Conversion)

Before PDF conversion, create a sanitized version of your markdown with LaTeX-safe

Câu hỏi thường gặp

Khi nào nên dùng đường thủ công?

Hướng dẫn nói nên dùng khi văn bản có ký tự đặc biệt, khi công cụ thông thường bị lỗi, hoặc khi cần nhiều định dạng.

Ký tự nào được thay thế?

Hướng dẫn liệt kê các mục như dấu gạch dài, gạch ngắn và dấu nháy cong, được thay bằng ký tự đơn giản hơn.

Có cần công cụ đặc biệt không?

Skill dùng pandoc để chuyển đổi tệp, nên pandoc phải có sẵn trên máy tính.

Chi tiết

Mô tả gốc của tác giả

Unicode-safe fallback workflow for multi-format document generation with character sanitization

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12861
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự