Skip to content
 
 

Latest commit

 

History

465 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTMLRunner

GitHub License TypeScript HTML5 CSS3 GitHub Actions Workflow Status

A powerful, browser-based HTML/CSS/JavaScript code editor and live preview tool. Write, test, and debug your web code with real-time execution and an integrated console.

Features

Web Code Editor

  • HTML Editor with syntax highlighting and auto-completion
  • CSS Editor with live styling preview
  • JavaScript Editor with linting and error detection
  • Syntax Highlighting powered by CodeMirror
  • Auto-indentation and bracket matching

Live Code Execution

  • Real-time Preview of your HTML/CSS/JS code
  • Auto-run Mode for instant feedback as you type
  • Error Handling with detailed stack traces
  • Console Integration for debugging

Developer Tools

  • Integrated Console with log filtering (log, error, warn, info)
  • Code Formatting using Prettier
  • Export Functionality - Download your project as a ZIP file
  • Copy to Clipboard for individual editors or console output
  • Responsive Split-Panel layout
  • State Management - Uses the Sairin path-based reactive store to manage editor content, UI state, and persistence.

User Experience

  • Dark/Light Mode toggle
  • Tabbed Interface for easy navigation
  • Persistent State - Your work is automatically saved
  • Keyboard Shortcuts for power users
  • Mobile Responsive design

Console Features

  • Real-time JavaScript console output
  • Object inspection with expandable views
  • Stack trace display for errors
  • Filter logs by type (log, error, warn, info)
  • Copy individual messages or entire console
  • Timestamp for each log entry

Gallery

Screenshot 2025-07-29 at 12 44 17 PM Screenshot 2025-07-29 at 12 44 27 PM Screenshot 2025-07-29 at 12 44 44 PM

Getting Started

Online Version

Visit the live version at: https://htmltoolkit.github.io/HTMLRunner/

Single File

You can build a single, standalone HTML file with all assets embedded:

npm run build:single

This creates a self-contained file perfect for sharing or offline use.

Usage

Basic Workflow

  1. Write HTML in the HTML editor tab
  2. Style with CSS in the CSS editor tab
  3. Add JavaScript in the JS editor tab
  4. Click "Run" or enable Auto-run for live preview
  5. Debug using the integrated console
  6. Export your project when ready

Keyboard Shortcuts

  • Ctrl/Cmd + Enter - Run code
  • Ctrl/Cmd + F and Ctrl/Cmd + H - Find or Replace code
  • Ctrl/Cmd + / - Toggle comment
  • Tab / Shift + Tab - Indent / Unindent

Sample Code

HTMLRunner comes with a demo project to get you started:

HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>My Page</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <script src="main.js"></script>
    <h1>Hello, HTMLRunner!</h1>
    <p>This is a demo page.</p>
    <button onclick="testFunction()">Click me!</button>
  </body>
</html>

CSS:

body {
  font-family: Arial, sans-serif;
  margin: 20px;
  line-height: 1.6;
}
button {
  background: #2196f3;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}
button:hover {
  background: #1976d2;
}

JavaScript:

function testFunction() {
  console.log('Button clicked!');
  console.warn('This is a warning');
  console.error('This is an error');
  console.info('This is an info');
  console.log('Object:', { name: 'Alice', age: 25, hobbies: ['coding', 'reading'] });
}

Dependencies

  • Code Editor: CodeMirror 6
  • Code Formatting: Prettier
  • UI Layout: Split.js for resizable panels
  • Build Tool: Vite for fast compilation
  • PWA Support: vite-plugin-pwa for offline support
  • Single File Build: vite-plugin-singlefile for standalone HTML

Development

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn

Local Development Setup

  1. Clone the repository

    git clone https://github.com/HTMLToolkit/HTMLRunner.git
    cd HTMLRunner/Build
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev

    This starts Vite's dev server with hot reloading at http://localhost:5173

  4. Build for production

    npm run build

    Output is in dist/

  5. Build single-file standalone version

    npm run build:single

    Creates a self-contained HTML file with all assets embedded

  6. Preview production build

    npm run preview

Contributors

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Browser Support

HTMLRunner works on all modern browsers:

  • ✅ Chrome 80+
  • ✅ Firefox 75+
  • ✅ Safari 13+
  • ✅ Edge 80+

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.


⭐ If you find HTMLRunner useful, please consider giving it a star on GitHub!

For questions, suggestions, or issues, please open an issue on GitHub.

Releases

Used by

Contributors

Languages