| name | hackmd-cli |
|---|---|
| description | HackMD command-line interface for managing notes and team notes. Use this skill when users want to create, read, update, delete, or export HackMD notes via CLI, manage team notes, list teams, view browsing history, or automate HackMD workflows. Triggers on mentions of hackmd-cli, HackMD CLI, or requests to interact with HackMD notes programmatically. |
Command-line tool for managing HackMD notes and team notes via the HackMD API.
npm install -g @hackmd/hackmd-cliCreate an API token at hackmd.io/settings#api, then configure:
# Interactive login (saves to ~/.hackmd/config.json)
hackmd-cli login
# Or via environment variable
export HMD_API_ACCESS_TOKEN=YOUR_TOKENFor HackMD EE instances, also set the API endpoint:
export HMD_API_ENDPOINT_URL=https://your.hackmd-ee.endpointhackmd-cli login # Set access token interactively
hackmd-cli logout # Clear stored credentials
hackmd-cli whoami # Show current user info# List all notes
hackmd-cli notes
# Get specific note
hackmd-cli notes --noteId=<id>
# Create note
hackmd-cli notes create --content='# Title' --title='My Note'
hackmd-cli notes create --readPermission=owner --writePermission=owner
# Create from file/stdin
cat README.md | hackmd-cli notes create
# Create with editor
hackmd-cli notes create -e
# Update note
hackmd-cli notes update --noteId=<id> --content='# New Content'
# Delete note
hackmd-cli notes delete --noteId=<id># List team notes
hackmd-cli team-notes --teamPath=<team-path>
# Create team note
hackmd-cli team-notes create --teamPath=<team-path> --content='# Team Doc'
# Update team note
hackmd-cli team-notes update --teamPath=<team-path> --noteId=<id> --content='# Updated'
# Delete team note
hackmd-cli team-notes delete --teamPath=<team-path> --noteId=<id>hackmd-cli teams # List accessible teams
hackmd-cli history # List browsing historyhackmd-cli export --noteId=<id> # Export note content to stdoutAvailable permission values:
| Permission Type | Values |
|---|---|
--readPermission |
owner, signed_in, guest |
--writePermission |
owner, signed_in, guest |
--commentPermission |
disabled, forbidden, owners, signed_in_users, everyone |
All list commands support:
--output=json # JSON output
--output=yaml # YAML output
--output=csv # CSV output (or --csv)
--no-header # Hide table headers
--no-truncate # Don't truncate long values
--columns=id,title # Show specific columns
--filter=name=foo # Filter by property
--sort=title # Sort by property (prepend '-' for descending)
-x, --extended # Show additional columns# Create new note from file
cat doc.md | hackmd-cli notes create --title="My Doc"
# Update existing note from file
cat doc.md | hackmd-cli notes update --noteId=<id>hackmd-cli export --noteId=<id> > note.mdhackmd-cli notes --output=json | jq '.[] | .id'hackmd-cli notes --filter=title=README