Skip to content

Commit 58b7a4a

Browse files
committed
docs: add v1 migration guide
1 parent 5c98029 commit 58b7a4a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@
1010
* [Configuration](#configuration)
1111
* [License](#license)
1212

13-
## hackmd-cli v2 notice
13+
## v2 notice
1414

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.
1623

1724
## Usage
1825
<!-- usage -->
@@ -32,27 +39,34 @@ USAGE
3239
## Configuration
3340

3441
### 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:
3742

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+
3949
```sh-session
4050
$ hackmd-cli login
41-
Enter your accesstoken: My_ACCESS_TOKEN
51+
Enter your access token: My_ACCESS_TOKEN
4252
```
4353

4454
Or in your shell profile:
55+
4556
```bash
4657
export HMD_API_ACCESS_TOKEN=MY_ACCESS_TOKEN
4758
```
4859

4960
Or in JSON file (`~/.hackmd/config.json`):
61+
5062
```json
5163
{
5264
"accessToken": "MY_ACCESS_TOKEN"
5365
}
5466
```
55-
### Set self-hosted API endpoint (optional)
67+
68+
### Specify HackMD API endpoint manually (optional)
69+
5670
`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.
5771

5872
#### Example:

0 commit comments

Comments
 (0)