Payas Editor

Payas Editor

A modern, multi-tab WYSIWYG rich-text editor that saves as clean Markdown. No frameworks. No server. No tracking. Just write.

v3.0.0 MIT License Offline Ready Single HTML File No Install

What is Payas Editor?

Payas Editor is a single-file web application — open payas-editor.html in any modern browser and you instantly have a fully-featured writing environment. It works completely offline, stores everything in your browser, and exports clean Markdown files.

✍️

Writers & Bloggers

Draft posts with rich formatting, export to Markdown for static site generators.

💻

Developers

Take notes with code blocks; edit .md files without a heavy IDE.

🎓

Students

Write assignments locally — no account, no cloud, no data leaks.

🔒

Privacy-Focused

Zero telemetry. Nothing leaves your device. Ever.

Core Philosophy

PrincipleWhat it means for you
Privacy firstNothing is sent to any server
Zero runtime dependenciesNo CDN calls needed after first load
PortableCopy one HTML file anywhere and it works
WYSIWYG → MarkdownWrite naturally; get clean Markdown output

Getting Started

Open the Editor

Double-click  payas-editor.html

That's it. No installation, no build step, no terminal.

💡
For offline PWA support (install to home screen), serve the file over localhost or HTTPS.

Your First Document

  1. The editor opens with a blank Untitled tab ready to type
  2. Start writing — the toolbar gives you formatting options
  3. Press Ctrl+S to save as a .md file
  4. Press ? anytime to see all keyboard shortcuts

Open an Existing File

Click Open in the toolbar (or drag-and-drop a .md or .txt file into the editor window) to load an existing document.

Interface Overview

┌─────────────────────────────────────────────────────────────────┐ │ [≡ Sidebar] [New] [Open] [Save] [Export] [Write|Split|Preview] │ ← Toolbar ├──────────┬──────────────────────────────────────────────────────────┤ │ │ [Tab 1 ×] [Tab 2 ×] [+ New Tab] │ ← Tab Bar │ Sidebar ├──────────────────────────────────────────────────────────┤ │ │ │ │ • Tab 1 │ Editor / Preview Area │ │ • Tab 2 │ │ │ │ Start writing… │ │ [Search] │ │ │ │ │ ├──────────┴──────────────────────────────────────────────────────────┤ │ Words: 0 | Chars: 0 | Lines: 1 | Read: <1 min │ ← Status Bar └─────────────────────────────────────────────────────────────────────┘

Toolbar Sections

SectionButtonsPurpose
NavigationSidebar toggle, New, OpenManage documents
SaveSave, Save All, ExportWrite files
Inline FormatB, I, U, S̶Text style
Block FormatH1–H6, ¶, Code, QuoteBlock type
InsertLink, Image, Table, HRInsert elements
ListUL, OL, Indent, OutdentList controls
AlignLeft, Center, Right, JustifyText alignment
ViewWrite, Split, PreviewLayout mode
UtilityFind, Theme, Settings, Keys, AboutApp controls

Editing Features

Text Formatting

FormatKeyboardMarkdown Output
BoldCtrl+B**text**
ItalicCtrl+I*text*
UnderlineCtrl+U<u>text</u>
Strikethrough~~text~~
Inline CodeCtrl+``text`
Text Color<span style="color:…">
Highlight<mark style="…">

Block Formatting

BlockShortcutMarkdown
Heading 1Ctrl+Alt+1# Title
Heading 2Ctrl+Alt+2## Title
Heading 3–6Ctrl+Alt+3–6### …
ParagraphCtrl+Alt+0plain text
Code BlockCtrl+Alt+C```…```
BlockquoteCtrl+Alt+Q> text

Inserting Elements

Lists

View Modes

Switch between three layouts using the buttons in the top-right of the toolbar.

✏️

Write Mode

Full-width editor. No distractions. Just type. This is the default mode.

⬛⬜

Split Mode

Side-by-side: editor on the left, live Markdown preview on the right. Drag the divider to resize.

👁️

Preview Mode

Read-only Markdown render. Check how your document looks when published.

💡
In Split and Preview modes, clicking a heading in the preview panel jumps to that section in the editor.

Tab Management

Payas Editor lets you work on many documents at once — each in its own tab.

Tab Operations

ActionHow
New tabClick + in the tab bar, or press Ctrl+T
Close tabClick × on the tab, or press Ctrl+W
Switch tabClick a tab, or use Ctrl+Tab / Ctrl+Shift+Tab
Rename tabDouble-click the tab name
Duplicate tabRight-click → Duplicate
Reorder tabsDrag a tab to a new position

Sidebar

Press Ctrl+\ or click the sidebar button to toggle the document list panel. Use the search box at the top to filter tabs by name. A dot indicator shows which tabs have unsaved changes.

Auto-Save

All tab content is saved to your browser's localStorage automatically every 30 seconds. If your browser closes unexpectedly, your work is recovered on next open.

⚠️
Auto-save to localStorage is not the same as exporting a .md file. Use Ctrl+S to write a file to disk.

Find & Replace

Press Ctrl+F to open the Find & Replace panel.

Press Escape to close the panel.

Export & Save

Save as Markdown — Ctrl+S

Converts editor content to clean Markdown and downloads a .md file. The filename defaults to the tab name.

Export Formats

Click Export in the toolbar to choose a format:

FormatExtensionContents
Markdown.mdClean Markdown syntax
Plain Text.txtContent without any markup
HTML.htmlStyled, self-contained web page
The HTML export includes embedded styles — great for sharing with non-technical readers who just need to open it in a browser.

Keyboard Shortcuts

Press ? in the editor to open the interactive shortcut reference.

File Operations

Save current tabCtrlS
Save all tabsCtrlS
Open fileCtrlO
New tabCtrlT
Close tabCtrlW

Navigation

Next tabCtrlTab
Previous tabCtrlTab
Toggle sidebarCtrl\
Find & ReplaceCtrlF
Show shortcuts?

Text Formatting

BoldCtrlB
ItalicCtrlI
UnderlineCtrlU
Inline codeCtrl`
Heading 1CtrlAlt1
Heading 2CtrlAlt2
Heading 3CtrlAlt3
Code blockCtrlAltC
BlockquoteCtrlAltQ
ParagraphCtrlAlt0
UndoCtrlZ
RedoCtrlY

Settings & Customization

Click the Settings (gear) icon to open the preferences panel.

Appearance

SettingOptionsDefault
ThemeLight / DarkLight
Editor Font Size11–24 px15 px
Line Height1.3–2.41.8
Editor WidthFull, 820 px, 680 px820 px
Sidebar Width200 / 240 / 280 / 320 px240 px

Behavior

SettingDefaultDescription
Spell CheckOnBrowser spell checker underlines typos
Auto-SaveOnSaves to localStorage every 30 s
Focus ModeOffHides toolbar while typing
Live Markdown SyncOnRefreshes preview as you type
Confirm on CloseOnWarns before closing unsaved tabs

All settings are saved automatically and persist between sessions.

Offline & PWA Support

Payas Editor includes a Service Worker (sw.js) that caches all necessary assets after the first visit.

What This Means

Install as a Native App

When served over HTTPS or localhost, browsers offer an "Install" prompt:

BrowserHow to Install
Chrome / EdgeClick the install icon in the address bar
Safari (iOS)Share → Add to Home Screen
Android (Chrome)Browser menu → Add to Home Screen

For Developers

This section covers the internals for contributors or developers who want to understand, embed, or extend Payas Editor.

Project Structure

payas-editor/ ├── payas-editor.html ← Entire application (HTML + CSS + JS) ├── manifest.json ← PWA manifest (name, icons, theme color) ├── sw.js ← Service Worker (cache-first offline strategy) ├── assets/ │ ├── bootstrap-icons.min.css ← Icon stylesheet │ └── fonts/ │ └── bootstrap-icons.woff2 ← Icon font (served locally) └── icons/ ├── icon.svg ← Vector source icon ├── icon-192.png ← PWA icon └── icon-512.png ← PWA splash icon

Technology Stack

LayerTechnology
UIVanilla HTML5 + CSS3 (custom properties)
LogicVanilla ES2020 JavaScript
Rich Textcontenteditable + Selection API
PersistencelocalStorage
OfflineService Worker (Cache API)
IconsBootstrap Icons 1.11.3 (local)
FontsJetBrains Mono, Fraunces, DM Sans

Code Architecture

Everything lives in payas-editor.html, organized in clearly labeled sections:

payas-editor.html │ ├── <head> │ ├── CSS Custom Properties (design tokens) │ ├── Layout, Toolbar, Editor, Sidebar, Modal styles │ └── Status bar styles │ └── <body> ├── #toolbar ← top action bar ├── #main-container │ ├── #sidebar ← document list panel │ ├── #tab-bar ← tab strip │ └── #editor-area ← contenteditable + markdown preview ├── #status-bar ← word/char/line count ├── Modals ← settings, find/replace, shortcuts, about │ └── <script> ├── State variables ├── Tab management functions ├── Editor event handlers ├── Toolbar sync (debounced with rAF) ├── Markdown converter (custom DOM walker) ├── Find & Replace engine (TreeWalker API) ├── Settings persistence ├── Service Worker registration └── Auto-save / session restore

Performance Strategy

OperationStrategyTiming
Toolbar state syncrequestAnimationFrame debounce≤ 16 ms
Status bar updateDebounce150 ms
Markdown previewDebounce300 ms
Auto-saveChange-signature check + interval30 s

localStorage Keys

KeyContents
payas-tabsJSON array of all open tab objects
payas-active-tabID of the currently focused tab
payas-settingsJSON object of user preferences
payas-split-ratioFloat (0–1) for split pane divider position

Adding a New Toolbar Button

  1. Add a <button> inside #toolbar with a title attribute and bi-* icon class
  2. Add a click handler in the script section using addEventListener('click', ...)
  3. Call document.execCommand(...) or manipulate the Selection/Range API
  4. If the button state should reflect cursor context, add it to syncToolbar()

Extending the Markdown Converter

The converter entry point is toMarkdown(element). serializeNode(node, context) is called recursively. To support a new HTML element, add a case inside the switch (node.nodeName) block:

case 'YOUR-TAG':
  return `your-markdown-syntax${children}your-markdown-syntax`;

Updating the Service Worker Cache

After releasing new files, bump CACHE_NAME at the top of sw.js to force all clients to re-download:

const CACHE_NAME = 'payas-editor-v4'; // increment on each release

Deploying

There is no build step. Copy the entire directory to any web server or CDN. The application is a single static file bundle.

# Serve locally for PWA testing
npx serve .
# or
python3 -m http.server 8080

FAQ

Is my data safe?

Yes. Everything stays in your browser. No data is sent to any server. There is no analytics, no telemetry, and no user accounts.

Where are my files stored?

In-progress work is stored in localStorage. Exported files go to your Downloads folder as regular files on your computer.

Can I use it on mobile?

Yes. The UI is fully responsive. For the best experience, install it as a PWA from Safari (iOS) or Chrome (Android) to get a native app feel.

What happens if I clear my browser data?

localStorage is wiped, so unsaved tabs are lost. Always export important documents as .md files to keep permanent copies on disk.

Does it support Markdown extensions (tables, task lists)?

Yes — GitHub-Flavored Markdown (GFM) including tables, task lists, strikethrough, and fenced code blocks are all supported.

Can I open multiple browser tabs with the editor?

Yes, but localStorage is shared between tabs, so changes in one browser tab may overwrite another. Use the in-app multi-tab system instead.

The editor is slow with very large documents. Why?

The Markdown preview does a full DOM walk on every keystroke (debounced to 300 ms). For very large files (100k+ words), switch to Write mode to disable the live preview and regain speed.

How do I contribute?

The project is MIT-licensed. Open an issue or pull request on the project repository. Contributions for new features, bug fixes, and documentation are all welcome.

License

Payas Editor is released under the MIT License.

MIT License

Copyright (c) Saman Udayanga Wijesinghe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

Third-Party Credits

PackageLicense
Bootstrap IconsMIT
JetBrains MonoOFL 1.1
FrauncesOFL 1.1
DM SansOFL 1.1