Skip to content

plutonium-guy/gitText

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitText - Shareable Text Editor (https://amiyamandal-dev.github.io/gitText/)

A text editor where the entire document state is compressed and stored in the URL fragment. Share the URL to share the exact document state.

Features

  • URL State Storage: Text is automatically compressed and saved to the URL
  • LZSS Compression: Efficient text compression (50-70% reduction)
  • Base64URL Encoding: URL-safe encoding for sharing
  • No Server Required: Everything runs client-side
  • Instant Sharing: Copy the URL to share your text

Build

Requires Rust (stable) with the wasm32-unknown-unknown target:

rustup target add wasm32-unknown-unknown
cargo build --release
cp target/wasm32-unknown-unknown/release/editor.wasm docs/editor.wasm

Run

Serve the docs/ directory with any static file server:

cd docs
python3 -m http.server 8000

Then open http://localhost:8000

Usage

  1. Type or paste text into the editor
  2. The URL automatically updates with compressed content (debounced 500ms)
  3. Copy the URL using the "Copy Link" button or Ctrl/Cmd+Shift+C
  4. Share the URL - anyone opening it sees the exact same text

Keyboard Shortcuts

  • Ctrl/Cmd + S - Force save to URL
  • Ctrl/Cmd + Shift + C - Copy shareable link

Technical Details

Compression Pipeline

Save: Text -> UTF-8 -> LZSS compress -> Base64URL encode -> URL fragment

Load: URL fragment -> Base64URL decode -> LZSS decompress -> UTF-8 -> Text

LZSS Parameters

  • Window size: 4096 bytes
  • Min match length: 3 bytes
  • Max match length: 18 bytes

URL Format

https://example.com/editor/#eJzLSM3JyQcABiwCFQ
                            └── base64url encoded compressed data

File Structure

gitText/
├── src/
│   └── lib.rs            # WASM module: compression, encoding, AES, QR, sessions, lexer
├── docs/
│   ├── index.html        # Editor UI
│   ├── app.js            # WASM loader, editor logic
│   └── editor.wasm       # Compiled WASM (after build)
├── Cargo.toml            # Rust crate manifest
├── .cargo/config.toml    # Default target + linker flags
└── README.md

Limitations

  • URL length is practically limited by browsers (~2000-8000 chars depending on browser)
  • Very large documents may exceed URL limits
  • No syntax highlighting (plain text only)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors