# Desktop Integration ๐Ÿ–ฅ๏ธ **๐ŸŒ Languages:** [Deutsch](DESKTOP.de.md) ยท **English** > Edit your notes with any Markdown editor on desktop --- ## ๐Ÿ“‹ Overview Desktop integration allows you to edit notes on PC/Mac: - ๐Ÿ“ Any Markdown editor works - ๐Ÿ”„ Automatic synchronization via WebDAV - ๐Ÿ’พ Dual-format: JSON (master) + Markdown (mirror) - โšก Last-Write-Wins conflict resolution --- ## ๐ŸŽฏ Why Markdown? ### Dual-Format Architecture ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Android App โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ JSON โ”‚ โ”€โ”€โ†’ โ”‚ Markdown โ”‚ โ”‚ โ”‚ โ”‚ (Master) โ”‚ โ”‚ (Mirror) โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ†“ โ†“ WebDAV Server โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ /notes/ โ”‚ โ”‚ /notes-md/โ”‚ โ”‚ *.json โ”‚ โ”‚ *.md โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ†‘ โ†‘ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Desktop Editor โ”‚ โ”‚ (VS Code, Typora, etc.) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ### Advantages **JSON (Master):** - โœ… Reliable and fast - โœ… Structured data (IDs, timestamps) - โœ… Primary sync mechanism - โœ… Always active **Markdown (Mirror):** - โœ… Human-readable - โœ… Desktop editor compatible - โœ… Syntax highlighting - โœ… Optionally activatable --- ## ๐Ÿš€ Quick Start ### 1. First Synchronization **Important:** Perform a sync FIRST before activating desktop integration! 1. **Set up app** (see [QUICKSTART.en.md](QUICKSTART.en.md)) 2. **Test server connection** 3. **Create first note** 4. **Synchronize** (pull-to-refresh or auto-sync) 5. โœ… Server automatically creates `/notes/` and `/notes-md/` folders ### 2. Activate Desktop Integration 1. **Settings** โ†’ **Desktop Integration** 2. **Toggle ON** 3. **Initial export starts** - Shows progress (X/Y) 4. โœ… All existing notes are exported as `.md` ### 3. Mount WebDAV as Network Drive #### Windows ``` 1. Open Explorer 2. Right-click on "This PC" 3. "Map network drive" 4. Enter URL: http://YOUR-SERVER:8080/notes-md/ 5. Username: noteuser 6. Password: (your WebDAV password) 7. Drive letter: Z:\ (or any) 8. Done! ``` **Access:** `Z:\` in Explorer #### macOS ``` 1. Open Finder 2. Menu "Go" โ†’ "Connect to Server" (โŒ˜K) 3. Server address: http://YOUR-SERVER:8080/notes-md/ 4. Connect 5. Username: noteuser 6. Password: (your WebDAV password) 7. Done! ``` **Access:** Finder โ†’ Network โ†’ notes-md #### Linux (GNOME) ``` 1. Open Files / Nautilus 2. "Other Locations" 3. "Connect to Server" 4. Server address: dav://YOUR-SERVER:8080/notes-md/ 5. Username: noteuser 6. Password: (your WebDAV password) 7. Done! ``` **Access:** `/run/user/1000/gvfs/dav:host=...` #### Linux (davfs2 - permanent) ```bash # Installation sudo apt install davfs2 # Create mount point sudo mkdir -p /mnt/notes-md # Mount once sudo mount -t davfs http://YOUR-SERVER:8080/notes-md/ /mnt/notes-md # Permanent in /etc/fstab echo "http://YOUR-SERVER:8080/notes-md/ /mnt/notes-md davfs rw,user,noauto 0 0" | sudo tee -a /etc/fstab ``` **Access:** `/mnt/notes-md/` --- ## ๐Ÿ“ Markdown Editors ### Recommended Editors #### 1. VS Code โญ _Recommended_ **Advantages:** - โœ… Free & open source - โœ… Markdown preview (Ctrl+Shift+V) - โœ… Syntax highlighting - โœ… Git integration - โœ… Extensions (spell check, etc.) **Setup:** ``` 1. Install VS Code 2. Mount WebDAV drive 3. Open folder: Z:\notes-md\ (Windows) or /mnt/notes-md (Linux) 4. Done! Edit Markdown files ``` **Extensions (optional):** - `Markdown All in One` - Shortcuts & preview - `Markdown Preview Enhanced` - Better preview - `Code Spell Checker` - Spell checking #### 2. Typora **Advantages:** - โœ… WYSIWYG Markdown editor - โœ… Minimalist design - โœ… Live preview - โš ๏ธ Paid (~15โ‚ฌ) **Setup:** ``` 1. Install Typora 2. Mount WebDAV 3. Open folder in Typora 4. Edit notes ``` #### 3. Notepad++ **Advantages:** - โœ… Lightweight - โœ… Fast - โœ… Syntax highlighting - โš ๏ธ No Markdown preview **Setup:** ``` 1. Install Notepad++ 2. Mount WebDAV 3. Open files directly ``` #### 4. Obsidian **Advantages:** - โœ… Second brain philosophy - โœ… Graph view for links - โœ… Many plugins - โš ๏ธ Sync conflicts possible (2 masters) **Setup:** ``` 1. Install Obsidian 2. Open WebDAV as vault 3. Caution: Obsidian creates own metadata! ``` **โš ๏ธ Not recommended:** Can alter frontmatter --- ## ๐Ÿ“„ Markdown File Format ### Structure Each note is exported as `.md` file with YAML frontmatter: ```markdown --- id: abc-123-def-456 created: 2026-01-05T14:30:22Z updated: 2026-01-05T14:30:22Z tags: [] --- # Note Title Note content here... ``` ### Frontmatter Fields | Field | Type | Description | Required | |-------|------|-------------|----------| | `id` | UUID | Unique note ID | โœ… Yes | | `created` | ISO8601 | Creation date | โœ… Yes | | `updated` | ISO8601 | Modification date | โœ… Yes | | `tags` | Array | Tags (future) | โŒ No | ### Filenames **Sanitization rules:** ``` Title: "My Shopping List ๐Ÿ›’" โ†’ Filename: "My_Shopping_List.md" Removed: - Emojis: ๐Ÿ›’ โ†’ removed - Special chars: / \ : * ? " < > | โ†’ removed - Multiple spaces โ†’ single space - Spaces โ†’ underscore _ ``` **Examples:** ``` "Meeting Notes 2026" โ†’ "Meeting_Notes_2026.md" "To-Do: Project" โ†’ "To-Do_Project.md" "Vacation โ˜€๏ธ" โ†’ "Vacation.md" ``` --- ## ๐Ÿ”„ Synchronization ### Workflow: Android โ†’ Desktop 1. **Create/edit note in app** 2. **Run sync** (auto or manual) 3. **JSON is uploaded** (`/notes/abc-123.json`) 4. **Markdown is exported** (`/notes-md/Note_Title.md`) _(only if Desktop Integration ON)_ 5. **Desktop editor shows changes** (after refresh) ### Workflow: Desktop โ†’ Android 1. **Edit Markdown file** (in mounted folder) 2. **Save** - File is immediately on server 3. **In app: Run Markdown import** - Settings โ†’ "Import Markdown Changes" - Or: Auto-import on every sync (future) 4. **App adopts changes** (if desktop version is newer) ### Conflict Resolution: Last-Write-Wins **Rule:** Newest version (by `updated` timestamp) wins **Example:** ``` App version: updated: 2026-01-05 14:00 Desktop version: updated: 2026-01-05 14:30 โ†’ Desktop wins (newer timestamp) ``` **Automatic:** - โœ… On Markdown import - โœ… On JSON sync - โš ๏ธ No merge conflicts - only complete overwrite --- ## โš™๏ธ Settings ### Desktop Integration Toggle **Settings โ†’ Desktop Integration** **ON (activated):** - โœ… New notes โ†’ automatically exported as `.md` - โœ… Updated notes โ†’ `.md` update - โœ… Deleted notes โ†’ `.md` remains (future: also delete) **OFF (deactivated):** - โŒ No Markdown export - โœ… JSON sync continues normally - โœ… Existing `.md` files remain ### Initial Export **What happens on activation:** 1. All existing notes are scanned 2. Progress dialog shows progress (e.g., "23/42") 3. Each note is exported as `.md` 4. On errors: Individual note is skipped 5. Success message with number of exported notes **Time:** ~1-2 seconds per 50 notes --- ## ๐Ÿ› ๏ธ Advanced Usage ### Manual Markdown Creation You can create `.md` files manually: ```markdown --- id: 00000000-0000-0000-0000-000000000001 created: 2026-01-05T12:00:00Z updated: 2026-01-05T12:00:00Z --- # New Desktop Note Content here... ``` **โš ๏ธ Important:** - `id` must be valid UUID (e.g., with uuidgen.io) - Timestamps in ISO8601 format - Frontmatter enclosed with `---` ### Bulk Operations **Edit multiple notes at once:** 1. Mount WebDAV 2. Open all `.md` files in VS Code 3. Find & Replace across all files (Ctrl+Shift+H) 4. Save 5. In app: "Import Markdown Changes" ### Scripting **Example: Sort all notes by date** ```bash #!/bin/bash cd /mnt/notes-md/ # Sort all .md files by update date for file in *.md; do updated=$(grep "^updated:" "$file" | cut -d' ' -f2) echo "$updated $file" done | sort ``` --- ## โŒ Troubleshooting ### "404 Not Found" when mounting WebDAV **Cause:** `/notes-md/` folder doesn't exist **Solution:** 1. **Perform first sync** - Folder is created automatically 2. OR: Create manually via terminal: ```bash curl -X MKCOL -u noteuser:password http://server:8080/notes-md/ ``` ### Markdown files don't appear **Cause:** Desktop integration not activated **Solution:** 1. Settings โ†’ "Desktop Integration" ON 2. Wait for initial export 3. Refresh WebDAV folder ### Changes from desktop don't appear in app **Cause:** Markdown import not executed **Solution:** 1. Settings โ†’ "Import Markdown Changes" 2. OR: Wait for auto-sync (future feature) ### "Frontmatter missing" error **Cause:** `.md` file without valid YAML frontmatter **Solution:** 1. Open file in editor 2. Add frontmatter at the beginning: ```yaml --- id: NEW-UUID-HERE created: 2026-01-05T12:00:00Z updated: 2026-01-05T12:00:00Z --- ``` 3. Save and import again --- ## ๐Ÿ”’ Security & Best Practices ### Do's โœ… - โœ… **Backup before bulk edits** - Create local backup - โœ… **One editor at a time** - Don't edit in app AND desktop in parallel - โœ… **Wait for sync** - Run sync before desktop editing - โœ… **Respect frontmatter** - Don't change manually (unless you know what you're doing) ### Don'ts โŒ - โŒ **Parallel editing** - App and desktop simultaneously โ†’ conflicts - โŒ **Delete frontmatter** - Note can't be imported anymore - โŒ **Change IDs** - Note is recognized as new - โŒ **Manipulate timestamps** - Conflict resolution doesn't work ### Recommended Workflow ``` 1. Sync in app (pull-to-refresh) 2. Open desktop 3. Make changes 4. Save 5. In app: "Import Markdown Changes" 6. Verify 7. Run another sync ``` --- ## ๐Ÿ“Š Comparison: JSON vs Markdown | Aspect | JSON | Markdown | |--------|------|----------| | **Format** | Structured | Flowing text | | **Readability (human)** | โš ๏ธ Medium | โœ… Good | | **Readability (machine)** | โœ… Perfect | โš ๏ธ Parsing needed | | **Metadata** | Native | Frontmatter | | **Editors** | Code editors | All text editors | | **Sync speed** | โœ… Fast | โš ๏ธ Slower | | **Reliability** | โœ… 100% | โš ๏ธ Frontmatter errors possible | | **Mobile-first** | โœ… Yes | โŒ No | | **Desktop-first** | โŒ No | โœ… Yes | **Conclusion:** Using both formats = Best experience on both platforms! --- ## ๐Ÿ”ฎ Future Features Planned for v1.3.0+: - โณ **Auto-Markdown-import** - Automatically on every sync - โณ **Bidirectional sync** - Without manual import - โณ **Markdown preview** - In the app - โณ **Conflict UI** - On simultaneous changes - โณ **Tags in frontmatter** - Synchronized with app - โณ **Attachments** - Images/files in Markdown --- **๐Ÿ“š See also:** - [QUICKSTART.en.md](../QUICKSTART.en.md) - App setup - [FEATURES.en.md](FEATURES.en.md) - Complete feature list - [BACKUP.en.md](BACKUP.en.md) - Backup & restore **Last update:** v1.2.1 (2026-01-05)