No description
  • JavaScript 89.6%
  • Shell 4.2%
  • Rust 4.2%
  • HTML 1.6%
  • Makefile 0.4%
Find a file
despiegk 98c0482380
Some checks failed
Build and Test / build (push) Failing after 49s
Refactor: restructure editserver as crate and update build configuration
- Moved editserver from standalone directory to crates/ directory structure
- Updated Cargo.toml and Cargo.lock with new workspace configuration
- Modified Makefile and build scripts to reflect new structure
- Updated CLAUDE.md documentation and buildenv.sh configuration
- Added new crates/ directory with refactored modules

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-04 08:30:24 +02:00
.cargo chore: migrate herolib-ai from path to git URL dependency 2026-01-30 11:32:21 -05:00
.forgejo/workflows ci: restrict test triggers to PRs and push to development/main 2026-02-11 19:10:03 -05:00
content Merge branch 'development' into development_webdav_connection 2026-02-08 07:16:51 +04:00
crates Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
scripts Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
src Merge branch 'development' into development_webdav_connection 2026-02-08 07:16:51 +04:00
.gitignore chore: migrate herolib-ai from path to git URL dependency 2026-01-30 11:32:21 -05:00
buildenv.sh Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
Cargo.lock Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
Cargo.toml Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
CLAUDE.md Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
editor-component.bundle.js feat: Add request limt handling 2026-01-29 15:07:17 +02:00
editor-component.min.js wip: Connect the frontend to hero0 2026-01-28 17:08:30 +02:00
favicon.svg feat: rebrand to Hero Editor with favicon and simplified UI 2026-01-26 06:28:35 +01:00
index.html feat: add Hero OS theme integration and improve HTML formatting 2026-01-29 08:55:05 -05:00
index2.html feat: add markdown preview toggle, remove unused servers and files 2026-01-29 10:47:59 +02:00
LICENSE Initial commit 2025-12-09 06:15:14 +00:00
Makefile Refactor: restructure editserver as crate and update build configuration 2026-03-04 08:30:24 +02:00
package.json init 2025-12-09 07:18:38 +01:00
README.md fix: correct typo - rename hhero-editor to hero-editor throughout 2026-01-26 05:47:39 +01:00
run_rs.sh chore: rename hero-editor -> hero_editor (binary, package, CI) 2026-01-29 18:59:08 -05:00

Hero Editor

A web-based file editor with syntax highlighting and live preview. Built with CodeMirror 5, marked.js, and highlight.js, with a high-performance Rust backend server.

Quick Start

# Install dependencies and build
make install

# Start the editor server
make run

Server will be available at http://localhost:2769

The editor opens with default content files to explore (README.md, GETTING_STARTED.md, examples/)

Features

  • 📝 Split-View Editor: Editor on left, live preview on right
  • 📋 Markdown Preview: Bootstrap-styled markdown rendering with syntax highlighting
  • Syntax Highlighting: Support for 9+ languages (JS, Rust, Go, HTML, YAML, TOML, etc.)
  • 🎨 Dark/Light Themes: Automatic theme detection with Bootstrap integration
  • 📊 Mermaid Diagrams: Flowcharts, sequence, class diagrams rendered in preview
  • 🌐 WebDAV Support: Remote file access via WebDAV clients (Finder, Explorer, Cyberduck)
  • 🔐 Sandboxed: Path traversal prevention, file extension whitelist
  • Fast: Single Rust binary, no external dependencies at runtime

Project Structure

├── src/                          # Web component source
│   └── editor-component.js       # Custom Element implementation
├── editserver/                   # Rust backend server
│   ├── src/main.rs               # Server implementation
│   ├── Cargo.toml                # Rust dependencies
│   └── build.sh                  # Build script
├── scripts/                      # Build scripts
│   └── minify.js                 # Minification script
├── index.html                    # Demo page with file browser
├── index2.html                   # Single file editor demo
├── dist/                         # Minified distribution (after make dist)
├── content/                      # Sandboxed document storage
└── Makefile                      # Build automation

Requirements

  • Bun - JavaScript runtime and package manager (for minifying web component)
  • Rust 1.92+ - For building the backend server

Usage Example

<script src="dist/editor-component.min.js"></script>

<code-editor
    path="readme.md"
    api-url="/api/file"
    theme="auto"
    preview="true"
></code-editor>

REST API

  • GET /api/file?path=<path> - Read file
  • POST /api/file?path=<path> - Save file
  • DELETE /api/file?path=<path> - Delete file
  • GET /api/files?path=<path> - List directory

WebDAV Access

Connect at http://localhost:2769/dav/ with credentials (default: admin/admin)

Preview & Editing

Live Markdown Preview

  • Open any .md or .markdown file
  • Split-view shows editor on left, preview on right
  • Preview updates as you type
  • Supports tables, lists, code blocks, blockquotes
  • Mermaid diagrams render in preview
  • Syntax highlighting with highlight.js

Preview Styling

  • Bootstrap 5 typography
  • Responsive tables and images
  • Code block highlighting for 50+ languages
  • Dark/light theme awareness

Directory Configuration

Hero Editor exposes one sandboxed directory containing all editable files:

Default Location

project_root/
└── content/           ← All files here are editable
    ├── README.md
    ├── GETTING_STARTED.md
    └── examples/
        └── hello.md

Change Root Directory

Use environment variables or command-line flags:

# Using environment variable
CONTENT_DIR=/path/to/my/files make run

# Or directly with the binary
./editserver/target/release/hero-editor -c /path/to/my/files

# With additional options
./editserver/target/release/hero-editor \
  -c /path/to/files \
  -p 3000 \
  --dav-user myuser \
  --dav-pass mypassword

Access Points

URL Purpose Root Directory
http://localhost:2769/ Web UI (embedded in binary) N/A
http://localhost:2769/api/file?path=README.md REST API file operations CONTENT_DIR
http://localhost:2769/dav/ WebDAV protocol access CONTENT_DIR

Security

  • Path traversal (../) is blocked
  • Only whitelisted extensions allowed
  • All files must be within CONTENT_DIR
  • Basic Auth or guest mode for WebDAV

Configuration

See CLAUDE.md for detailed documentation:

  • Web component attributes and methods
  • Rust server options and command-line flags
  • Supported languages and themes
  • Security and sandboxing details