hackmd-cli
operates on official HackMD instance(hackmd.io
) by default. If you want to use cli with a self-hosted CodiMD or a HackMD EE instance, you will need to configure hackmd-cli
by either environment variable or JSON configuration.
Set environment variable in your shell profile:
Or in JSON file (~/.hackmd/config.json
):
Set environment variable in your shell profile:
Or in JSON file (~/.hackmd/config.json
):
All available configurations are listed in the table below.
Config key | Environment Variable | Data Type | Example Value | Description |
---|---|---|---|---|
serverUrl |
HMD_CLI_SERVER_URL or CMD_CLI_SERVER_URL |
string |
https://my.codimd-domain.dev |
The instance URL |
cookiePath |
HMD_CLI_COOKIE_PATH or CMD_CLI_COOKIE_PATH |
string |
~/.hackmd/cookies.json |
File for storing login cookie states |
enterprise |
n/a | boolean |
true |
Set whether the instance is enterise version expclitly. This config can only be set in JSON based config. When providing server url with environment variable, enterprise will be automatically set by checking the env prefix(HMD or CMD ) |
n/a | HMD_CLI_ID or CMD_CLI_ID |
string |
me@codimd-domain.dev |
Login username/email |
n/a | HMD_CLI_PASSWORD or CMD_CLI_PASSWORD |
string |
dragon |
Login password |
Don't commit your login credentials!
hackmd-cli export [NOTEID] [OUTPUT]
hackmd-cli help [COMMAND]
hackmd-cli history
hackmd-cli import [FILE]
hackmd-cli login
hackmd-cli logout
hackmd-cli whoami
hackmd-cli export [NOTEID] [OUTPUT]
Export note to local file or stdout(if the output_file param is omitted)
See code: src/commands/export.ts
hackmd-cli help [COMMAND]
display help for hackmd-cli
See code: @oclif/plugin-help
hackmd-cli history
List history
See code: src/commands/history.ts
hackmd-cli import [FILE]
Create a note from markdown file
See code: src/commands/import.ts
hackmd-cli login
Login HackMD instance from CLI
See code: src/commands/login.ts
hackmd-cli logout
Logout from CLI
See code: src/commands/logout.ts
hackmd-cli whoami
Show logged in account info
See code: src/commands/whoami.ts
hackmd-cli
piping modeYou can create a note by piping text stream to hackmd-cli
MIT