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
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,16 @@
10
10
*[Configuration](#configuration)
11
11
*[License](#license)
12
12
13
-
## hackmd-cli v2 notice
13
+
## v2 notice
14
14
15
-
hackmd-cli v2 only supports the official HackMD instance([hackmd.io](https://hackmd.io)) and other enterprise edition instances after version `1.38.1`. CodiMD is not supported anymore. If you want to use CLI tools with CodiMD, please see the [`v1.x` README](https://github.com/hackmdio/hackmd-cli/tree/v1.2.0) and follow the instruction there.
15
+
`hackmd-cli` v2 now only supports the official HackMD instance([hackmd.io](https://hackmd.io)) and HackMD EE instances after version `1.38.1`. CodiMD is not supported anymore. If you want to use the CLI tools with CodiMD, please check out the [`v1.x` README](https://github.com/hackmdio/hackmd-cli/tree/v1.2.0) and follow the instruction there.
16
+
17
+
### Migrating from v1.x
18
+
19
+
1. If you are using the CLI with CodiMD, please follow the [`v1.x` README](https://github.com/hackmdio/hackmd-cli/tree/v1.2.0)
20
+
2. If you are using the CLI with HackMD([hackmd.io](https://hackmd.io)) or HackMD EE(Enterprise Edition) instances:
21
+
***You're using the JSON file-based config**: Remove `~/.hackmd/config.json` and start over again. You can start with [configuration](#configuration) section.
22
+
***You're using environment variable based config**: `HMD_CLI_SERVER_URL` has been replaced with `HMD_API_ENDPOINT_URL`. And `HMD_API_ENDPOINT_URL` may vary depending on your instance. Please check contact your instance admin to get the correct `HMD_API_ENDPOINT_URL`. For generating access token, please check the [configuration](#configuration) section. You'll need to set the `HMD_API_ACCESS_TOKEN` environment variable.
16
23
17
24
## Usage
18
25
<!-- usage -->
@@ -32,27 +39,34 @@ USAGE
32
39
## Configuration
33
40
34
41
### Set access token
35
-
Access token should be set before using `hackmd-cli`. It can be created by landing [hackmd.io](https://hackmd.io) -> Setting -> API -> Create API token. Copy the token and set it as config variable.
36
-
#### Example:
37
42
38
-
Set environment variable by command:
43
+
Access token should be set before using `hackmd-cli`. It can be created by landing [hackmd.io](https://hackmd.io) -> [Setting](https://hackmd.io/settings#api) -> [API](https://hackmd.io/settings#api) -> Create API token. Copy the token and set it as config variable. For more details, please follow the tutorial: [How to issue an API token](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2Fhow-to-issue-an-api-token).
44
+
45
+
#### Example:
46
+
47
+
Set environment variable by command:
48
+
39
49
```sh-session
40
50
$ hackmd-cli login
41
-
Enter your accesstoken: My_ACCESS_TOKEN
51
+
Enter your access token: My_ACCESS_TOKEN
42
52
```
43
53
44
54
Or in your shell profile:
55
+
45
56
```bash
46
57
export HMD_API_ACCESS_TOKEN=MY_ACCESS_TOKEN
47
58
```
48
59
49
60
Or in JSON file (`~/.hackmd/config.json`):
61
+
50
62
```json
51
63
{
52
64
"accessToken": "MY_ACCESS_TOKEN"
53
65
}
54
66
```
55
-
### Set self-hosted API endpoint (optional)
67
+
68
+
### Specify HackMD API endpoint manually (optional)
69
+
56
70
`hackmd-cli` operates on official HackMD API endpoint (`https://api.hackmd.io/v1`) by default. If you want to use cli with a self-hosted [HackMD EE](https://hackmd.io/pricing) instance and API endpoint, you will need to configure `hackmd-cli` by either environment variable or JSON configuration.
0 commit comments