mkdocs-document-dates 0.2.0__tar.gz → 0.4.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- mkdocs_document_dates-0.4.0/PKG-INFO +110 -0
- mkdocs_document_dates-0.4.0/README.md +88 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/plugin.py +28 -3
- mkdocs_document_dates-0.4.0/mkdocs_document_dates.egg-info/PKG-INFO +110 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/setup.py +2 -2
- mkdocs_document_dates-0.2.0/PKG-INFO +0 -110
- mkdocs_document_dates-0.2.0/README.md +0 -88
- mkdocs_document_dates-0.2.0/mkdocs_document_dates.egg-info/PKG-INFO +0 -110
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/LICENSE +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/setup.cfg +0 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: mkdocs-document-dates
|
3
|
+
Version: 0.4.0
|
4
|
+
Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
|
5
|
+
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
|
+
Author: Aaron Wang
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
9
|
+
Classifier: Operating System :: OS Independent
|
10
|
+
Requires-Python: >=3.6
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: mkdocs>=1.0.0
|
14
|
+
Dynamic: author
|
15
|
+
Dynamic: classifier
|
16
|
+
Dynamic: description
|
17
|
+
Dynamic: description-content-type
|
18
|
+
Dynamic: home-page
|
19
|
+
Dynamic: requires-dist
|
20
|
+
Dynamic: requires-python
|
21
|
+
Dynamic: summary
|
22
|
+
|
23
|
+
# mkdocs-document-dates
|
24
|
+
|
25
|
+
English | [简体中文](README_zh.md)
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
A MkDocs plugin for displaying **accurate** document creation and last modification dates.
|
30
|
+
|
31
|
+
## Features
|
32
|
+
|
33
|
+
- Automatically displays document creation and last modification times
|
34
|
+
- Supports manual date specification in `Front Matter`
|
35
|
+
- No Git dependency, uses filesystem timestamps directly
|
36
|
+
- Cross-platform support (Windows, macOS, Linux)
|
37
|
+
- Configurable date and time formats
|
38
|
+
- Flexible display position (top or bottom)
|
39
|
+
- File exclusion rules support
|
40
|
+
- Material Design icons
|
41
|
+
- Elegant styling
|
42
|
+
- Lightweight with no extra dependencies
|
43
|
+
|
44
|
+
## Installation
|
45
|
+
|
46
|
+
```bash
|
47
|
+
pip install mkdocs-document-dates
|
48
|
+
```
|
49
|
+
|
50
|
+
## Configuration
|
51
|
+
|
52
|
+
Add the plugin to your mkdocs.yml:
|
53
|
+
|
54
|
+
```yaml
|
55
|
+
plugins:
|
56
|
+
- document-dates
|
57
|
+
```
|
58
|
+
|
59
|
+
Or, customize the configuration:
|
60
|
+
|
61
|
+
```yaml
|
62
|
+
plugins:
|
63
|
+
- document-dates:
|
64
|
+
date_format: '%Y-%m-%d' # Date format
|
65
|
+
show_time: false # Whether to show time
|
66
|
+
time_format: '%H:%M:%S' # Time format
|
67
|
+
position: bottom # Display position: top (after title) or bottom (end of document)
|
68
|
+
exclude: # List of file patterns to exclude
|
69
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
70
|
+
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
71
|
+
- "temp.md" # Exclude specific file
|
72
|
+
- "*.tmp" # Exclude all files with .tmp extension
|
73
|
+
```
|
74
|
+
|
75
|
+
## Manual Date Specification
|
76
|
+
|
77
|
+
You can also manually specify the date of a Markdown document in its `Front Matter` :
|
78
|
+
|
79
|
+
```yaml
|
80
|
+
---
|
81
|
+
created_date: 2023-01-01
|
82
|
+
modified_date: 2023-12-31
|
83
|
+
---
|
84
|
+
|
85
|
+
# Document Title
|
86
|
+
```
|
87
|
+
|
88
|
+
## Configuration Options
|
89
|
+
|
90
|
+
- `date_format`: Date format (default: %Y-%m-%d)
|
91
|
+
- Supports all Python datetime format strings, examples: %Y-%m-%d, %b %d, %Y, etc.
|
92
|
+
- `show_time`: Whether to show time (default: false)
|
93
|
+
- true: Show both date and time
|
94
|
+
- false: Show date only
|
95
|
+
- `time_format`: Time format (default: %H:%M:%S)
|
96
|
+
- Only effective when show_time is true
|
97
|
+
- `position`: Display position (default: bottom)
|
98
|
+
- top: Display after the first heading
|
99
|
+
- bottom: Display at the end of document
|
100
|
+
- `exclude`: List of files to exclude (default: [])
|
101
|
+
- Supports glob patterns, example: ["private/*", "temp.md"]
|
102
|
+
|
103
|
+
## Notes
|
104
|
+
|
105
|
+
- Creation time behavior varies across operating systems:
|
106
|
+
- Windows: Uses file creation time
|
107
|
+
- macOS: Uses file creation time (birthtime)
|
108
|
+
- Linux: Uses modification time as creation time due to system limitations
|
109
|
+
- For accurate creation times, it's recommended to use Front Matter for manual specification
|
110
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# mkdocs-document-dates
|
2
|
+
|
3
|
+
English | [简体中文](README_zh.md)
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
A MkDocs plugin for displaying **accurate** document creation and last modification dates.
|
8
|
+
|
9
|
+
## Features
|
10
|
+
|
11
|
+
- Automatically displays document creation and last modification times
|
12
|
+
- Supports manual date specification in `Front Matter`
|
13
|
+
- No Git dependency, uses filesystem timestamps directly
|
14
|
+
- Cross-platform support (Windows, macOS, Linux)
|
15
|
+
- Configurable date and time formats
|
16
|
+
- Flexible display position (top or bottom)
|
17
|
+
- File exclusion rules support
|
18
|
+
- Material Design icons
|
19
|
+
- Elegant styling
|
20
|
+
- Lightweight with no extra dependencies
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
```bash
|
25
|
+
pip install mkdocs-document-dates
|
26
|
+
```
|
27
|
+
|
28
|
+
## Configuration
|
29
|
+
|
30
|
+
Add the plugin to your mkdocs.yml:
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
plugins:
|
34
|
+
- document-dates
|
35
|
+
```
|
36
|
+
|
37
|
+
Or, customize the configuration:
|
38
|
+
|
39
|
+
```yaml
|
40
|
+
plugins:
|
41
|
+
- document-dates:
|
42
|
+
date_format: '%Y-%m-%d' # Date format
|
43
|
+
show_time: false # Whether to show time
|
44
|
+
time_format: '%H:%M:%S' # Time format
|
45
|
+
position: bottom # Display position: top (after title) or bottom (end of document)
|
46
|
+
exclude: # List of file patterns to exclude
|
47
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
48
|
+
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
49
|
+
- "temp.md" # Exclude specific file
|
50
|
+
- "*.tmp" # Exclude all files with .tmp extension
|
51
|
+
```
|
52
|
+
|
53
|
+
## Manual Date Specification
|
54
|
+
|
55
|
+
You can also manually specify the date of a Markdown document in its `Front Matter` :
|
56
|
+
|
57
|
+
```yaml
|
58
|
+
---
|
59
|
+
created_date: 2023-01-01
|
60
|
+
modified_date: 2023-12-31
|
61
|
+
---
|
62
|
+
|
63
|
+
# Document Title
|
64
|
+
```
|
65
|
+
|
66
|
+
## Configuration Options
|
67
|
+
|
68
|
+
- `date_format`: Date format (default: %Y-%m-%d)
|
69
|
+
- Supports all Python datetime format strings, examples: %Y-%m-%d, %b %d, %Y, etc.
|
70
|
+
- `show_time`: Whether to show time (default: false)
|
71
|
+
- true: Show both date and time
|
72
|
+
- false: Show date only
|
73
|
+
- `time_format`: Time format (default: %H:%M:%S)
|
74
|
+
- Only effective when show_time is true
|
75
|
+
- `position`: Display position (default: bottom)
|
76
|
+
- top: Display after the first heading
|
77
|
+
- bottom: Display at the end of document
|
78
|
+
- `exclude`: List of files to exclude (default: [])
|
79
|
+
- Supports glob patterns, example: ["private/*", "temp.md"]
|
80
|
+
|
81
|
+
## Notes
|
82
|
+
|
83
|
+
- Creation time behavior varies across operating systems:
|
84
|
+
- Windows: Uses file creation time
|
85
|
+
- macOS: Uses file creation time (birthtime)
|
86
|
+
- Linux: Uses modification time as creation time due to system limitations
|
87
|
+
- For accurate creation times, it's recommended to use Front Matter for manual specification
|
88
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
import platform
|
2
3
|
from datetime import datetime
|
3
4
|
from pathlib import Path
|
4
5
|
from mkdocs.plugins import BasePlugin
|
@@ -90,11 +91,36 @@ class DocumentDatesPlugin(BasePlugin):
|
|
90
91
|
|
91
92
|
def on_page_markdown(self, markdown, page, config, files):
|
92
93
|
"""处理页面内容,添加日期信息"""
|
93
|
-
file_path = page.file.abs_src_path
|
94
|
+
file_path = Path(page.file.abs_src_path)
|
95
|
+
docs_dir = Path(config['docs_dir'])
|
94
96
|
|
95
97
|
# 检查是否在排除列表中
|
96
98
|
for exclude_pattern in self.config['exclude']:
|
97
|
-
|
99
|
+
# 处理目录递归排除(如 private/*)
|
100
|
+
if exclude_pattern.endswith('/*'):
|
101
|
+
base_dir = exclude_pattern[:-2] # 移除 /*
|
102
|
+
try:
|
103
|
+
# 检查当前文件是否在指定目录或其子目录中
|
104
|
+
rel_path = file_path.relative_to(docs_dir)
|
105
|
+
if str(rel_path).startswith(f"{base_dir}/"):
|
106
|
+
return markdown
|
107
|
+
except ValueError:
|
108
|
+
continue
|
109
|
+
|
110
|
+
# 处理特定目录下的特定类型文件(如 drafts/*.md)
|
111
|
+
elif '/*.' in exclude_pattern:
|
112
|
+
dir_part, ext_part = exclude_pattern.split('/*.')
|
113
|
+
if (file_path.parent.name == dir_part and
|
114
|
+
file_path.suffix == f".{ext_part}"):
|
115
|
+
return markdown
|
116
|
+
|
117
|
+
# 处理特定后缀文件(如 *.tmp)
|
118
|
+
elif exclude_pattern.startswith('*.'):
|
119
|
+
if file_path.suffix == f".{exclude_pattern[2:]}":
|
120
|
+
return markdown
|
121
|
+
|
122
|
+
# 处理精确文件匹配(如 temp.md)
|
123
|
+
elif file_path.name == exclude_pattern:
|
98
124
|
return markdown
|
99
125
|
|
100
126
|
# 直接获取日期信息
|
@@ -124,7 +150,6 @@ class DocumentDatesPlugin(BasePlugin):
|
|
124
150
|
|
125
151
|
def get_file_dates(self, file_path):
|
126
152
|
"""获取文件的创建时间和修改时间"""
|
127
|
-
import platform
|
128
153
|
|
129
154
|
stat = os.stat(file_path)
|
130
155
|
modified = datetime.fromtimestamp(stat.st_mtime)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: mkdocs-document-dates
|
3
|
+
Version: 0.4.0
|
4
|
+
Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
|
5
|
+
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
|
+
Author: Aaron Wang
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
9
|
+
Classifier: Operating System :: OS Independent
|
10
|
+
Requires-Python: >=3.6
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: mkdocs>=1.0.0
|
14
|
+
Dynamic: author
|
15
|
+
Dynamic: classifier
|
16
|
+
Dynamic: description
|
17
|
+
Dynamic: description-content-type
|
18
|
+
Dynamic: home-page
|
19
|
+
Dynamic: requires-dist
|
20
|
+
Dynamic: requires-python
|
21
|
+
Dynamic: summary
|
22
|
+
|
23
|
+
# mkdocs-document-dates
|
24
|
+
|
25
|
+
English | [简体中文](README_zh.md)
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
A MkDocs plugin for displaying **accurate** document creation and last modification dates.
|
30
|
+
|
31
|
+
## Features
|
32
|
+
|
33
|
+
- Automatically displays document creation and last modification times
|
34
|
+
- Supports manual date specification in `Front Matter`
|
35
|
+
- No Git dependency, uses filesystem timestamps directly
|
36
|
+
- Cross-platform support (Windows, macOS, Linux)
|
37
|
+
- Configurable date and time formats
|
38
|
+
- Flexible display position (top or bottom)
|
39
|
+
- File exclusion rules support
|
40
|
+
- Material Design icons
|
41
|
+
- Elegant styling
|
42
|
+
- Lightweight with no extra dependencies
|
43
|
+
|
44
|
+
## Installation
|
45
|
+
|
46
|
+
```bash
|
47
|
+
pip install mkdocs-document-dates
|
48
|
+
```
|
49
|
+
|
50
|
+
## Configuration
|
51
|
+
|
52
|
+
Add the plugin to your mkdocs.yml:
|
53
|
+
|
54
|
+
```yaml
|
55
|
+
plugins:
|
56
|
+
- document-dates
|
57
|
+
```
|
58
|
+
|
59
|
+
Or, customize the configuration:
|
60
|
+
|
61
|
+
```yaml
|
62
|
+
plugins:
|
63
|
+
- document-dates:
|
64
|
+
date_format: '%Y-%m-%d' # Date format
|
65
|
+
show_time: false # Whether to show time
|
66
|
+
time_format: '%H:%M:%S' # Time format
|
67
|
+
position: bottom # Display position: top (after title) or bottom (end of document)
|
68
|
+
exclude: # List of file patterns to exclude
|
69
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
70
|
+
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
71
|
+
- "temp.md" # Exclude specific file
|
72
|
+
- "*.tmp" # Exclude all files with .tmp extension
|
73
|
+
```
|
74
|
+
|
75
|
+
## Manual Date Specification
|
76
|
+
|
77
|
+
You can also manually specify the date of a Markdown document in its `Front Matter` :
|
78
|
+
|
79
|
+
```yaml
|
80
|
+
---
|
81
|
+
created_date: 2023-01-01
|
82
|
+
modified_date: 2023-12-31
|
83
|
+
---
|
84
|
+
|
85
|
+
# Document Title
|
86
|
+
```
|
87
|
+
|
88
|
+
## Configuration Options
|
89
|
+
|
90
|
+
- `date_format`: Date format (default: %Y-%m-%d)
|
91
|
+
- Supports all Python datetime format strings, examples: %Y-%m-%d, %b %d, %Y, etc.
|
92
|
+
- `show_time`: Whether to show time (default: false)
|
93
|
+
- true: Show both date and time
|
94
|
+
- false: Show date only
|
95
|
+
- `time_format`: Time format (default: %H:%M:%S)
|
96
|
+
- Only effective when show_time is true
|
97
|
+
- `position`: Display position (default: bottom)
|
98
|
+
- top: Display after the first heading
|
99
|
+
- bottom: Display at the end of document
|
100
|
+
- `exclude`: List of files to exclude (default: [])
|
101
|
+
- Supports glob patterns, example: ["private/*", "temp.md"]
|
102
|
+
|
103
|
+
## Notes
|
104
|
+
|
105
|
+
- Creation time behavior varies across operating systems:
|
106
|
+
- Windows: Uses file creation time
|
107
|
+
- macOS: Uses file creation time (birthtime)
|
108
|
+
- Linux: Uses modification time as creation time due to system limitations
|
109
|
+
- For accurate creation times, it's recommended to use Front Matter for manual specification
|
110
|
+
|
@@ -5,9 +5,9 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="mkdocs-document-dates",
|
8
|
-
version="0.
|
8
|
+
version="0.4.0",
|
9
9
|
author="Aaron Wang",
|
10
|
-
description="
|
10
|
+
description="A MkDocs plugin for displaying accurate document creation and last modification dates.",
|
11
11
|
long_description=long_description,
|
12
12
|
long_description_content_type="text/markdown",
|
13
13
|
url="https://github.com/jaywhj/mkdocs-document-dates",
|
@@ -1,110 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: mkdocs-document-dates
|
3
|
-
Version: 0.2.0
|
4
|
-
Summary: 一个用于显示文档创建日期和最后修改日期的 MkDocs 插件
|
5
|
-
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
|
-
Author: Aaron Wang
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Classifier: Operating System :: OS Independent
|
10
|
-
Requires-Python: >=3.6
|
11
|
-
Description-Content-Type: text/markdown
|
12
|
-
License-File: LICENSE
|
13
|
-
Requires-Dist: mkdocs>=1.0.0
|
14
|
-
Dynamic: author
|
15
|
-
Dynamic: classifier
|
16
|
-
Dynamic: description
|
17
|
-
Dynamic: description-content-type
|
18
|
-
Dynamic: home-page
|
19
|
-
Dynamic: requires-dist
|
20
|
-
Dynamic: requires-python
|
21
|
-
Dynamic: summary
|
22
|
-
|
23
|
-
# mkdocs-document-dates
|
24
|
-
|
25
|
-
[English](README_en.md) | 简体中文
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
一个用于显示准确的文档创建日期和最后修改日期的 MkDocs 插件。
|
30
|
-
|
31
|
-
## 特性
|
32
|
-
|
33
|
-
- 自动显示文档的创建时间和最后修改时间
|
34
|
-
- 支持在 `Front Matter` 中手动指定日期
|
35
|
-
- 不依赖 Git,直接使用文件系统的时间戳
|
36
|
-
- 跨平台支持(Windows、macOS、Linux)
|
37
|
-
- 可配置的日期和时间格式
|
38
|
-
- 灵活的显示位置(顶部或底部)
|
39
|
-
- 支持文件排除规则
|
40
|
-
- Material Design 风格的图标
|
41
|
-
- 优雅的样式设计
|
42
|
-
- 轻量级,无额外依赖
|
43
|
-
|
44
|
-
## 安装
|
45
|
-
|
46
|
-
```bash
|
47
|
-
pip install mkdocs-document-dates
|
48
|
-
```
|
49
|
-
|
50
|
-
## 配置
|
51
|
-
|
52
|
-
在你的 mkdocs.yml 中添加插件即可:
|
53
|
-
|
54
|
-
```yaml
|
55
|
-
plugins:
|
56
|
-
- document-dates
|
57
|
-
```
|
58
|
-
|
59
|
-
或者,你要自定义配置:
|
60
|
-
|
61
|
-
```yaml
|
62
|
-
plugins:
|
63
|
-
- document-dates:
|
64
|
-
date_format: '%Y-%m-%d' # 日期格式
|
65
|
-
show_time: false # 是否显示时间
|
66
|
-
time_format: '%H:%M:%S' # 时间格式
|
67
|
-
position: bottom # 显示位置:top(标题后)或 bottom(文档末尾)
|
68
|
-
exclude: # 排除的文件模式列表
|
69
|
-
- "private/*" # 排除 private 目录下的所有文件
|
70
|
-
- "drafts/*.md" # 排除 drafts 目录下的所有 markdown 文件
|
71
|
-
- "temp.md" # 排除特定文件
|
72
|
-
- "*.tmp" # 排除所有 .tmp 后缀的文件
|
73
|
-
```
|
74
|
-
|
75
|
-
## 手动指定日期
|
76
|
-
|
77
|
-
你也可以为 Markdown 文档手动指定日期,在 Markdown 文档的 `Front Matter` 中设置:
|
78
|
-
|
79
|
-
```yaml
|
80
|
-
---
|
81
|
-
created_date: 2023-01-01
|
82
|
-
modified_date: 2023-12-31
|
83
|
-
---
|
84
|
-
|
85
|
-
# 文档标题
|
86
|
-
```
|
87
|
-
|
88
|
-
## 配置选项
|
89
|
-
|
90
|
-
- date_format: 日期格式(默认:%Y-%m-%d)
|
91
|
-
- 支持所有 Python datetime 格式化字符串,例如:%Y年%m月%d日、%b %d, %Y 等
|
92
|
-
- show_time: 是否显示时间(默认:false)
|
93
|
-
- true: 同时显示日期和时间
|
94
|
-
- false: 仅显示日期
|
95
|
-
- time_format: 时间格式(默认:%H:%M:%S)
|
96
|
-
- 仅在 show_time 为 true 时生效
|
97
|
-
- position: 显示位置(默认:bottom)
|
98
|
-
- top: 在文档第一个标题后显示
|
99
|
-
- bottom: 在文档末尾显示
|
100
|
-
- exclude: 排除文件列表(默认:[])
|
101
|
-
- 支持 glob 模式,例如:["private/*", "temp.md"]
|
102
|
-
|
103
|
-
## 注意事项
|
104
|
-
|
105
|
-
- 创建时间在不同操作系统上的行为可能不同:
|
106
|
-
- Windows: 使用文件创建时间
|
107
|
-
- macOS: 使用文件创建时间(birthtime)
|
108
|
-
- Linux: 由于系统限制,使用修改时间作为创建时间
|
109
|
-
- 如果需要准确的创建时间,建议使用 Front Matter 手动指定
|
110
|
-
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# mkdocs-document-dates
|
2
|
-
|
3
|
-
[English](README_en.md) | 简体中文
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
一个用于显示准确的文档创建日期和最后修改日期的 MkDocs 插件。
|
8
|
-
|
9
|
-
## 特性
|
10
|
-
|
11
|
-
- 自动显示文档的创建时间和最后修改时间
|
12
|
-
- 支持在 `Front Matter` 中手动指定日期
|
13
|
-
- 不依赖 Git,直接使用文件系统的时间戳
|
14
|
-
- 跨平台支持(Windows、macOS、Linux)
|
15
|
-
- 可配置的日期和时间格式
|
16
|
-
- 灵活的显示位置(顶部或底部)
|
17
|
-
- 支持文件排除规则
|
18
|
-
- Material Design 风格的图标
|
19
|
-
- 优雅的样式设计
|
20
|
-
- 轻量级,无额外依赖
|
21
|
-
|
22
|
-
## 安装
|
23
|
-
|
24
|
-
```bash
|
25
|
-
pip install mkdocs-document-dates
|
26
|
-
```
|
27
|
-
|
28
|
-
## 配置
|
29
|
-
|
30
|
-
在你的 mkdocs.yml 中添加插件即可:
|
31
|
-
|
32
|
-
```yaml
|
33
|
-
plugins:
|
34
|
-
- document-dates
|
35
|
-
```
|
36
|
-
|
37
|
-
或者,你要自定义配置:
|
38
|
-
|
39
|
-
```yaml
|
40
|
-
plugins:
|
41
|
-
- document-dates:
|
42
|
-
date_format: '%Y-%m-%d' # 日期格式
|
43
|
-
show_time: false # 是否显示时间
|
44
|
-
time_format: '%H:%M:%S' # 时间格式
|
45
|
-
position: bottom # 显示位置:top(标题后)或 bottom(文档末尾)
|
46
|
-
exclude: # 排除的文件模式列表
|
47
|
-
- "private/*" # 排除 private 目录下的所有文件
|
48
|
-
- "drafts/*.md" # 排除 drafts 目录下的所有 markdown 文件
|
49
|
-
- "temp.md" # 排除特定文件
|
50
|
-
- "*.tmp" # 排除所有 .tmp 后缀的文件
|
51
|
-
```
|
52
|
-
|
53
|
-
## 手动指定日期
|
54
|
-
|
55
|
-
你也可以为 Markdown 文档手动指定日期,在 Markdown 文档的 `Front Matter` 中设置:
|
56
|
-
|
57
|
-
```yaml
|
58
|
-
---
|
59
|
-
created_date: 2023-01-01
|
60
|
-
modified_date: 2023-12-31
|
61
|
-
---
|
62
|
-
|
63
|
-
# 文档标题
|
64
|
-
```
|
65
|
-
|
66
|
-
## 配置选项
|
67
|
-
|
68
|
-
- date_format: 日期格式(默认:%Y-%m-%d)
|
69
|
-
- 支持所有 Python datetime 格式化字符串,例如:%Y年%m月%d日、%b %d, %Y 等
|
70
|
-
- show_time: 是否显示时间(默认:false)
|
71
|
-
- true: 同时显示日期和时间
|
72
|
-
- false: 仅显示日期
|
73
|
-
- time_format: 时间格式(默认:%H:%M:%S)
|
74
|
-
- 仅在 show_time 为 true 时生效
|
75
|
-
- position: 显示位置(默认:bottom)
|
76
|
-
- top: 在文档第一个标题后显示
|
77
|
-
- bottom: 在文档末尾显示
|
78
|
-
- exclude: 排除文件列表(默认:[])
|
79
|
-
- 支持 glob 模式,例如:["private/*", "temp.md"]
|
80
|
-
|
81
|
-
## 注意事项
|
82
|
-
|
83
|
-
- 创建时间在不同操作系统上的行为可能不同:
|
84
|
-
- Windows: 使用文件创建时间
|
85
|
-
- macOS: 使用文件创建时间(birthtime)
|
86
|
-
- Linux: 由于系统限制,使用修改时间作为创建时间
|
87
|
-
- 如果需要准确的创建时间,建议使用 Front Matter 手动指定
|
88
|
-
|
@@ -1,110 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: mkdocs-document-dates
|
3
|
-
Version: 0.2.0
|
4
|
-
Summary: 一个用于显示文档创建日期和最后修改日期的 MkDocs 插件
|
5
|
-
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
|
-
Author: Aaron Wang
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Classifier: Operating System :: OS Independent
|
10
|
-
Requires-Python: >=3.6
|
11
|
-
Description-Content-Type: text/markdown
|
12
|
-
License-File: LICENSE
|
13
|
-
Requires-Dist: mkdocs>=1.0.0
|
14
|
-
Dynamic: author
|
15
|
-
Dynamic: classifier
|
16
|
-
Dynamic: description
|
17
|
-
Dynamic: description-content-type
|
18
|
-
Dynamic: home-page
|
19
|
-
Dynamic: requires-dist
|
20
|
-
Dynamic: requires-python
|
21
|
-
Dynamic: summary
|
22
|
-
|
23
|
-
# mkdocs-document-dates
|
24
|
-
|
25
|
-
[English](README_en.md) | 简体中文
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
一个用于显示准确的文档创建日期和最后修改日期的 MkDocs 插件。
|
30
|
-
|
31
|
-
## 特性
|
32
|
-
|
33
|
-
- 自动显示文档的创建时间和最后修改时间
|
34
|
-
- 支持在 `Front Matter` 中手动指定日期
|
35
|
-
- 不依赖 Git,直接使用文件系统的时间戳
|
36
|
-
- 跨平台支持(Windows、macOS、Linux)
|
37
|
-
- 可配置的日期和时间格式
|
38
|
-
- 灵活的显示位置(顶部或底部)
|
39
|
-
- 支持文件排除规则
|
40
|
-
- Material Design 风格的图标
|
41
|
-
- 优雅的样式设计
|
42
|
-
- 轻量级,无额外依赖
|
43
|
-
|
44
|
-
## 安装
|
45
|
-
|
46
|
-
```bash
|
47
|
-
pip install mkdocs-document-dates
|
48
|
-
```
|
49
|
-
|
50
|
-
## 配置
|
51
|
-
|
52
|
-
在你的 mkdocs.yml 中添加插件即可:
|
53
|
-
|
54
|
-
```yaml
|
55
|
-
plugins:
|
56
|
-
- document-dates
|
57
|
-
```
|
58
|
-
|
59
|
-
或者,你要自定义配置:
|
60
|
-
|
61
|
-
```yaml
|
62
|
-
plugins:
|
63
|
-
- document-dates:
|
64
|
-
date_format: '%Y-%m-%d' # 日期格式
|
65
|
-
show_time: false # 是否显示时间
|
66
|
-
time_format: '%H:%M:%S' # 时间格式
|
67
|
-
position: bottom # 显示位置:top(标题后)或 bottom(文档末尾)
|
68
|
-
exclude: # 排除的文件模式列表
|
69
|
-
- "private/*" # 排除 private 目录下的所有文件
|
70
|
-
- "drafts/*.md" # 排除 drafts 目录下的所有 markdown 文件
|
71
|
-
- "temp.md" # 排除特定文件
|
72
|
-
- "*.tmp" # 排除所有 .tmp 后缀的文件
|
73
|
-
```
|
74
|
-
|
75
|
-
## 手动指定日期
|
76
|
-
|
77
|
-
你也可以为 Markdown 文档手动指定日期,在 Markdown 文档的 `Front Matter` 中设置:
|
78
|
-
|
79
|
-
```yaml
|
80
|
-
---
|
81
|
-
created_date: 2023-01-01
|
82
|
-
modified_date: 2023-12-31
|
83
|
-
---
|
84
|
-
|
85
|
-
# 文档标题
|
86
|
-
```
|
87
|
-
|
88
|
-
## 配置选项
|
89
|
-
|
90
|
-
- date_format: 日期格式(默认:%Y-%m-%d)
|
91
|
-
- 支持所有 Python datetime 格式化字符串,例如:%Y年%m月%d日、%b %d, %Y 等
|
92
|
-
- show_time: 是否显示时间(默认:false)
|
93
|
-
- true: 同时显示日期和时间
|
94
|
-
- false: 仅显示日期
|
95
|
-
- time_format: 时间格式(默认:%H:%M:%S)
|
96
|
-
- 仅在 show_time 为 true 时生效
|
97
|
-
- position: 显示位置(默认:bottom)
|
98
|
-
- top: 在文档第一个标题后显示
|
99
|
-
- bottom: 在文档末尾显示
|
100
|
-
- exclude: 排除文件列表(默认:[])
|
101
|
-
- 支持 glob 模式,例如:["private/*", "temp.md"]
|
102
|
-
|
103
|
-
## 注意事项
|
104
|
-
|
105
|
-
- 创建时间在不同操作系统上的行为可能不同:
|
106
|
-
- Windows: 使用文件创建时间
|
107
|
-
- macOS: 使用文件创建时间(birthtime)
|
108
|
-
- Linux: 由于系统限制,使用修改时间作为创建时间
|
109
|
-
- 如果需要准确的创建时间,建议使用 Front Matter 手动指定
|
110
|
-
|
File without changes
|
{mkdocs_document_dates-0.2.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|