显示 HN:Doxx – 受 Glow 启发的终端 .docx 查看器
Show HN: Doxx – Terminal .docx viewer inspired by Glow

原始链接: https://github.com/bgreenwell/doxx

## Doxx:一个终端原生 Word 文档查看器 Doxx 是一个快速的、用 Rust 构建的终端 Word (.docx) 文件查看器,无需 Microsoft Word 或繁琐的转换。它直接在命令行中提供美观的格式化渲染,包括语法高亮、智能表格支持(带有 Unicode 边框)和嵌套列表处理。 主要功能包括全文搜索与高亮、可导航的文档大纲和多种视图模式。Doxx 在表格解析方面表现出色,能够智能对齐数据类型(数字、文本等),并允许在表格*内部*搜索。用户可以将格式化的内容复制到剪贴板,并根据当前视图提供上下文相关的选项。 除了查看,Doxx 还支持导出为 Markdown、CSV 和 JSON 格式,以便进行数据分析和与其他工具集成。它支持跨平台(Windows、macOS、Linux),并提供 CLI 友好的界面,方便脚本编写和自动化。未来的开发包括 AI 驱动的功能,例如文档摘要和问答。 Doxx 在 GitHub 上可用,可以通过 `cargo install` 安装。它是一种轻量级、经济高效且 SSH 友好的传统 Word 查看器替代方案。

## 基于终端的 Word 查看器:Doxx 一款名为“Doxx”的新工具允许用户在终端中直接查看 `.docx` 文件,提供了一种比在传统文字处理器中打开它们更快、更便捷的替代方案。Doxx 使用 Rust 编写,并受到终端 Markdown 查看器 “glow” 的启发,它拥有 50 毫秒的启动时间(相比 Word 的 8 秒以上),并且可以无缝地通过 SSH 使用。 主要功能包括保留格式、正确渲染表格和列表、全文搜索并高亮显示,以及复制到剪贴板的功能。用户还可以将文档导出为 Markdown、CSV 或 JSON 格式。 开发者构建 Doxx 是为了满足在服务器上工作时快速高效地查看 Word 文档的需求。虽然目前仍处于早期阶段,但它已经证明了其用处,一位用户表达了对其在律师事务所中应用的兴奋之情。安装可以通过 `cargo install` 轻松完成。 然而,开发者承认 “Doxx” 这个名字可能会引起混淆,因为它与 “doxxing” 一词有关联。
相关文章

原文

Beautiful .docx viewing in your terminal — no Microsoft Word required

License: MIT Rust

doxx is a lightning-fast, terminal-native document viewer for Microsoft Word files. Built with Rust for performance and reliability, it brings Word documents to your command line with beautiful rendering, smart table support, and powerful export capabilities.

doxx screenshot

  • 🎨 Beautiful terminal rendering with syntax highlighting and formatting
  • 📊 Professional table display with smart alignment and Unicode borders
  • 📋 Nested list support with proper indentation and multi-level hierarchy
  • 🔍 Full-text search with highlighting and context
  • 📑 Document outline for quick navigation
  • 🎯 Multiple view modes — document, outline, search, and help
  • 📋 Advanced table parsing with automatic header detection
  • 🎯 Intelligent alignment — numbers right-aligned, text left-aligned, booleans centered
  • 💱 Data type detection for currency, percentages, dates, and more
  • 🎨 Professional ASCII rendering with scalable Unicode borders
  • 🔄 Search within tables across headers and cell content
  • 📋 Copy to clipboard - Copy rendered content directly from the terminal UI
  • 🎯 Context-aware copying - Different content based on current view:
    • Document view: Copy full formatted document with headings, lists, and tables
    • Outline view: Copy document structure with indented headings
    • Search view: Copy search results with context
  • 🖥️ Cross-platform: Works on Windows, macOS, and Linux (X11/Wayland)
  • Visual feedback with status messages and error handling
  • 📝 Markdown export with proper table alignment indicators
  • 📊 CSV extraction for data analysis workflows
  • 📄 Plain text output for piping to other tools
  • 🗂️ JSON export with full document structure
  • CLI-friendly for scripts and automation
# Install from source (requires Rust)
git clone https://github.com/bgreenwell/doxx.git
cd doxx
cargo install --path .
# View a document
doxx quarterly-report.docx

# Start with outline view
doxx document.docx --outline

# Search for specific content
doxx contract.docx --search "payment terms"

# Export to different formats
doxx spreadsheet.docx --export csv > data.csv
doxx report.docx --export markdown > report.md
doxx document.docx --export json > structure.json

# Force interactive UI (useful for development/testing)
doxx document.docx --force-ui

# Get help
doxx --help

Navigate documents with intuitive keyboard shortcuts and mouse support:

Input Action
/k or mouse wheel up Scroll up
/j or mouse wheel down Scroll down
Page Up/Page Down Page navigation
Home/End Jump to start/end
o Toggle outline view
s Open search
c Copy content to clipboard
F2 Copy content (in search view)
n/p Next/previous search result
h/F1 Toggle help
q Quit
# Quick document overview
doxx annual-report.docx

# Find all tables and export as CSV
doxx financial-data.docx --export csv

# Search for specific terms with context
doxx legal-contract.docx --search "liability"

# Navigate large documents with outline
doxx technical-manual.docx --outline

Copy & clipboard workflow

# Interactive document review with copy
doxx quarterly-report.docx
# Navigate to important section, press 'c' to copy to clipboard
# Paste into email, Slack, or other applications

# Copy search results for sharing
doxx meeting-notes.docx --search "action items"
# Press F2 to copy all search results with context

# Copy document structure for planning
doxx technical-spec.docx --outline
# Press 'c' to copy hierarchical outline
# Extract text for further processing
doxx meeting-notes.docx --export text | grep "action items"

# Convert Word tables to CSV for analysis
doxx survey-results.docx --export csv | python analyze.py

# Get document metadata as JSON
doxx report.docx --export json | jq '.metadata'

Built with modern Rust for maximum performance:

  • Document parsing: docx-rs for robust .docx file handling
  • Terminal UI: ratatui for beautiful cross-platform interfaces
  • Text processing: unicode-segmentation for proper Unicode support
  • Search: regex for powerful pattern matching

doxx fills a critical gap: there's no good way to view Word documents in the terminal. Current solutions force you to choose between losing all formatting or switching to GUI applications.

The Problem with Existing Tools

Tool Type DOCX Support Formatting Tables Interactive
docx2txt Text extractor ✅ Basic ❌ Lost ❌ Mangled ❌ No
antiword Legacy converter ❌ .doc only ❌ Lost ❌ Basic ❌ No
pandoc Universal converter ✅ Via chain ❌ Lost ❌ Basic ❌ No
glow Markdown viewer ❌ Wrong format ✅ Rich ✅ Good ✅ Yes
Microsoft Word GUI application ✅ Native ✅ Rich ✅ Perfect ✅ Yes

doxx is the first terminal-native DOCX viewer that preserves formatting and provides an interactive experience:

Feature doxx Best Alternative
Rich DOCX viewing ✅ Native with formatting ❌ Plain text only
Smart table rendering ✅ Aligned with borders ❌ Unformatted text
Interactive navigation ✅ Full TUI interface ❌ Pipe to less
Terminal integration ✅ SSH-friendly, scriptable ❌ GUI required
Multiple exports ✅ Markdown, CSV, JSON ❌ Text only
  • Instant startup (50ms vs 8+ seconds)
  • 💾 Minimal memory (15MB vs 500MB+ RAM)
  • 💰 Zero licensing costs ($0 vs $149+ per license)
  • 🔒 SSH-friendly for remote server access
  • 🔧 Scriptable for automation workflows

vs. Text Extractors (docx2txt, antiword)

  • 🎨 Preserves formatting (bold, italic, structure)
  • 📊 Intelligent table rendering with proper alignment
  • 🖥️ Interactive interface vs. static text output
  • 🔍 Built-in search with highlighting and navigation
  • 📤 Smart exports with format-aware output

vs. Terminal Document Viewers (glow, bat, mdcat)

  • 📄 Native DOCX support vs. markdown/code only
  • 🏢 Business document focused vs. developer files
  • 📊 Advanced table intelligence for spreadsheet-like data
  • 🔄 Multiple export formats for downstream processing
# Clone the repository
git clone https://github.com/bgreenwell/doxx.git
cd doxx

# Build and run
cargo build --release
cargo run -- --help

# Run tests
cargo test
src/
├── main.rs      # CLI argument parsing and entry point
├── document.rs  # Document parsing and table structures  
├── ui.rs        # Terminal interface and rendering
├── export.rs    # Export functionality for different formats
└── ai.rs        # AI integration framework (coming soon)
  • 🤖 AI integration for document summarization and Q&A
  • 🔗 Hyperlink support for navigation within documents
  • 📷 Image descriptions with AI-generated alt text
  • 🎨 Themes and customization for personalized viewing
  • 🌐 Web interface for browser-based viewing

AI-powered features (planned)

  • 📝 Document summarization with key points extraction
  • Interactive Q&A about document content
  • 📊 Smart data extraction for action items and deadlines
  • 🔍 Semantic search beyond keyword matching
  • 🛡️ Privacy-first with local AI model support

Contributions are welcome! Please feel free to submit a pull request or open an issue.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a pull request

This project is licensed under the MIT License — see the LICENSE file for details.

  • Built with the amazing Rust programming language
  • Terminal UI powered by ratatui
  • Document parsing with docx-rs
  • Inspired by Charm's Glow for beautiful CLI rendering
  • Influenced by the terminal-first development philosophy

Made with ❤️ for developers who live in the terminal

联系我们 contact @ memedata.com