Skip to content
forked from bgreenwell/doxx

Expose the contents of .docx files without leaving your terminal. Fast, safe, and smart — no Office required!

Notifications You must be signed in to change notification settings

nealfennimore/xcod

 
 

Repository files navigation

xcod 📄

CI License: MIT Rust

Warning

This is a fork of doxx with AI features removed. It will not be actively maintained.

Expose .docx files in your terminal — no Microsoft Word required

xcod 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.

xcod screenshot

✨ Features

Document viewing

  • 🎨 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

Smart table support

  • 📋 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 & clipboard

  • 📋 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

Export & integration

  • 📝 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

🚀 Quick start

Installation

# Install from source (requires Rust)
git clone https://github.com/nealfennimore/xcod.git
cd xcod
cargo install --path .

Basic usage

# View a document
xcod quarterly-report.docx

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

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

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

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

# Get help
xcod --help

🎮 Terminal UI

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

💻 Examples

Document analysis

# Quick document overview
xcod annual-report.docx

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

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

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

Copy & clipboard workflow

# Interactive document review with copy
xcod 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
xcod meeting-notes.docx --search "action items"
# Press F2 to copy all search results with context

# Copy document structure for planning
xcod technical-spec.docx --outline
# Press 'c' to copy hierarchical outline

Pipeline integration

# Extract text for further processing
xcod meeting-notes.docx --export text | grep "action items"

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

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

🏗️ Architecture

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

🎯 Why xcod?

xcod 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

What xcod Brings

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

Feature xcod 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

vs. Microsoft Word

  • 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

🛠️ Development

Building from source

# Clone the repository
git clone https://github.com/nealfennimore/xcod.git
cd xcod

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

# Run tests
cargo test

Project structure

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

🚧 Roadmap

Coming soon

  • 🔗 Hyperlink support for navigation within documents
  • 🎨 Themes and customization for personalized viewing

🤝 Contributing

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

📄 License

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

🙏 Acknowledgments

  • 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

About

Expose the contents of .docx files without leaving your terminal. Fast, safe, and smart — no Office required!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.8%
  • Shell 1.1%
  • Nix 0.1%