Overview
Single file mode is the simplest way to use Markdown-OS. Point it at a single markdown file and start editing immediately in a local web interface.Opening a File
Open a markdown file
Use the The editor will automatically open in your default browser at
open command with a path to any .md or .markdown file:http://127.0.0.1:8000.If the file doesn’t exist, you’ll see an error. Create the file first with
touch notes.md or use the example command to generate a showcase file.File Validation
Markdown-OS validates your file path before starting the server:- File must exist - Non-existent files are rejected
- Must be a file - Directories require directory mode
- Must have markdown extension - Only
.mdand.markdownfiles are supported
Server Options
Custom Host and Port
By default, the server binds to127.0.0.1:8000. You can customize this:
Port Auto-increment
If your preferred port is occupied, Markdown-OS automatically tries the next available port:File Operations
Reading Files
Files are read with shared locks (LOCK_SH) using the portalocker library. Multiple processes can read simultaneously, ensuring safe concurrent access.
Saving Files
When you edit content, saves happen atomically:Atomic write
Content is written to a temporary file, synced with
fsync(), then atomically moved to replace the original file using os.replace()External File Changes
Markdown-OS watches your file for external modifications using thewatchdog library:
- WebSocket notification - The server sends a real-time update to your browser
- Conflict detection - If you have unsaved changes, you’ll see a conflict resolution dialog with three options:
- Save My Changes - Overwrite the external changes
- Discard My Changes - Load the external version
- Cancel - Keep editing without resolving
The watcher throttles events to maximum one notification per 0.2 seconds and ignores events within 0.5 seconds of internal saves to prevent self-triggered reloads.
Image Storage
Images uploaded or pasted in single file mode are stored in animages/ directory adjacent to your markdown file:
Example Workflow
Generate a feature showcase file and open it immediately:- Text formatting (bold, italic, strikethrough, code)
- Headings and table of contents
- Lists (ordered, unordered, nested)
- Code blocks with syntax highlighting
- Mermaid diagrams
- KaTeX math equations
- Tables and blockquotes
Metadata API
The server provides file metadata at/api/content:
Keyboard Shortcuts
Single file mode supports all standard editor shortcuts:Cmd/Ctrl + B- BoldCmd/Ctrl + I- ItalicCmd/Ctrl + K- Insert linkCmd/Ctrl + Z- UndoCmd/Ctrl + Shift + Z- RedoCmd/Ctrl + S- Manual save (auto-save handles this automatically)