Skip to content

md

Usage
md [-r] [--foreground] [marktext-args...] [FILE...]

Opens files in MarkText, detached from the terminal so the shell stays usable and the editor survives closing the window that launched it.

Every argument is forwarded to marktext untouched except the two flags below, which md consumes itself. marktext’s own flags (--new-window, --safe, --disable-gpu, …) therefore work exactly as documented in marktext --help.

Flags whose entire purpose is terminal output – --version, -v/--verbose and --debug – imply --foreground, since backgrounding them would send the output you asked for to /dev/null.

--read-only sandboxes the editor with firejail so saving fails instead of overwriting the file. MarkText has no read-only mode of its own.

FILE... Markdown files to open
-r, --read-only Open sandboxed, with every named file bound read-only
--foreground Run in the foreground; do not detach
-h, --help Show this help message
0 MarkText launched (or, with --foreground, exited successfully)
1 --read-only was requested without firejail or without an existing file

This file is autoloaded, so it never shadows an md function or alias defined elsewhere – fish only looks here when nothing named md exists. A real md binary would be shadowed, so md hands off to it verbatim whenever marktext is not installed.

Terminal window
md README.md
md --read-only NOTES.md
md --foreground --debug draft.md
md --new-window one.md two.md

Dependencies: marktext, firejail, bkg

Classification: uses-shadow(mkdir)