CLI Guide
The MDtoLink CLI lets you publish, update, and manage markdown documents directly from your terminal.
Installation
Section titled “Installation”Install globally via your preferred package manager:
# npmnpm install -g mdtolink
# pnpmpnpm add -g mdtolink
# bunbun add -g mdtolinkThis gives you two commands: mdtolink and mdtl (shorthand). Both work identically — use whichever you prefer.
Shorthands
Section titled “Shorthands”The CLI supports short aliases for every command, and mdtl <file> works as a shorthand for mdtl publish <file>:
# These are all equivalent:mdtolink publish notes.mdmdtl publish notes.mdmdtl p notes.mdmdtl notes.mdAll available aliases:
| Command | Aliases |
|---|---|
publish | p, pub |
unpublish | rm, remove, delete |
list | ls, l |
login | auth, signin |
logout | signout |
Authentication
Section titled “Authentication”Before publishing, authenticate with your MDtoLink account:
mdtolink loginThis opens your browser where you authorize the CLI. Once approved, your session token is stored locally at ~/.config/mdtolink/token.json.
You don’t need to login before running publish — if you’re not authenticated, the CLI will prompt you to authorize inline.
Publishing a document
Section titled “Publishing a document”mdtolink publish README.md# → Published: https://mdtolink.com/d/xk9f2mThe CLI reads the file, uploads it to your account, and returns a shareable URL.
Custom title
Section titled “Custom title”By default, the title is derived from the filename. Override it with --title:
mdtolink publish notes.md --title "Meeting Notes - March 2026"Custom filename (Pro)
Section titled “Custom filename (Pro)”Pro users can set custom filenames:
mdtolink publish notes.md --slug my-notes# → Published: https://mdtolink.com/d/my-notesPrivate documents (Pro)
Section titled “Private documents (Pro)”Pro users can publish documents that are only visible to them when signed in. Anyone else sees “Document not found.”
mdtolink publish notes.md --private# → Published (private): https://mdtolink.com/@david/notes
# --draft is an alias for --privatemdtolink publish notes.md --draftUpdating a document
Section titled “Updating a document”Publishing the same file again updates the existing document — same URL, fresh content:
# First publishmdtolink publish notes.md# → Published: https://mdtolink.com/d/xk9f2m
# Edit notes.md, then:mdtolink publish notes.md# → Updated: https://mdtolink.com/d/xk9f2mThis works because the CLI stores a local mapping between file paths and document IDs in ~/.config/mdtolink/documents.json.
Listing documents
Section titled “Listing documents”View all your published documents:
mdtolink listPaginate with --limit and --offset:
mdtolink list --limit 10 --offset 20Unpublishing
Section titled “Unpublishing”Remove a document by file path or slug:
# By file pathmdtolink unpublish notes.md
# By slugmdtolink unpublish my-notesOr run without arguments for an interactive picker:
mdtolink unpublish# Shows your recent documents with checkbox selectionLogging out
Section titled “Logging out”Clear your stored authentication token:
mdtolink logoutEnvironment variables
Section titled “Environment variables”| Variable | Default | Description |
|---|---|---|
MDTOLINK_SERVER_URL | https://api.mdtolink.com | API server URL |
MDTOLINK_APP_URL | https://mdtolink.com | Base URL for document links |