You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+84-49Lines changed: 84 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,67 +7,66 @@ For more background, see the initial [discussion](https://github.com/hackmdio/co
7
7
*There is an alternative, TypeScript-based CodiMD CLI for `hackmdio/codimd` maintained by the HackMD team here: https://github.com/hackmdio/codimd-cli.*
8
8
*(it may or may not be compatible with the `hedgedoc/hedgedoc` server)*
9
9
10
-
## Install
10
+
## Installation
11
11
12
-
Dependencies:
13
-
- A HedgeDoc server running somewhere
14
-
-`curl` (install via `apt install curl` or `brew install curl` on Mac)
15
-
-`wget` (install via `apt install wget` or `brew install wget` on Mac)
16
-
-`jq` (install via `apt install jq` or `brew install jq` on Mac)
12
+
### Dependencies
17
13
18
-
```bash
19
-
git clone https://github.com/hedgedoc/cli
20
-
cd cli/bin
21
-
# optionally symlink the hedgedoc script somewhere into your $PATH
22
-
ln -s $PWD/hedgedoc /usr/local/bin/hedgedoc
23
-
24
-
# set HEDGEDOC_SERVER environment variable to your server's URL
-`curl` (install via `apt install curl` or `brew install curl` on Mac)
16
+
-`wget` (install via `apt install wget` or `brew install wget` on Mac)
17
+
-`jq` (install via `apt install jq` or `brew install jq` on Mac)
32
18
33
-
##Documentation
19
+
### Instructions
34
20
35
-
### Create/import a new note
36
-
```bash
37
-
$ hedgedoc import <input_path> [note_id] # takes a local path to a text file, and an optional note id for the new note
38
-
qhmNmwmxSmK1H2oJmkKBQQ # returns <note_id> on success
39
-
```
21
+
Clone the repository.
40
22
41
-
You can open the new note on the server by going to `$HEDGEDOC_SERVER/<note_id>`.
23
+
$ git clone https://github.com/hedgedoc/cli
42
24
43
-
The optional `note_id` is only available on servers with `allowFreeURL`
44
-
enabled.
45
-
Check the [documentation](https://docs.hedgedoc.org/configuration/#users-and-privileges)
46
-
for more information.
25
+
Enter the folder with the script.
47
26
48
-
### Publish an existing note
27
+
$ cd cli/bin
49
28
50
-
```bash
51
-
$ hedgedoc publish qhmNmwmxSmK1H2oJmkKBQQ # takes a <note_id>
52
-
S1ok9no3f # returns public note id
53
-
```
54
-
You can open the published note on the server by going to `$HEDGEDOC_SERVER/s/<public_note_id>`.
29
+
Optionally 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)!
55
30
56
-
### Export an existing note
31
+
$ ln -s $PWD/hedgedoc /usr/local/bin/hedgedoc
57
32
58
-
```bash
59
-
$ hedgedoc export --pdf qhmNmwmxSmK1H2oJmkKBQQ # takes a <note_id>, outputs to <note_id>.pdf by default
60
-
$ hedgedoc export --md qhmNmwmxSmK1H2oJmkKBQQ my_note.md # or you can specify an output path explicitly
Check if the new command exists. You should see the documentation
34
+
35
+
$ hedgedoc
36
+
37
+
Set `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`.
If you added the variable to `.profile` or `.bashrc`, re-open the terminal to read the new variable.
42
+
43
+
Test your configuration by creating a new note with FREELY access and no login required. You will receive the generated `<note_id>` for the document like `3jXcabSfSNesbH6KT72ieg`.
44
+
45
+
**Caution: You won't have the right to delete the new document if not authenticated!**
46
+
47
+
$ echo "# HedgeDoc!" > test.md
48
+
$ hedgedoc import test.md
49
+
50
+
Check for the document in the browser by concatenating the
51
+
address of your server and the `<note_id>`.
52
+
53
+
## Configuration and usage
54
+
55
+
### Variants of authentication
56
+
57
+
It'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.
58
+
59
+
#### Authenticate with cookie
64
60
65
-
### Authenticate and get notes history
61
+
Authentication 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`.
62
+
63
+
Possible you have many lines in `key.conf`. You only need the line with `connect.sid` followed by a long hash!
64
+
65
+
Optionally add the HEDGEDOC_COOKIES_FILE environment variable to specify where cookies will be stored. It defaults to `~/.config/hedgedoc/key.conf`
66
66
67
67
```bash
68
-
# optionally add the HEDGEDOC_COOKIES_FILE environment variable to specify
69
-
# where cookies will be stored. It defaults to ~/.config/hedgedoc-cli/key.conf
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 HedgeDoc.
0 commit comments