Overview
Markdown-OS provides seamless image handling with drag-and-drop upload, clipboard paste, and automatic storage in a dedicatedimages/ directory.
Uploading Images
Drag and Drop
Drag image files directly onto the editor:1
Drag an image file
Drag a
.png, .jpg, .jpeg, .gif, .webp, .svg, .bmp, or .ico file from your file manager onto the editor area.2
Drop to upload
The editor shows a visual drop target. Release the mouse to upload.
3
Image is inserted
The image is uploaded to
/api/images, saved to the images/ directory, and inserted at the cursor:Paste from Clipboard
Copy an image and paste it directly into the editor:1
Copy image
Copy an image from any source:
- Screenshot tools (Cmd+Shift+4 on Mac, Win+Shift+S on Windows)
- Browser right-click → Copy Image
- Image editing apps
2
Paste into editor
Click in the editor and press
Cmd/Ctrl + V3
Image is inserted
The image data is uploaded and a markdown reference is inserted at the cursor position.
Insert Menu Button
Use the toolbar to insert images by URL:- Click the Insert menu in the toolbar
- Select Image
- Enter the image URL when prompted
- Optionally enter alt text
- The markdown reference is inserted:
Upload API
Endpoint
Response
path field is the relative path used in markdown. The filename is the sanitized name with timestamp.
Implementation
The upload handler validates and processes images:Storage Location
Single File Mode
Images are stored in animages/ directory adjacent to your markdown file:
Directory Mode
Images are stored in animages/ directory at the workspace root:
The
images/ directory is created automatically on first upload. You don’t need to create it manually.Filename Sanitization
Filenames are sanitized to ensure filesystem compatibility:
Timestamps prevent filename collisions when uploading multiple images with the same name.
Supported Formats
Markdown-OS accepts these image formats:.pdf, .txt, .mp4) results in a 400 error:
Size Limits
Maximum upload size is 10 MB:- Compressing before upload using tools like ImageOptim, TinyPNG, or
imagemagick - Using external image hosting (Imgur, Cloudinary) and linking by URL
- Storing images in Git LFS for version control
Serving Images
Uploaded images are served via the/images/{filename} endpoint:
- Path traversal attempts (
../, absolute paths) are blocked - Only files within the
images/directory are accessible - Non-existent files return 404
Markdown Embedding
Images are embedded using standard markdown syntax:With Size Attributes (HTML)
For precise sizing, use HTML<img> tags:
Responsive Images
Images scale responsively in the editor using CSS:Alignment
Use HTML and inline styles for alignment:Image Management
Listing Images
Images are just files in theimages/ directory. List them with:
Deleting Images
Delete unused images manually:Markdown-OS doesn’t track image usage. Deleting an image that’s still referenced in markdown will result in a broken image link.
Finding Unused Images
Find images not referenced in any markdown file:Organizing Images
While Markdown-OS stores all images flat inimages/, you can organize them with subdirectories:
images/ directory. Manual organization is required.
External Images
You can also reference external images by URL:- Don’t count toward the 10 MB upload limit
- Load from the external server (requires internet)
- May break if the external URL changes
- Work without uploading to your workspace
Common Issues
Images Not Displaying
Cause: Incorrect relative pathSolution: Images must be in the
images/ directory. Check the path:
Upload Fails Silently
Cause: Network error or server timeoutSolution: Check browser console for errors:
400- Invalid format or empty file413- File too large (>10 MB)500- Server error (check server logs)
Drag-and-Drop Not Working
Cause: Browser security restrictions or JavaScript disabledSolution:
- Ensure JavaScript is enabled
- Try paste instead of drag-and-drop
- Check for browser extensions blocking events
Images Render Broken After Move
Cause: Image file was moved or deletedSolution: Re-upload the image or update the markdown reference to the new path.
Performance Tips
Optimize Before Upload
Reduce file sizes before uploading:Lazy Loading
The editor uses native lazy loading for images:Responsive Images
For high-DPI displays, usesrcset:
logo.png (standard) and logo@2x.png (retina) versions.