Skip to content

A privacy-first, open-source, local-only markdown editor built with Svelte 5. Your notes never leave your device. No accounts. No tracking. No cloud.

License

Notifications You must be signed in to change notification settings

MasFana/sveltemark

Repository files navigation

SvelteMark Logo

SvelteMark

A privacy-first, open-source, local-only markdown editor built with Svelte 5.

Your notes never leave your device. No accounts. No tracking. No cloud.

Live Demo License Svelte


SvelteMark Screenshot

✨ Features

πŸ”’ Core Philosophy

  • Local-First Architecture: 100% of data lives in your browser's IndexedDB via Dexie.js.
  • Privacy Focused: Zero telemetry, no server uploads, no account required.
  • Offline Ready: Full PWA support. Install it on your device and write without internet.

⚑ Editor Capabilities

  • Live Preview: Real-time rendering with CodeMirror 6.
  • Smart Scroll Sync: Bi-directional scrolling matches your editor and preview perfectly.
  • Rich Content:
    • Diagrams: Native Mermaid.js support (Flowcharts, Sequence, Gantt).
    • Math: LaTeX equations via KaTeX.
    • GFM: Full GitHub Flavored Markdown support (Tables, Task lists, etc).
  • File System: Hierarchical file tree with drag-and-drop organization.

πŸ› οΈ Tools

  • Backup & Restore: One-click JSON export of your entire database.
  • Distraction Free: Auto-hiding UI and "View Only" modes.
  • Vim Mode: (Coming soon/Supported via CodeMirror).
  • Print Ready: CSS optimized for beautiful PDF exports (Ctrl+P).

πŸ“Έ Screenshots

Editor with Live Preview

SvelteMark Editor Screenshot Split-view editor with live markdown preview, file explorer on the left

Markdown Preview with GitHub Styling

Preview Mode Beautiful rendered markdown with GitHub-style formatting

File Explorer & Organization

File Tree Hierarchical file and folder organization with drag-and-drop support

Formatting Toolbar & Context Menu

Formatting Tools Comprehensive formatting options via toolbar and right-click context menu

Help & Keyboard Shortcuts

Help Panel Built-in help system with all keyboard shortcuts and markdown examples

Getting Started

Prerequisites

  • Node.js v18 or higher
  • pnpm (recommended) or npm/yarn
  • Modern web browser with IndexedDB support

Quick Start


πŸš€ Getting Started

# Clone the repository
git clone https://github.com/MasFana/sveltemark.git
cd sveltemark

# Install dependencies
pnpm install

# Start development server
pnpm dev

Open http://localhost:5173 in your browser.

Building for Production

# Build the application
pnpm build

# Preview the production build
pnpm preview

⌨️ Keyboard Shortcuts

Text Formatting

Shortcut Action
Ctrl+B Bold text
Ctrl+I Italic text
Ctrl+` `Inline code`
Ctrl+~ Strikethrough text
Ctrl+Shift+. Numbered list
Ctrl+. Bullet list
Ctrl+Q Block quote

Editor Control

Shortcut Action
Ctrl+H Show keyboard shortcuts panel
Ctrl+F Find and replace
Ctrl+P Print document
Ctrl+S Save now
Ctrl+/ Toggle comment
Tab Indent line
Shift+Tab Outdent line

View & Navigation

Shortcut Action
Ctrl+0 Reset zoom
F11 Enter fullscreen

Multi-Select & Selection

Shortcut Action
Ctrl+A Select all
Ctrl+D Select next occurrence
Ctrl+Shift+L Select all occurrences

Tech Stack

Project Structure

fanadown/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Editor.svelte      # CodeMirror editor component
β”‚   β”‚   β”‚   β”œβ”€β”€ Preview.svelte     # Markdown preview component
β”‚   β”‚   β”‚   β”œβ”€β”€ Sidebar.svelte     # File explorer sidebar
β”‚   β”‚   β”‚   β”œβ”€β”€ FileTree.svelte    # Recursive file tree
β”‚   β”‚   β”‚   └── Toolbar.svelte     # Formatting toolbar
β”‚   β”‚   β”œβ”€β”€ appState.svelte.ts     # Global reactive state
β”‚   β”‚   β”œβ”€β”€ db.ts                  # Dexie database operations
β”‚   β”‚   β”œβ”€β”€ markdown.ts            # Markdown processing pipeline
β”‚   β”‚   └── index.ts               # Library exports
β”‚   β”œβ”€β”€ service-worker.ts          # PWA offline caching
β”‚   └── routes/
β”‚       β”œβ”€β”€ +layout.svelte         # App layout
β”‚       └── +page.svelte           # Main page
β”œβ”€β”€ static/                        # Static assets
β”œβ”€β”€ package.json
β”œβ”€β”€ svelte.config.js
β”œβ”€β”€ vite.config.ts
└── tsconfig.json

Data Storage

SvelteMark uses IndexedDB via Dexie.js for local-first data storage. All your notes are stored in your browser and never leave your device.

Database Schema

  • folders: id, name, parentId, isOpen
  • files: id, folderId (nullable), title, content, createdAt, updatedAt

Note: folderId can be null for root-level files (files not inside any folder).

Export/Import

You can export all your data as a JSON file for backup:

  1. Click the β‹― (More) menu in the toolbar
  2. Select Export Backup
  3. Save the JSON file

To restore:

  1. Click Import Backup
  2. Select your backup JSON file

Offline Mode

SvelteMark works fully offline as a Progressive Web App (PWA).

How It Works

  • Service Worker: Caches all app assets on first visit
  • Cache-First Strategy: Assets are served from cache instantly
  • Background Updates: New versions are fetched automatically when online
  • Data Persistence: Your notes are stored locally in IndexedDB

Installing as PWA

  1. Visit the app in Chrome, Edge, or Safari
  2. Click the install icon in the address bar (or "Add to Home Screen" on mobile)
  3. Launch from your desktop or home screen
  4. Works offline - no internet required!

Notes

  • First visit requires internet to download the app
  • After installation, the app works completely offline
  • Updates are applied automatically when you're back online
  • All data stays local - nothing is sent to servers even when online

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your 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

License

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

Acknowledgments


Made with Svelte 5 | Open Source | Privacy First

About

A privacy-first, open-source, local-only markdown editor built with Svelte 5. Your notes never leave your device. No accounts. No tracking. No cloud.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published