A tiny CLI to perform common operations on CodiMD (formerly known as HackMD).
For more background, see the initial discussion on the main codimd repo.
Dependencies:
- A CodiMD server running somewhere
wget
(instiall viaapt install wget
orbrew install wget
on Mac)
git clone https://github.com/hackmdio/codimd-cli
# Add the following to your ~/.bashrc or shell profile
export PATH=/path/to/codimd-cli/bin:$PATH
# optionally add the CODIMD_SERVER environment variable to specify a server
# it defaults to 127.0.0.1:3000
export CODIMD_SERVER='https://codimd.example.com'
# Test by creating a new note
codimd import test.md
codimd import test.md # takes a markdown file
qhmNmwmxSmK1H2oJmkKBQQ # returns <note_id> on success
codimd publish qhmNmwmxSmK1H2oJmkKBQQ # takes a <note_id>
/s/S1ok9no3f # returns publish url
codimd export --pdf qhmNmwmxSmK1H2oJmkKBQQ my_note.pdf
codimd export --md qhmNmwmxSmK1H2oJmkKBQQ my_note.md
codimd export --html qhmNmwmxSmK1H2oJmkKBQQ my_note.html
codimd export --slides qhmNmwmxSmK1H2oJmkKBQQ my_slides.zip
These server endpoints are used by this project and can be unstable and undocumented, but may be of use if you're developing your own projects that need API access to CodiMD.
https://<codimd_server>/history
(requires auth)https://<codimd_server>/new
https://<codimd_server>/<note_id>/publish
https://<codimd_server>/<note_id>/download
https://<codimd_server>/<note_id>/pdf
https://<codimd_server>/<note_id>/slide
We'd love a PR for any one of these commands!
codimd inviteuser <email_to_invite>
codimd chmod <permissions> <note_id>
codimd chown <user> <note_id>
codimd delete <note_id>
codimd edit <note_id> < new_content.md
codimd list --all
list all notes on the server by id: titlecodimd list <user_email>
list notes for a given user by id: titlecodimd search <query>
find a note ids matching a given query