{"id":13558634,"url":"https://github.com/hedgedoc/cli","last_synced_at":"2025-07-17T08:33:32.425Z","repository":{"id":38380574,"uuid":"138790244","full_name":"hedgedoc/cli","owner":"hedgedoc","description":"A tiny CLI for HedgeDoc","archived":false,"fork":false,"pushed_at":"2025-06-26T04:07:56.000Z","size":99,"stargazers_count":155,"open_issues_count":10,"forks_count":38,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-07-08T23:46:13.304Z","etag":null,"topics":["archiving","backup-utility","bash","cli","cli-app","codimd","codimd-cli","hedgedoc","markdown","notes"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hedgedoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-26T20:33:50.000Z","updated_at":"2025-06-30T15:33:05.000Z","dependencies_parsed_at":"2024-01-14T15:21:57.302Z","dependency_job_id":"ad93d267-3c97-449f-91c1-31f66a71f316","html_url":"https://github.com/hedgedoc/cli","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hedgedoc/cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedgedoc%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedgedoc%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedgedoc%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedgedoc%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hedgedoc","download_url":"https://codeload.github.com/hedgedoc/cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedgedoc%2Fcli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265585314,"owners_count":23792715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archiving","backup-utility","bash","cli","cli-app","codimd","codimd-cli","hedgedoc","markdown","notes"],"created_at":"2024-08-01T12:05:04.344Z","updated_at":"2025-07-17T08:33:32.406Z","avatar_url":"https://github.com/hedgedoc.png","language":"Shell","funding_links":[],"categories":["Shell","cli"],"sub_categories":[],"readme":"# hedgedoc-cli\n\nA tiny CLI to perform common operations on [HedgeDoc](https://github.com/hedgedoc/server) (the largest open-source fork of HackMD).\n\nFor more background, see the initial [discussion](https://github.com/hackmdio/codimd/issues/808) on the hackmd codimd repo.\n\n*There is an alternative, TypeScript-based CodiMD CLI for `hackmdio/codimd` maintained by the HackMD team here: https://github.com/hackmdio/codimd-cli.*  \n*(it may or may not be compatible with the `hedgedoc/hedgedoc` server)*\n\n## Installation\n\n### Dependencies\n\n- A HedgeDoc server running somewhere\n- `curl` (install via `apt install curl` or `brew install curl` on Mac)\n- `wget` (install via `apt install wget` or `brew install wget` on Mac)\n- `jq` (install via `apt install jq` or `brew install jq` on Mac)\n\n### Instructions\n\nClone the repository.\n\n    $ git clone https://github.com/hedgedoc/cli\n\nEnter the folder with the script.\n\n    $ cd cli/bin\n\nOptionally symlink the hedgedoc script somewhere into your $PATH to make it globally accessible. Otherwise you will have to provide the path to the script manually. This command might need admin rights (sudo)!\n\n    $ ln -s $PWD/hedgedoc /usr/local/bin/hedgedoc\n\nCheck if the new command exists. You should see the documentation \n\n    $ hedgedoc\n\nSet `HEDGEDOC_SERVER` environment variable to your server's URL. It defaults to `http://127.0.0.1:3000` Do this once on the command line or persist it in `.profile` and/or `.bashrc`.\n\n    $ export HEDGEDOC_SERVER='https://hedgedoc.example.com'  \n\nIf you added the variable to `.profile` or `.bashrc`,  re-open the terminal to read the new variable.\n\nTest your configuration by creating a new note with FREELY access and no login required. You will receive the generated `\u003cnote_id\u003e` for the document like `3jXcabSfSNesbH6KT72ieg`.\n\n**Caution: You won't have the right to delete the new document if not authenticated!**\n\n    $ echo \"# HedgeDoc!\" \u003e test.md\n    $ hedgedoc import test.md\n\nCheck for the document in the browser by concatenating the\n address of your server and the `\u003cnote_id\u003e`.\n\n## Configuration and usage\n\n### Variants of authentication\n\nIt's not necessary to authenticate against the server in order to make use of `hedgedoc-cli`. But without authentication you won't have access to the non-FREELY documents and everything that's accessible behind the login.\n\n#### Authenticate with cookie\n\nAuthentication with a cookie is so far the only way if you login with GitLab and the like. Use browser extensions like [Get cookies.txt](https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid) to store the cookie in `key.conf`.\n\nPossible you have many lines in `key.conf`. You only need the line with `connect.sid` followed by a long hash!\n\nOptionally add the HEDGEDOC_COOKIES_FILE environment variable to specify where cookies will be stored. It defaults to `~/.config/hedgedoc/key.conf`\n\n```bash\n# You can put this in .profile and/or .bashrc, too.\n$ export HEDGEDOC_COOKIES_FILE=~/.config/hedgedoc/key.conf\n```\n#### Authenticate with email\n\n```bash\n$ hedgedoc login --email email@example.net p4sW0rD  # takes an email and password as optional args\n$ hedgedoc login --email                            # or pass them via stdin prompt instead\n```\n\n#### Authenticate with LDAP\n\n```bash\n$ hedgedoc login --ldap username p4sW0rD            # takes a username and a password as optional args\n$ hedgedoc login --ldap                             # or pass them via stdin prompt instead\n```\n\n#### Check if authentication works\n\nIf your authentication method is set up correctly the following commands will work.\n\n### Get auth status, history, and logout\n\n```bash\n$ hedgedoc profile\nYou are logged in to a HedgeDoc server.\n\nHEDGEDOC_SERVER=https://hedgedoc.example.com\nHEDGEDOC_COOKIES_FILE=/Users/someuser/.config/hedgedoc/key.conf\n\nUSER_NAME=alice\nUSER_ID=abc93e9b-bf57-490f-a4c6-0d7a842b7cd4\nUSER_PHOTO=https://cdn.libravatar.org/avatar/ba8b1ebe25440cd38748639eebdc8eaf?s=96\n\n$ hedgedoc history\nID  Title\nfCbvG5pdSYOLobNN1SDUhg  Example-note-title\n...\n\n$ hedgedoc logout\n```\n\nYour hedgedoc auth session cookie is written to `$HEDGEDOC_COOKIES_FILE` (which defaults to `~/.config/hedgedoc/key.conf`).\n\nYou may need to log in again if:\n - your session expired\n - the hedgedoc server was restarted (which force-expires all sessions as a side-effect)\n - the  is`$HEDGEDOC_COOKIES_FILE` deleted, moved, or becomes unreadable by `hedgedoc-cli`\n\n### Create/import a new note\n\n```bash\n$ hedgedoc import \u003cinput_path\u003e [note_id]     # takes a local path to a text file, and an optional note id for the new note\nqhmNmwmxSmK1H2oJmkKBQQ                     # returns \u003cnote_id\u003e on success\n```\n\nYou can open the new note on the server by going to `$HEDGEDOC_SERVER/\u003cnote_id\u003e`.\n\nThe optional `note_id` is only available on servers with `allowFreeURL`\nenabled.\nCheck the [documentation](https://docs.hedgedoc.org/configuration/#users-and-privileges)\nfor more information.\n\n### Publish an existing note\n\n```bash\n$ hedgedoc publish qhmNmwmxSmK1H2oJmkKBQQ   # takes a \u003cnote_id\u003e\nS1ok9no3f                                 # returns public note id\n```\nYou can open the published note on the server by going to `$HEDGEDOC_SERVER/s/\u003cpublic_note_id\u003e`.\n\n### Export an existing note\n\n```bash\n$ hedgedoc export --pdf qhmNmwmxSmK1H2oJmkKBQQ             # takes a \u003cnote_id\u003e, outputs to \u003cnote_id\u003e.pdf by default\n$ hedgedoc export --md qhmNmwmxSmK1H2oJmkKBQQ my_note.md   # or you can specify an output path explicitly\n$ hedgedoc export --html qhmNmwmxSmK1H2oJmkKBQQ\n$ hedgedoc export --slides qhmNmwmxSmK1H2oJmkKBQQ my_slides.zip\n```\n\n\n## API Endpoints\n\nThese 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 HedgeDoc.\n\n - `https://\u003chedgedoc_server\u003e/login`\n - `https://\u003chedgedoc_server\u003e/logout`\n - `https://\u003chedgedoc_server\u003e/me`\n - `https://\u003chedgedoc_server\u003e/history`  (requires auth)\n - `https://\u003chedgedoc_server\u003e/new`\n - `https://\u003chedgedoc_server\u003e/new/\u003cnote_id\u003e`\n - `https://\u003chedgedoc_server\u003e/\u003cnote_id\u003e/publish`\n - `https://\u003chedgedoc_server\u003e/\u003cnote_id\u003e/download`\n - `https://\u003chedgedoc_server\u003e/\u003cnote_id\u003e/pdf`\n - `https://\u003chedgedoc_server\u003e/\u003cnote_id\u003e/slide`\n\n## Help contribute!\n\nWe'd love a PR for any one of these commands!\n\n - `hedgedoc edit \u003cnote_id\u003e \u003c new_content.md`\n - `hedgedoc inviteuser \u003cemail_to_invite\u003e`\n - `hedgedoc chmod \u003cpermissions\u003e \u003cnote_id\u003e`\n - `hedgedoc chown \u003cuser\u003e \u003cnote_id\u003e`\n - `hedgedoc delete \u003cnote_id\u003e`\n - `hedgedoc list --all` list all notes on the server by id: title\n - `hedgedoc list \u003cuser_email\u003e` list notes for a given user by id: title\n - `hedgedoc search \u003cquery\u003e` find a note ids matching a given query\n\n## Inspiration\n\nIf you want to build something with this CLI, here are some ideas that the community has requested:\n\n**Import/Export:**\n\n- **[Tests for HedgeDoc](https://github.com/hackmdio/codimd/issues/22): write some easy tests with the hedgedoc-cli**\n- [Saving to local filesystem](https://github.com/hackmdio/codimd/issues/90): this is easy with `./hedgedoc export`\n- [Export to PDF](https://github.com/hackmdio/codimd/issues/33): `./hedgedoc export --pdf \u003cnote_id\u003e \u003coutput.pdf\u003e` bam.\n- [Arbitrary file upload](https://github.com/hackmdio/codimd/issues/261): we should support this with `./hedgedoc import \u003cfile.extension\u003e`\n- [Export slides as PDF](https://github.com/hackmdio/codimd/issues/241) \u0026 https://github.com/hackmdio/codimd/issues/545: we should add this to `./hedgedoc export --slides` once it's ready\n- [Show all files in database](https://github.com/hackmdio/codimd/issues/640): `./hedgedoc list --all`\n- [Import/export file in GitHub repository](https://github.com/hackmdio/codimd/issues/218): `wget \u003cfile from github\u003e \u003e file.md; ./hedgedoc import file.md`\n- [API to download HTML](https://github.com/hackmdio/codimd/issues/515): works already `./hedgedoc export --html \u003cnote_id\u003e note.html`\n- [CLI for adding new note](https://github.com/hackmdio/codimd/pull/673): can be documented in the README with `hackmd` command\n- [\"Takeout\" feature](https://github.com/hackmdio/codimd/issues/823): ability to download all user data with `./hedgedoc export`\n\n**Permission management:**\n\n- [Support permission of invitee only](https://github.com/hackmdio/codimd/issues/35): `./hedgedoc inviteuser --permissions r \u003cuser_email\u003e` could work by first `chmod` and `chown`ing the note, then sending an email invite to that note\n- [Find the notes by the owner](https://github.com/hackmdio/codimd/issues/653): `./hedgedoc list \u003cuser_email\u003e` works as a rudimentary API to do this form the command line\n- [Add user administration](https://github.com/hackmdio/codimd/issues/272): setup a script that creates all the users \u0026 their notes from .md files on disk, `chown` \u0026 `chmod`s them to their proper permissions, then invites all the users to join.  Would be possible to run this on a timer to do regularly as well.\n\n**Sync backends:**\n\n- [Import/Export with Github](https://github.com/hackmdio/codimd/issues/34): trigger `./hedgedoc import|export` script via timer or webhook upon github file modification\n- [Import/Export with Evernote](https://github.com/hackmdio/codimd/issues/97): same deal as github/dropbox sync, write a script with import/export\n- [Support for ownCloud](https://github.com/hackmdio/codimd/issues/245): same deal as github/dropbox sync, write a script with import/export\n- [Support auto sync with dropbox](https://github.com/hackmdio/codimd/issues/124): write a script that does a full `import` and `export` or merge in whatever direction desired\n- [Support auto sync with Google Drive](https://github.com/hackmdio/codimd/issues/275): write a script that does a full `import` and `export` or merge in whatever direction desired\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedgedoc%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhedgedoc%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedgedoc%2Fcli/lists"}