Skip to content

Create beautiful images of your markdown with OS window simulations, Fira Code ligatures, Mermaid diagrams, and KaTeX math. 56KB buildless single-file app.

License

Notifications You must be signed in to change notification settings

sandikodev/snapcode

SnapCode

License: MIT PRs Welcome GitHub Stars

ngode-ngide kode ngadi-ngadi

Create beautiful images of your markdown with authentic OS window simulations, Fira Code ligatures, Mermaid diagrams, and KaTeX math formulas.

🌐 Live Demo: sandikodev.github.io/snapcode

Features β€’ Quick Start β€’ Contributing β€’ License


πŸ’« A 10-Year Celebration

This project celebrates 10 years (2016-2026) in Computer Science, specializing in Web Technology.

A journey of passion, persistence, and pure love for the craftβ€”distilled into a comprehensive learning resource.

From SMK to 10 years of experience. From dropout to DevOps engineer. From struggle to mastery.

Not for profit, but for passion. Not for certificates, but for knowledge.

πŸ“– Read the full journey


⚑ Quick Start - No Installation Required!

# Just open in browser - that's it!
open index.html

No npm, no build, no server needed! Pure client-side rendering.

πŸ’‘ Note: Python server (server.py) is OPTIONAL - only for learning dynamic file loading.
The main app works 100% in browser without any server!


✨ Features

πŸ–ΌοΈ OS Window Simulations

  • macOS Sequoia - Latest macOS with gradient backdrop blur
  • macOS Ventura - Classic macOS with traffic lights
  • Windows 11 - Modern rounded corners with centered controls
  • Windows 10 - Classic Windows with blue accent border
  • Chrome OS - Material Design with circular buttons

🎨 Themes

  • Dracula - Dark purple-gray theme
  • Monokai - Classic dark brown theme
  • GitHub - Clean light theme with proper syntax colors
  • Nord - Arctic blue-gray theme

πŸ’Ž Advanced Features

  • βœ… Fira Code Ligatures - Beautiful programming ligatures (=>, ===, !=, <=, etc)
  • βœ… Mermaid Diagrams - Flowcharts, sequence diagrams, and more
  • βœ… KaTeX Math - Inline and block mathematical formulas
  • βœ… Syntax Highlighting - Powered by Prism.js
  • βœ… Custom Scrollbars - OS-specific scrollbar styles
  • βœ… Watermark - Customizable size and opacity
  • βœ… Drag & Drop - Drop markdown files directly
  • βœ… Export PNG - High-quality 2x resolution
  • βœ… Copy Image - Copy to clipboard (Chrome/Edge)

πŸ—οΈ Architecture

SnapCode is 100% CLIENT-SIDE! No server required for main functionality.

Core Philosophy

  • βœ… Buildless - No npm, webpack, or build tools
  • βœ… Serverless - Runs entirely in browser
  • βœ… Componentless - No React/Vue/Svelte complexity
  • βœ… Single File - Just 56KB HTML file
  • βœ… CDN Dependencies - No node_modules bloat

Python Server?

The server.py is OPTIONAL and only for:

  • πŸ“š Learning dynamic file loading
  • πŸ“š Backend/DevOps study case
  • πŸ“š REST API concepts

Main app works perfectly without it!

πŸ“– Read more: ARCHITECTURE.md


πŸš€ Quick Start

Option 1: Use Online

Visit sandikodev.github.io/snapcode and start creating!

Option 2: Self-Host

# Clone or download index.html
# Open in browser - no build step required!
open index.html

That's it! No npm install, no build process, no dependencies to manage.


πŸ“– Usage

1. Write Markdown

Type or paste your markdown content in the editor.

2. Customize

  • Choose OS window style
  • Select theme
  • Adjust font size and padding
  • Enable/disable Fira Code, Mermaid, KaTeX
  • Add watermark

3. Export

  • Export PNG - Download high-quality image
  • Copy Image - Copy to clipboard (paste in Paint, Photoshop, etc)
  • Copy Text - Copy markdown source

🎯 Examples

Fira Code Ligatures

const add = (a, b) => a + b;
if (x !== y && a >= b) {
  console.log("Beautiful!");
}

Mermaid Diagrams

flowchart TD
    A[Start] --> B{Decision?}
    B -->|Yes| C[Success]
    B -->|No| D[Retry]
Loading

KaTeX Math

Inline: $E = mc^2$

Block: $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$


πŸ› οΈ Tech Stack

Core

  • Alpine.js (15KB) - Reactive UI without build step
  • Tailwind CSS (CDN) - Utility-first styling
  • Marked.js - Markdown parsing
  • DOMPurify - XSS protection

Features

  • Prism.js - Syntax highlighting
  • Mermaid.js - Diagram rendering
  • KaTeX - Math formula rendering
  • html2canvas - PNG export
  • Fira Code - Programming font with ligatures

Architecture

  • Buildless - No npm, no webpack, no vite
  • Single HTML file - 52KB total
  • CDN-based - All dependencies from CDN
  • Progressive Enhancement - Works without JavaScript (basic markdown)

🎨 Customization

Font Size

Range: 10-24px (default: 14px)

Desktop Padding

Range: 32-128px (default: 32px) Controls the space between window and desktop background.

Watermark

  • Custom text (default: @sandikodev)
  • Size: 8-24px (default: 24px)
  • Opacity: 10-100% (default: 30%)

Filename

Custom filename displayed in window title bar (default: README.md)


🌟 Why SnapCode?

vs Carbon.now.sh

  • βœ… Markdown support (not just code)
  • βœ… Mermaid diagrams
  • βœ… KaTeX math formulas
  • βœ… Multiple OS simulations
  • βœ… Offline capable (single HTML file)
  • βœ… Open source

vs Screenshot Tools

  • βœ… Authentic OS window simulations
  • βœ… Syntax highlighting
  • βœ… Customizable themes
  • βœ… High-quality export
  • βœ… No watermark (unless you want one)

πŸ“¦ File Structure

sandikodev.github.io/snapcode/
β”œβ”€β”€ index.html          # Complete app (52KB)
└── README.md          # This file

That's it! Single HTML file with everything included.


πŸ”§ Development

No Build Required

Just edit index.html and refresh browser.

Technologies Used

  • Alpine.js - Reactive state management
  • CSS-in-JS - Dynamic theme styling
  • Template Literals - Dynamic CSS generation
  • ES6+ - Modern JavaScript

Code Structure

// Alpine.js component
function app() {
  return {
    // Reactive state
    theme: 'dracula',
    fontSize: 14,
    
    // Computed properties
    get parsedMarkdown() { ... },
    get styles() { ... },
    
    // Methods
    exportImage() { ... },
    copyText() { ... }
  }
}

🀝 Contributing

Contributions are welcome! This is an open-source project built for the community.

Ways to Contribute

  • 🎨 Features - New OS themes, color themes, export formats
  • πŸ› Bug Fixes - Browser compatibility, rendering issues
  • πŸ“ Documentation - Improve clarity, add examples, translations
  • πŸ’‘ Ideas - Suggest features, share use cases

Quick Start

Since this is a single HTML file, contributing is easy:

  1. Fork the repository
  2. Edit index.html in your browser or editor
  3. Test by opening in browser (no build needed!)
  4. Submit a Pull Request

See CONTRIBUTING.md for detailed guidelines.

Code of Conduct

We follow a Code of Conduct to ensure a welcoming environment for all contributors.


πŸ“ License

MIT License - feel free to use for personal or commercial projects.


πŸ‘¨β€πŸ’» Author

@sandikodev


πŸ™ Credits

  • Alpine.js - Caleb Porzio
  • Tailwind CSS - Adam Wathan
  • Prism.js - Lea Verou
  • Mermaid.js - Knut Sveidqvist
  • KaTeX - Khan Academy
  • Fira Code - Nikita Prokopov

πŸ“Š Stats

  • File Size: 52KB (single HTML file)
  • Dependencies: 0 (all from CDN)
  • Build Time: 0 seconds (buildless)
  • Load Time: < 1 second
  • Browser Support: Modern browsers (Chrome, Firefox, Safari, Edge)

🎯 Roadmap

  • More OS themes (Ubuntu, Fedora)
  • Custom color themes
  • SVG export
  • Share via URL
  • Dark mode for UI
  • Keyboard shortcuts
  • More diagram types
  • Animation support

πŸ’‘ Use Cases

  • πŸ“š Documentation - Beautiful code examples
  • πŸŽ“ Education - Teaching materials with diagrams
  • πŸ“± Social Media - Share code snippets
  • πŸ“ Blog Posts - Code screenshots
  • 🎨 Presentations - Professional slides
  • πŸ“– Books - Technical illustrations

⚑ Performance

  • First Load: < 1s (with CDN cache)
  • Render Time: < 100ms
  • Export Time: 1-2s (depending on content)
  • Memory Usage: < 50MB
  • Bundle Size: 52KB (uncompressed)

πŸ”’ Privacy

  • βœ… No tracking
  • βœ… No analytics
  • βœ… No cookies
  • βœ… No server-side processing
  • βœ… Everything runs locally in your browser
  • βœ… Your content never leaves your device

🌐 Browser Support

Browser Version Status
Chrome 90+ βœ… Full support
Firefox 88+ βœ… Full support
Safari 14+ βœ… Full support
Edge 90+ βœ… Full support
Opera 76+ βœ… Full support

πŸ“ž Support


Made with ❀️ by @sandikodev

ngode-ngide kode ngadi-ngadi πŸš€

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages