Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A Go port of bgreenwell/doxx - A lightning-fast, terminal-native document viewer for Microsoft Word files.

License

Notifications You must be signed in to change notification settings

keskinonur/doxx-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

doxx-go πŸ“„

A Go port of doxx - Lightning-fast, terminal-native document viewer for Microsoft Word files

Go Version License: MIT Platform GitHub release

doxx-go brings the power of the original Rust doxx to the Go ecosystem, providing beautiful terminal-based viewing of Microsoft Word documents with zero dependencies on Microsoft Office.

doxx-go Screenshot

πŸš€ Features

Complete feature parity with the original Rust implementation:

  • 🎨 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
  • πŸ“‹ Copy to clipboard - Copy rendered content directly from the terminal UI
  • πŸ“ Multiple export formats - Markdown, CSV, JSON, and plain text
  • ⚑ XML-based parsing - Robust text extraction from DOCX internal structure

πŸ“¦ Installation

From Source

# Clone the repository
git clone https://github.com/keskinonur/doxx-go.git
cd doxx-go

# Build the binary
go build -o doxx cmd/doxx/main.go

# Or install directly
go install ./cmd/doxx

Pre-built Binaries

Download the latest release for your platform from the releases page.

Using Make

make build      # Build the binary
make install    # Install to $GOPATH/bin
make run FILE=document.docx  # Run with a file

Quick Setup

./quickstart.sh  # Automated setup and dependencies

🎯 Usage

Basic Usage

# View a document interactively
doxx quarterly-report.docx

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

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

# Force interactive UI mode
doxx document.docx --force-ui

Export Formats

# Export to different formats
doxx spreadsheet.docx --export csv > data.csv           # Tables only
doxx report.docx --export markdown > report.md          # Full document
doxx document.docx --export json > structure.json       # Complete structure  
doxx document.docx --export text > plain.txt            # Plain text

Important: CSV export only outputs table data. For documents without tables, use text, markdown, or json formats.

Advanced Usage

# Search without UI (for scripting)
doxx document.docx --search "error" --no-ui

# Combine search with export
doxx document.docx --search "quarterly" --export json

# Process multiple files
for file in *.docx; do doxx "$file" --export text > "${file%.docx}.txt"; done

Keyboard Shortcuts (Interactive Mode)

Key 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

πŸ§ͺ Testing

The project includes comprehensive test fixtures from the original doxx repository:

Test Files

# Test with original doxx fixtures
ls test-fixtures/
# minimal.docx              - Basic parsing test
# tables-heavy.docx         - Complex table parsing  
# headings-hierarchy.docx   - Outline generation
# formatting-showcase.docx  - Text formatting
# lists-comprehensive.docx  - List structures
# unicode-special.docx      - International characters
# business-report.docx      - Real-world document
# export-test.docx          - Export validation

Testing by Feature

# Basic document parsing
./build/doxx test-fixtures/minimal.docx --export text

# Table extraction and CSV export
./build/doxx test-fixtures/tables-heavy.docx --export csv

# Heading detection and outline
./build/doxx test-fixtures/headings-hierarchy.docx --export markdown

# Search functionality
./build/doxx test-fixtures/business-report.docx --search "revenue"

# Unicode and special characters
./build/doxx test-fixtures/unicode-special.docx --export json

# Comprehensive format testing
./build/doxx test-fixtures/export-test.docx --export markdown

Running Tests

make test               # Run unit tests
make test-coverage      # Generate coverage report
make benchmark          # Performance benchmarks

πŸ—οΈ Project Structure

doxx-go/
β”œβ”€β”€ cmd/
β”‚   └── doxx/
β”‚       └── main.go          # CLI entry point with Cobra
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ document/
β”‚   β”‚   β”œβ”€β”€ parser.go        # DOCX parsing with XML extraction
β”‚   β”‚   └── parser_test.go   # Unit tests
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   └── app.go           # Terminal UI with Bubble Tea
β”‚   └── export/
β”‚       └── export.go        # Multi-format export (MD, CSV, JSON, Text)
β”œβ”€β”€ test-fixtures/           # Original doxx test files
β”œβ”€β”€ build/                   # Compiled binaries
β”œβ”€β”€ go.mod                   # Go module definition
β”œβ”€β”€ Makefile                 # Build automation
└── README.md

πŸ”§ Technical Details

Architecture

This Go port maintains the same architecture as the original Rust implementation:

  • Document Parsing: Uses nguyenthenguyen/docx for DOCX file access with custom XML parsing for robust text extraction
  • Terminal UI: Built with charmbracelet/bubbletea for beautiful cross-platform interfaces
  • Smart Tables: Intelligent data type detection and alignment (numbers right-aligned, booleans centered)
  • Export Pipeline: Clean separation of concerns for different export formats

Key Features Implementation

XML-Based Text Extraction

  • Parses Word document XML structure directly
  • Extracts clean text from <w:t> tags
  • Preserves formatting and style information
  • Handles complex document structures

Smart Table Alignment

  • Automatically detects data types (numbers, currency, percentages, dates, booleans)
  • Applies intelligent alignment based on content type
  • Unicode borders for professional rendering
  • Proper CSV export with data type preservation

Search Functionality

  • Case-insensitive full-text search across paragraphs and tables
  • Context-aware result highlighting with **bold** markup
  • Navigate between results with n/p keys
  • Location information for precise navigation

Multiple Export Formats

  • Markdown: Preserves formatting with proper table alignment indicators
  • CSV: Extracts only tables for data analysis workflows (empty if no tables)
  • JSON: Complete document structure with metadata and typing information
  • Text: Clean plain text output suitable for piping and automation

🀝 Comparison with Original doxx

Feature Original (Rust) Go Port Status
DOCX Parsing βœ… βœ… Complete with XML extraction
Terminal UI βœ… βœ… Complete with Bubble Tea
Table Rendering βœ… βœ… Complete with smart alignment
Search βœ… βœ… Complete with highlighting
Outline View βœ… βœ… Complete with navigation
Export Formats βœ… βœ… Complete (MD, CSV, JSON, Text)
Clipboard βœ… βœ… Complete with ANSI stripping
Mouse Support βœ… βœ… Complete with wheel scrolling
Test Fixtures βœ… βœ… All original test files included

🚧 Roadmap

Following the original doxx roadmap:

  • AI integration for document summarization
  • Hyperlink support and navigation
  • Image descriptions and alt-text
  • Themes and color customization
  • Web interface for browser viewing
  • Plugin system for extensions

πŸ“„ License

MIT License - See LICENSE file for details

πŸ™ Acknowledgments

  • Original doxx by @bgreenwell
  • Built with Bubble Tea by Charm
  • Test fixtures from the original doxx repository
  • Inspired by the terminal-first development philosophy

πŸ› Contributing

Contributions are welcome! This project maintains compatibility with the original doxx.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Add tests for new functionality
  4. Ensure all tests pass (make test)
  5. Commit your changes (git commit -m 'Add some AmazingFeature')
  6. Push to the branch (git push origin feature/AmazingFeature)
  7. Open a Pull Request

Development Setup

git clone https://github.com/keskinonur/doxx-go.git
cd doxx-go
make deps                # Download dependencies
make test                # Run tests
make build               # Build binary
./build/doxx test-fixtures/minimal.docx  # Test with sample file

Made with ❀️ for developers who live in the terminal

About

A Go port of bgreenwell/doxx - A lightning-fast, terminal-native document viewer for Microsoft Word files.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •