Skip to content

CLI Reference

All commands are available as both mdtolink and mdtl (shorthand). For example, mdtl publish and mdtolink publish are identical. You can also use mdtl <file> as a shorthand for mdtl publish <file>.

CommandAliases
publishp, pub
unpublishrm, remove, delete
listls, l
loginauth, signin
logoutsignout

Authenticate with your MDtoLink account using the device authorization flow. Opens your browser to complete authorization, then stores the session token locally.

Terminal window
mdtolink login

Token storage: ~/.config/mdtolink/token.json (mode 0600)


Clear the stored authentication token.

Terminal window
mdtolink logout

Publish a markdown file to a shareable URL. If the file was previously published, updates the existing document (same URL).

Terminal window
mdtolink publish <file> [options]

Arguments:

ArgumentRequiredDescription
fileYesPath to the markdown file to publish

Options:

OptionDescription
--slug <slug>Custom filename (Pro+ only, e.g., meeting-notes)
--title <title>Custom document title (defaults to filename without extension)
--privatePublish as private document (Pro+ only)
--draftAlias for --private

Examples:

Terminal window
# Basic publish
mdtolink publish notes.md
# With custom title
mdtolink publish notes.md --title "Sprint Retro Notes"
# With custom filename (Pro+)
mdtolink publish notes.md --slug sprint-retro
# Publish as private (Pro+)
mdtolink publish notes.md --private
mdtolink publish notes.md --draft

Behavior:

  • If not logged in, prompts to authorize before publishing
  • If the file was previously published from this machine, updates the existing document
  • Stores the file-to-document mapping in ~/.config/mdtolink/documents.json

Remove a published document. Can be used with a file path, slug, or interactively.

Terminal window
mdtolink unpublish [file-or-slug]

Arguments:

ArgumentRequiredDescription
file-or-slugNoFile path or document slug. If omitted, shows interactive picker.

Examples:

Terminal window
# By file path
mdtolink unpublish notes.md
# By slug
mdtolink unpublish my-notes
# Interactive mode
mdtolink unpublish

Interactive mode:

  • Shows your 5 most recent documents as checkboxes (spacebar to toggle)
  • Includes an option to enter a slug manually
  • Confirms before deleting

List your published documents in a formatted table.

Terminal window
mdtolink list [options]

Options:

OptionDefaultDescription
--limit <n>20Number of documents to show (1-100)
--offset <n>0Number of documents to skip

Example:

Terminal window
mdtolink list --limit 10

Output columns: Title, Slug, Status, Views, Created


Show help information and available commands.

Terminal window
mdtolink help
mdtolink --help
mdtolink <command> --help

VariableDefaultDescription
MDTOLINK_SERVER_URLhttps://api.mdtolink.comMDtoLink API server URL
MDTOLINK_APP_URLhttps://app.mdtolink.comBase URL for published document links

All configuration is stored in ~/.config/mdtolink/:

FileDescription
token.jsonAuthentication token from mdtolink login
documents.jsonMapping of local file paths to published document IDs

Both files are created with 0600 permissions (owner read/write only).

{
"/path/to/file.md": {
"documentId": "abc123",
"slug": "xk9f2m",
"url": "https://mdtolink.com/d/xk9f2m",
"lastPublished": "2026-03-01T12:00:00.000Z"
}
}

Keys are absolute file paths, resolved at publish time. This enables idempotent updates — publishing the same file always updates the same document.