MarkText logoMarkTextDocs
User documentation

Command Line Interface#

plaintext
Usage: marktext [commands] [path ...]
 
  Available commands:
 
        --debug                   Enable debug mode
        --safe                    Ignore custom key bindings
    -n, --new-window              Open a new window on second-instance
        --read-only               Open the specified files in read-only mode
        --user-data-dir           Change the user data directory
        --disable-gpu             Disable GPU hardware acceleration
        --disable-spellcheck      Disable the spell checker for this session
    -v, --verbose                 Be verbose
        --version                 Print version information
    -h, --help                    Print this help message

--safe currently skips keybindings.json; it does not reset preferences or disable a plugin system. The built-in --help text still describes it more broadly.

Opening files in read-only mode

Pass --read-only before or after the files to open every file from that command in the editor's Reading Mode:

sh
marktext --read-only README.md notes.md

The option applies only to the files supplied to that invocation. It does not change the default open mode for later files, and you can switch a document back to Edit Mode from the View menu when needed. A missing file is reported as an error instead of being created as an empty read-only buffer.

Making marktext available in your shell

marktext has to point at your installation of MarkText. Where that is — and what you have to do about it — varies from platform to platform.

Linux

The .deb and .rpm packages already install /usr/bin/marktext, and the Snap exposes a marktext command, so there is nothing to set up. For the AppImage or the tarball, alias the binary you extracted:

sh
alias marktext="$HOME/Applications/marktext.AppImage"

macOS

sh
alias marktext="/Applications/marktext.app/Contents/MacOS/marktext"

Windows

Add the installation directory to your PATH — %LOCALAPPDATA%\Programs\marktext for a default install — or save a wrapper like this one as marktext.cmd in a directory that is already on it:

bat
@echo off
"%LOCALAPPDATA%\Programs\marktext\marktext.exe" %*

Do not put a symlink, a hard link or a lone copy of marktext.exe on your PATH. Chromium looks for icudtl.dat and the other bundled resources in the directory of the executable path it was launched from, and Windows reports the link's own path rather than the target's. MarkText then aborts before it starts, printing only:

plaintext
[ERROR:base\i18n\icu_util.cc:232] Invalid file descriptor to ICU data received.

Linking is safe on Linux — /usr/bin/marktext from the .deb and .rpm packages is itself a symlink into /opt/marktext — because the kernel resolves the link before the process starts.