Skip to content

Commit b8f9158

Browse files
xldrkpmirguest
authored andcommitted
Improve docs
Signed-off-by: Axel Dürkop <[email protected]> Signed-off-by: Tao Lin <[email protected]>
1 parent 9ed7e43 commit b8f9158

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

README.md

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,55 @@ For more background, see the initial [discussion](https://github.com/hackmdio/co
1010
## Install
1111

1212
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)
13+
14+
- A HedgeDoc server running somewhere
15+
- `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)
1718

1819
```bash
1920
git clone https://github.com/hedgedoc/cli
2021
cd cli/bin
2122
# optionally symlink the hedgedoc script somewhere into your $PATH
23+
# might need admin rights (sudo)
2224
ln -s $PWD/hedgedoc /usr/local/bin/hedgedoc
2325

26+
# check if the new command exists. You should see the documentation
27+
hedgedoc
28+
2429
# set HEDGEDOC_SERVER environment variable to your server's URL
2530
# it defaults to http://127.0.0.1:3000
31+
# do this in .profile and/or .bashrc
2632
export HEDGEDOC_SERVER='https://hedgedoc.example.com'
33+
# log out and in again to the terminal to read the new variable
2734

28-
# Test by creating a new note
29-
hedgedoc login --email
35+
# Test by creating a new note with FREELY access, no login required
36+
# You will receive the generated hash for the document
37+
# Caution: You won't have the right to delete the new document!
38+
echo "# HedgeDoc!" > test.md
3039
hedgedoc import test.md
31-
```
32-
33-
## Documentation
3440

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
41+
# check for the document in the browser by concatenating the
42+
# address of your server and the hash
3943
```
4044

41-
You can open the new note on the server by going to `$HEDGEDOC_SERVER/<note_id>`.
45+
## Documentation
4246

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.
47+
It's not necessary to authenticate against the server in order to use `hedgedoc-cli`. But without authentication you won't have access to the non-FREELY documents and everything that's accessible behind the login.
4748

48-
### Publish an existing note
49+
### Variants of authentication
4950

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>`.
51+
#### Authenticate with cookie
5552

56-
### Export an existing note
53+
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`.
5754

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
61-
$ hedgedoc export --html qhmNmwmxSmK1H2oJmkKBQQ
62-
$ hedgedoc export --slides qhmNmwmxSmK1H2oJmkKBQQ my_slides.zip
63-
```
55+
Possible you have many lines in `key.conf`. You only need the line with `connect.sid` followed by a long hash!
6456

65-
### Authenticate and get notes history
57+
Optionally add the HEDGEDOC_COOKIES_FILE environment variable to specify where cookies will be stored. It defaults to `~/.config/hedgedoc/key.conf`
6658

6759
```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
70-
$ export HEDGEDOC_COOKIES_FILE=~/.config/hedgedoc-cli/key.conf
60+
# You can put this in .profile and/or .bashrc, too.
61+
$ export HEDGEDOC_COOKIES_FILE=~/.config/hedgedoc/key.conf
7162
```
7263
#### Authenticate with email
7364

@@ -83,7 +74,11 @@ $ hedgedoc login --ldap username p4sW0rD # takes a username and a pas
8374
$ hedgedoc login --ldap # or pass them via stdin prompt instead
8475
```
8576

86-
#### Get auth status, history, and logout
77+
#### Check if authentication works
78+
79+
If your authentication method is set up correctly the following commands will work.
80+
81+
### Get auth status, history, and logout
8782

8883
```bash
8984
$ hedgedoc profile
@@ -110,6 +105,36 @@ You may need to log in again if:
110105
- your session expired
111106
- the hedgedoc server was restarted (which force-expires all sessions as a side-effect)
112107
- the is`$HEDGEDOC_COOKIES_FILE` deleted, moved, or becomes unreadable by `hedgedoc-cli`
108+
### Create/import a new note
109+
```bash
110+
$ hedgedoc import <input_path> [note_id] # takes a local path to a text file, and an optional note id for the new note
111+
qhmNmwmxSmK1H2oJmkKBQQ # returns <note_id> on success
112+
```
113+
114+
You can open the new note on the server by going to `$HEDGEDOC_SERVER/<note_id>`.
115+
116+
The optional `note_id` is only available on servers with `allowFreeURL`
117+
enabled.
118+
Check the [documentation](https://docs.hedgedoc.org/configuration/#users-and-privileges)
119+
for more information.
120+
121+
### Publish an existing note
122+
123+
```bash
124+
$ hedgedoc publish qhmNmwmxSmK1H2oJmkKBQQ # takes a <note_id>
125+
S1ok9no3f # returns public note id
126+
```
127+
You can open the published note on the server by going to `$HEDGEDOC_SERVER/s/<public_note_id>`.
128+
129+
### Export an existing note
130+
131+
```bash
132+
$ hedgedoc export --pdf qhmNmwmxSmK1H2oJmkKBQQ # takes a <note_id>, outputs to <note_id>.pdf by default
133+
$ hedgedoc export --md qhmNmwmxSmK1H2oJmkKBQQ my_note.md # or you can specify an output path explicitly
134+
$ hedgedoc export --html qhmNmwmxSmK1H2oJmkKBQQ
135+
$ hedgedoc export --slides qhmNmwmxSmK1H2oJmkKBQQ my_slides.zip
136+
```
137+
113138

114139
## API Endpoints
115140

0 commit comments

Comments
 (0)