Skip to content

Kellermaan/text-toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Text Toolbox

An extensible and beautifully designed web-based text processing toolbox with multiple text processing capabilities.

δΈ­ζ–‡ζ–‡ζ‘£

✨ Features

  • 🎨 Beautiful Web Interface - Modern gradient design with drag-and-drop file upload
  • πŸ”§ Easy to Extend - Plugin architecture for easy addition of new features
  • πŸš€ High Performance - Asynchronous backend based on FastAPI
  • πŸ“¦ Flexible Input - Supports multiple file selection and ZIP archives
  • 🌐 Cross-Platform - Web-based, works in any browser

πŸ› οΈ Current Features

1. Markdown File Merger

Merges multiple date-named Markdown files in chronological order into a single file.

Supported filename formats:

  • 20250410.md
  • 2025-04-10.md
  • 20250410_notes.md

Merge rules:

  • Output filename is the year (e.g., 2025.md)
  • H1 heading is the year (e.g., # 2025)
  • H2 headings are formatted dates (e.g., ## 2025-03-09)
  • Each file's content follows its corresponding date heading
  • Files are separated by horizontal rules ---
  • Sorted in ascending date order

Usage:

  1. Upload multiple .md files, or
  2. Upload a .zip archive containing .md files

πŸ—οΈ Project Structure

text-toolbox/
β”œβ”€β”€ backend/                 # Backend code
β”‚   β”œβ”€β”€ main.py             # FastAPI application entry point
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   β”œβ”€β”€ tools/              # Tool modules directory
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ base.py         # Base tool class
β”‚   β”‚   └── md_merger.py    # Markdown merger tool
β”‚   └── temp/               # Temporary files directory
β”œβ”€β”€ frontend/               # Frontend code
β”‚   └── index.html         # Single page application
β”œβ”€β”€ docker-compose.yml     # Docker Compose file
β”œβ”€β”€ Dockerfile            # Docker image
└── README.md             # Project documentation

πŸš€ Quick Start

Option 1: Using Docker (Recommended)

# Start all services
./start.sh        # Linux/Mac
start.bat         # Windows

# Or manually:
docker-compose up -d

Access: http://localhost:8080

Option 2: Local Development

# Install dependencies
cd backend
pip install -r requirements.txt

# Start backend
python main.py

Backend API: http://localhost:8000

In another terminal:

# Start frontend
cd frontend
python -m http.server 8080

Frontend: http://localhost:8080

πŸ“š API Documentation

After starting the backend, visit http://localhost:8000/docs to view the auto-generated API documentation.

Main Endpoints

  • GET / - Get API information and tool list
  • GET /api/tools - Get all available tools
  • POST /api/tools/md-merger - Merge multiple MD files
  • POST /api/tools/md-merger/zip - Extract and merge MD files from ZIP

πŸ”§ Adding New Features

This project uses a plugin architecture, making it very simple to add new features:

1. Create Tool Class

Create a new tool file in backend/tools/ directory, inheriting from BaseTool:

# backend/tools/your_tool.py
from .base import BaseTool

class YourTool(BaseTool):
    @property
    def name(self) -> str:
        return "Your Tool Name"
    
    @property
    def description(self) -> str:
        return "Tool description"
    
    async def process(self, *args, **kwargs):
        # Implement your processing logic
        pass

2. Register Tool

Register your tool in backend/main.py:

from tools.your_tool import YourTool

TOOLS_REGISTRY = {
    "md_merger": {...},
    "your_tool": {
        "name": "Your Tool Name",
        "description": "Tool description",
        "endpoint": "/tools/your-tool",
        "handler": YourTool()
    }
}

3. Add API Endpoint

Add the corresponding API endpoint in backend/main.py:

@app.post("/api/tools/your-tool")
async def your_tool_endpoint(file: UploadFile = File(...)):
    # Processing logic
    pass

4. Update Frontend Interface

Add a new tool card and interaction logic in frontend/index.html.

🐳 Docker Deployment

The project includes complete Docker configuration for one-click deployment:

# Build and start
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

πŸ” Example

Input Files

folder/
β”œβ”€β”€ 20250101.md
β”œβ”€β”€ 20250102.md
└── 20250103.md

20250101.md:

First day of 2025, Happy New Year!

20250102.md:

Starting to plan for the new year.

Output File (2025.md)

# 2025

## 2025-01-01

First day of 2025, Happy New Year!

---

## 2025-01-02

Starting to plan for the new year.

---

πŸ›£οΈ Roadmap

  • Markdown file merger feature
  • Text format conversion (MD/TXT/PDF, etc.)
  • Batch file renaming
  • Text statistics and analysis
  • Regex batch replacement
  • CSV/Excel data processing
  • Text deduplication tool

🀝 Contributing

Issues and Pull Requests are welcome!

πŸ“„ License

MIT License

πŸ‘¨β€πŸ’» Tech Stack

  • Backend: FastAPI (Python 3.8+)
  • Frontend: Native HTML/CSS/JavaScript
  • Deployment: Docker + Docker Compose

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors