npm install -g @hackmd/hackmd-cli
# List all personal notes
hackmd-cli notes
# Get note metadata (includes lastChangedAt)
hackmd-cli notes --noteId=<id> --output json
# Get note content (markdown)
hackmd-cli export --noteId=<id>
# List teams
hackmd-cli teams
# List team notes
hackmd-cli team-notes --teamPath=<path>
# Create note
hackmd-cli notes create --content='# Title'
# Create from file
cat file.md | hackmd-cli notes create
# Update note
hackmd-cli notes update --noteId=<id> --content='# Updated'
# Delete note
hackmd-cli notes delete --noteId=<id>
hackmd-cli team-notes create --teamPath=<path> --content='# Team Note'
hackmd-cli team-notes update --teamPath=<path> --noteId=<id> --content='...'
hackmd-cli team-notes delete --teamPath=<path> --noteId=<id>
Use hackmd-track.js (in scripts/) to detect document changes efficiently.
node scripts/hackmd-track.js add <noteId>
# Single note - outputs content only if changed
node scripts/hackmd-track.js changes <noteId>
# All tracked notes
node scripts/hackmd-track.js changes --all
# JSON output for parsing
node scripts/hackmd-track.js changes <noteId> --json
node scripts/hackmd-track.js list # Show tracked notes
node scripts/hackmd-track.js remove <noteId> # Stop tracking
node scripts/hackmd-track.js reset <noteId> # Reset (next check shows as changed)
hackmd-track.js add stores note's lastChangedAt timestamphackmd-track.js changes compares current lastChangedAt with stored value--verbose for status)State stored in ./.hackmd/tracked-notes.json (current working directory)
When using --output json, notes include:
| Field | Description |
|---|---|
| ---------------- | ---------------------------------------- |
lastChangedAt | Unix timestamp of last modification |
lastChangeUser | {name, userPath, photo} of last editor |
titleUpdatedAt | When title changed |
tagsUpdatedAt | When tags changed |
共 1 个版本