Skip to content

Commit a3646a5

Browse files
docs: update docs
1 parent d776e06 commit a3646a5

10 files changed

Lines changed: 84 additions & 690 deletions

File tree

docs/getting-started.md

Lines changed: 47 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
date: 2025-10-16 14:06:23
2+
date: 2025-11-04 23:45:00
33
title: Getting Started
44
permalink:
55
publish: true
@@ -26,135 +26,80 @@ pip install mkdocs-note
2626

2727
For more details, please refer to the [Installation | User Guide](usage/installation.md).
2828

29-
## Configuration
30-
31-
### Basic Configuration
32-
33-
For basic configuration, you can add the following to your `mkdocs.yml`:
34-
35-
```yml
36-
plugins:
37-
- mkdocs-note
38-
```
39-
40-
It's the simplest configuration, and the plugin will use the default configuration.
29+
## Use CLI to manage notes
4130

42-
### Recommended Configuration
31+
The most highlighted feature of the plugin is the CLI commands to manage notes, which can help you manage your notes with their corresponding assets **atomically**.
4332

44-
For recommended configuration, you can add the following to your `mkdocs.yml`:
33+
### Create a note
4534

46-
```yml
47-
plugins:
48-
- mkdocs-note:
49-
notes_dir: "docs/notes"
50-
index_file: "docs/index.md"
51-
start_marker: "<!-- recent_notes_start -->"
52-
end_marker: "<!-- recent_notes_end -->"
53-
max_notes: 10
54-
supported_extensions: [".md"]
55-
```
56-
57-
In general, Mkdocs Note supports highly customizable configuration, you can configure the plugin to your own needs.
58-
59-
Please refer to the [Configuration Options | User Guide](usage/config.md) for more details about the information of each configuration options.
60-
61-
## Create Your Note Boxes
62-
63-
### Manual Setup
64-
65-
1. Create the notes directory you have just configured above in your mkdocs project (e.g., `docs/notes`)
66-
67-
2. Create an `index.md` file in your notes directory manually.
68-
69-
3. Add the marker comments to your index file:
70-
71-
```markdown
72-
# My Notes
73-
74-
<!-- recent_notes_start -->
75-
<!-- recent_notes_end -->
35+
To create a note, you can use the following command:
36+
```bash
37+
mkdocs-note new /path/to/note
7638
```
7739

78-
For index files (`index.md`), the default configuration will not allow CLI tools to create it automatically, so you need to create it manually. See more details in [Exclusion](usage/exclusion.md) and [Something You Should Notice | Recent Notes Insertion](usage/recent-notes.md#Something-You-Should-Notice) about it.
79-
80-
### Use CLI Commands
81-
82-
The plugin provides several CLI commands for docs and their assets management.
83-
84-
And first of all, this is a mkdocs-based plugin, so you need to have a mkdocs project first.
85-
86-
#### Validate Structure
40+
It will create a note in the specified path and create a corresponding asset directory in the `assets` directory which will be co-located with the note.
8741

88-
Use following command to validate the structure of your docs and assets:
42+
### Remove Note or Note Directory
8943

44+
To remove a note, you can use the following command:
9045
```bash
91-
mkdocs-note validate [--path PATH]
46+
mkdocs-note remove /path/to/note-or-directory
9247
```
9348

94-
This command will check if the structure of your docs and assets is compliant with the plugin's design.
49+
It will remove the note or note directory and the corresponding asset directory(ies) from the `assets` directory, inspired by shell command `rm -rf`.
9550

96-
If there are any issues, it will report them to you.
97-
98-
#### Initialize Docs and Assets Structure
99-
100-
Use following command to initialize your mkdocs-based docs and assets structure:
51+
### Move or Rename Note or Note Directory
10152

53+
To move or rename a note or note directory, you can use the following command:
10254
```bash
103-
mkdocs-note init [--path PATH]
55+
mkdocs-note move /path/to/note-or-directory /path/to/new-location
10456
```
10557

106-
If your docs already has a structure, this command will analyze the existing asset structures and fix the non-compliant asset trees.
107-
108-
However, it will not help you move your existing assets to the new structure.
109-
110-
For example, if you have a note in `docs/notes/my-note.md`, and the asset is in `docs/assets/notes/my-note/`, this command will not help you move the asset to `docs/assets/my-note/`.
58+
It will move or rename the note or note directory and the corresponding asset directory(ies) to the new location, inspired by shell command `mv`.
11159

112-
And take a look at the entire plugin in `v2.0.0`,there has no way to move the asset to the new structure automatically, so you need to do it manually and we're now trying to add this optional feature in the future.
60+
More details, please refer to the [CLI Commands | User Guide](usage/cli.md).
11361

114-
By the way, if you're really don't want to move your existing assets to the new structure, you can puts them out of the config option `notes_dir` and use legency way to link them in order to avoid the plugin automatically managing them and cause some undefined events.
62+
## Configuration
11563

116-
#### Create New Documentation
64+
### Basic Configuration
11765

118-
Use following command to create a new documentation:
66+
For basic configuration, you can add the following to your `mkdocs.yml`:
11967

120-
```bash
121-
mkdocs-note new FILE_PATH
68+
```yml
69+
plugins:
70+
- mkdocs-note
12271
```
12372
124-
This command will create a new note file with the default template and the corresponding asset directory, which is a bit like [`hexo new`](https://hexo.io/zh-cn/docs/commands#new) command in Hexo.
73+
It's the simplest configuration, and the plugin will use the default configuration.
12574
126-
#### Remove Existing Documentation
75+
### Recommended Configuration
12776
128-
Use following command to remove an existing documentation:
77+
To use the plugin in a recommended way, you can add the following to your `mkdocs.yml`:
12978

130-
```bash
131-
mkdocs-note remove FILE_PATH
79+
```yml
80+
plugins:
81+
- mkdocs-note:
82+
recent_notes_config:
83+
enabled: true
84+
insert_marker: "<!-- recent_notes -->"
85+
insert_num: 5
86+
graph_config:
87+
enabled: true
88+
name: "title"
89+
debug: false
13290
```
13391

134-
This command will remove the documentation file and its corresponding asset directory, and before doing that, it will ask you for confirmation.
135-
136-
And you can use the alias `mkdocs-note rm` to do the same thing.
137-
138-
#### Other Commands
92+
## Recent Notes Insertion
13993

140-
There are some other commands that are not mentioned here, you can use `mkdocs-note --help/-h` or `mkdocs-note <command> --help/-h` to get the full list of commands and their usage.
94+
Mkdocs Note supports inserting specified number of recent notes to the marked placeholder in the index file, which can be configured in `mkdocs.yml` as follows:
14195

142-
#### Configuration Auto-Loading
143-
144-
All CLI commands automatically load your custom configuration from `mkdocs.yml` in the current or parent directories. You can also specify a config file explicitly using `--config` or `-c` option:
145-
146-
```bash
147-
mkdocs-note --config path/to/mkdocs.yml <command>
96+
```yml
97+
plugins:
98+
- mkdocs-note:
99+
recent_notes_config:
100+
enabled: true
101+
insert_marker: "<!-- recent_notes -->"
102+
insert_num: 5
148103
```
149104

150-
## Getting Help
151-
152-
See the [User Guide](usage/index.md) for more details about the usage and features of the plugin.
153-
154-
This project is still in its infancy stage, so any feedback or suggestions are welcome.
155-
156-
You can open an issue on [GitHub](https://github.com/virtualguard101/mkdocs-note/issues) to report bugs or request features.
157-
158-
Or you can email me directly at [virtualguard101@gmail.com](mailto:virtualguard101@gmail.com), though I may respone late because of my busy schedule.
159-
160-
Thank you for using MkDocs Note!
105+
More details, please refer to the [Recent Notes Insertion | User Guide](usage/recent-notes.md).

docs/usage/cli.md

Lines changed: 4 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,143 +2,14 @@
22
date: 2025-10-17 10:58:59
33
title: Command Line Interface
44
permalink:
5-
publish: true
5+
publish: false
66
---
77

88
# Command Line Interface
99

10-
`mkdocs-note` provides a command line interface for documentation management. You can use the command line interface to manage your documentations and their assets correspondingly.
10+
`mkdocs-note` provides a command line interface for documentation management.
1111

12-
## Overview
13-
14-
| Command | Description |
15-
|---------|-------------|
16-
| `mkdocs-note init` | Initialize the notes directory structure |
17-
| `mkdocs-note new` | Create a new note file with template content |
18-
| `mkdocs-note validate` | Validate the asset tree structure |
19-
| `mkdocs-note template` | Manage the template file |
20-
| `mkdocs-note remove`/`rm` | Remove a note file and its corresponding asset directory |
21-
| `mkdocs-note clean` | Clean orphaned assets |
22-
| `mkdocs-note move`/`mv` | Move or rename a note file or directory |
23-
24-
For overview in command line, you can use the `--help/-h` option to get the help information of all commands.
25-
```bash
26-
mkdocs-note --help
27-
# Or
28-
mkdocs-note -h
29-
```
30-
31-
For detailed information of a specific command, you can use the `mkdocs-note <command> --help` command to get the help information of a command.
32-
```bash
33-
mkdocs-note <command> --help
34-
```
35-
36-
## Configuration Auto-Loading
37-
38-
All CLI commands automatically load your custom configuration from `mkdocs.yml` in the current or parent directories. You can also specify a config file explicitly using `--config` or `-c` option:
39-
40-
```bash
41-
mkdocs-note --config path/to/mkdocs.yml <command>
42-
```
43-
44-
## Commands Details
45-
46-
### Initialize Notes Directory
47-
48-
```bash
49-
mkdocs-note init [--path PATH]
50-
```
51-
52-
- Creates the docs and assets directory structure
53-
54-
- Analyzes existing asset structures
55-
56-
- Fixes non-compliant asset trees
57-
58-
### Create New Note
59-
60-
```bash
61-
mkdocs-note new FILE_PATH [--template TEMPLATE_PATH]
62-
```
63-
64-
- Creates a new note file with template content
65-
66-
- Creates the corresponding asset directory
67-
68-
- Validates asset tree structure compliance
69-
70-
### Validate Structure
71-
72-
```bash
73-
mkdocs-note validate [--path PATH]
74-
```
75-
76-
- Checks if the asset tree structure complies with the plugin's design
77-
78-
- Reports any structural issues
79-
80-
### Template Management
81-
82-
```bash
83-
mkdocs-note template [--check] [--create]
84-
```
12+
You can use the command line interface to manage your documentations and their assets correspondingly.
8513

86-
- Check if the configured template file exists
87-
88-
- Create the template file if it doesn't exist
89-
90-
### Remove Note
91-
92-
```bash
93-
mkdocs-note remove FILE_PATH [--keep-assets] [--yes]
94-
# or use the alias
95-
mkdocs-note rm FILE_PATH [--keep-assets] [--yes]
96-
```
97-
98-
- Remove a note file and its corresponding asset directory
99-
100-
- Use `--keep-assets` to keep the asset directory
101-
102-
- Use `--yes` or `-y` to skip confirmation prompt
103-
104-
### Clean Orphaned Assets
105-
106-
```bash
107-
mkdocs-note clean [--dry-run] [--yes]
108-
```
109-
110-
- Find and remove asset directories without corresponding note files
111-
112-
- Use `--dry-run` to preview what would be removed without actually removing
113-
114-
- Use `--yes` or `-y` to skip confirmation prompt
115-
116-
- Automatically cleans up empty parent directories
117-
118-
### Move/Rename Note or Directory
119-
120-
```bash
121-
mkdocs-note move SOURCE DESTINATION [--keep-source-assets] [--yes]
122-
# or use the alias
123-
mkdocs-note mv SOURCE DESTINATION [--keep-source-assets] [--yes]
124-
```
125-
126-
- **Mimics shell `mv` behavior**:
127-
128-
- If destination doesn't exist: rename source to destination
129-
130-
- If destination exists and is a directory: move source into destination
131-
132-
- Move or rename a note file or entire directory with its asset directories
133-
134-
- Supports moving single notes or entire directories with all notes inside
135-
136-
- Example: `mkdocs-note mv docs/notes/dsa/ds/trees docs/notes/dsa` moves to `docs/notes/dsa/trees`
137-
138-
- Use `--keep-source-assets` to keep the source asset directory
139-
140-
- Use `--yes` or `-y` to skip confirmation prompt
141-
142-
- Automatically creates necessary parent directories
14+
## Overview
14315

144-
- Cleans up empty parent directories in source location

0 commit comments

Comments
 (0)