mkdocs-document-dates 3.5.1__tar.gz → 3.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {mkdocs_document_dates-3.5.1/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.6.0}/PKG-INFO +8 -5
  2. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/README.md +7 -4
  3. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/plugin.py +20 -27
  4. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/core/core.css +21 -23
  5. mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/core/core.js +470 -0
  6. mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/core/md5.min.js +2 -0
  7. mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/templates/recently_updated_detail.html +99 -0
  8. mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/templates/recently_updated_grid.html +106 -0
  9. mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/templates/recently_updated_group.html +186 -0
  10. mkdocs_document_dates-3.5.1/mkdocs_document_dates/static/templates/recently_updated.html → mkdocs_document_dates-3.6.0/mkdocs_document_dates/static/templates/recently_updated_list.html +23 -15
  11. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/utils.py +197 -39
  12. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0/mkdocs_document_dates.egg-info}/PKG-INFO +8 -5
  13. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates.egg-info/SOURCES.txt +5 -1
  14. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/setup.py +1 -1
  15. mkdocs_document_dates-3.5.1/mkdocs_document_dates/static/core/core.js +0 -225
  16. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/LICENSE +0 -0
  17. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/MANIFEST.in +0 -0
  18. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/__init__.py +0 -0
  19. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/cache_manager.py +0 -0
  20. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/hooks/pre-commit +0 -0
  21. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/hooks_installer.py +0 -0
  22. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/config/user.config.css +0 -0
  23. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/config/user.config.js +0 -0
  24. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/core/default.config.js +0 -0
  25. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
  26. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
  27. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/core/utils.js +0 -0
  28. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/fonts/material-icons.css +0 -0
  29. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/fonts/materialicons.woff2 +0 -0
  30. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
  31. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/light.css +0 -0
  32. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/material.css +0 -0
  33. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
  34. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/scale.css +0 -0
  35. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
  36. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
  37. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
  38. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  39. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  40. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  41. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  42. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/pyproject.toml +0 -0
  43. {mkdocs_document_dates-3.5.1 → mkdocs_document_dates-3.6.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.5.1
3
+ Version: 3.6.0
4
4
  Summary: A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -79,9 +79,6 @@ plugins:
79
79
  - blog/* # Example: exclude all files in blog folder, including subfolders
80
80
  date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
81
81
  time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
82
- show_created: true # Show creation date: true false, default: true
83
- show_updated: true # Show last updated date: true false, default: true
84
- show_author: true # Show author: true(avatar) text(text) false(hidden), default: true
85
82
  ```
86
83
 
87
84
  ## Customization Settings
@@ -91,7 +88,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
91
88
  - [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime): Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
92
89
  - [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author): Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
93
90
  - [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author, support local file path and URL path
94
- - [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style): You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
91
+ - [Configuration Structure and Style](https://jaywhj.netlify.app/document-dates-en#Structure-and-Style): You can freely configure the plugin's display structure in mkdocs.yml or Front Matter. You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
95
92
  - [Use Template Variables](https://jaywhj.netlify.app/document-dates-en#Use-Template-Variables): Can be used to optimize `sitemap.xml` for site SEO; Can be used to re-customize plug-ins, etc.
96
93
  - [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
97
94
  - [Add Localization Language](https://jaywhj.netlify.app/document-dates-en#Add-Localization-Language): More localization languages for `timeago` and `tooltip`
@@ -100,6 +97,12 @@ In addition to the above basic configuration, the plug-in also provides a wealth
100
97
 
101
98
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
102
99
 
100
+ <br />
101
+
102
+ ## Other Projects
103
+
104
+ - [**MaterialX**](https://github.com/jaywhj/mkdocs-materialx), the next generation of mkdocs-material, is based on `mkdocs-material-9.7.0` and is named `X`. I'll be maintaining this branch continuously (since mkdocs-material will stop being maintained).
105
+ Updates have been released that refactor and add a lot of new features, see https://github.com/jaywhj/mkdocs-materialx/releases/
103
106
 
104
107
  <br />
105
108
 
@@ -53,9 +53,6 @@ plugins:
53
53
  - blog/* # Example: exclude all files in blog folder, including subfolders
54
54
  date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
55
55
  time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
56
- show_created: true # Show creation date: true false, default: true
57
- show_updated: true # Show last updated date: true false, default: true
58
- show_author: true # Show author: true(avatar) text(text) false(hidden), default: true
59
56
  ```
60
57
 
61
58
  ## Customization Settings
@@ -65,7 +62,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
65
62
  - [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime): Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
66
63
  - [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author): Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
67
64
  - [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author, support local file path and URL path
68
- - [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style): You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
65
+ - [Configuration Structure and Style](https://jaywhj.netlify.app/document-dates-en#Structure-and-Style): You can freely configure the plugin's display structure in mkdocs.yml or Front Matter. You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
69
66
  - [Use Template Variables](https://jaywhj.netlify.app/document-dates-en#Use-Template-Variables): Can be used to optimize `sitemap.xml` for site SEO; Can be used to re-customize plug-ins, etc.
70
67
  - [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
71
68
  - [Add Localization Language](https://jaywhj.netlify.app/document-dates-en#Add-Localization-Language): More localization languages for `timeago` and `tooltip`
@@ -74,6 +71,12 @@ In addition to the above basic configuration, the plug-in also provides a wealth
74
71
 
75
72
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
76
73
 
74
+ <br />
75
+
76
+ ## Other Projects
77
+
78
+ - [**MaterialX**](https://github.com/jaywhj/mkdocs-materialx), the next generation of mkdocs-material, is based on `mkdocs-material-9.7.0` and is named `X`. I'll be maintaining this branch continuously (since mkdocs-material will stop being maintained).
79
+ Updates have been released that refactor and add a lot of new features, see https://github.com/jaywhj/mkdocs-materialx/releases/
77
80
 
78
81
  <br />
79
82
 
@@ -46,7 +46,6 @@ class DocumentDatesPlugin(BasePlugin):
46
46
  self.dates_cache = {}
47
47
  self.last_updated_dates = {}
48
48
  self.authors_yml = {}
49
- self.github_username = None
50
49
  self.recent_docs_html = None
51
50
  self.recent_enable = False
52
51
 
@@ -132,6 +131,7 @@ class DocumentDatesPlugin(BasePlugin):
132
131
 
133
132
  # 添加自定义 JS 文件
134
133
  config['extra_javascript'].extend([
134
+ 'assets/document_dates/core/md5.min.js',
135
135
  'assets/document_dates/core/default.config.js',
136
136
  'assets/document_dates/user.config.js',
137
137
  'assets/document_dates/core/utils.js',
@@ -168,7 +168,7 @@ class DocumentDatesPlugin(BasePlugin):
168
168
  return markdown
169
169
 
170
170
  # 生成日期和作者信息 HTML
171
- info_html = self._generate_html_info(created, updated, authors)
171
+ info_html = self._generate_html_info(page.meta, created, updated, authors)
172
172
 
173
173
  # 将信息写入 markdown
174
174
  return self._insert_date_info(markdown, info_html)
@@ -185,7 +185,6 @@ class DocumentDatesPlugin(BasePlugin):
185
185
  # 获取配置
186
186
  exclude_list = recently_updated_config.get('exclude', [])
187
187
  limit = recently_updated_config.get('limit', 10)
188
- template_path = recently_updated_config.get('template')
189
188
 
190
189
  # 获取最近更新的文档数据
191
190
  recently_updated_docs = get_recently_updated_files(self.last_updated_dates, files, exclude_list, limit, self.recent_enable)
@@ -197,8 +196,7 @@ class DocumentDatesPlugin(BasePlugin):
197
196
 
198
197
  # 渲染HTML
199
198
  if self.recent_enable:
200
- docs_dir = Path(config['docs_dir'])
201
- self.recent_docs_html = self._render_recently_updated_html(docs_dir, template_path, recently_updated_docs)
199
+ self.recent_docs_html = self._render_recently_updated_html(recently_updated_docs)
202
200
 
203
201
  return env
204
202
 
@@ -232,20 +230,10 @@ class DocumentDatesPlugin(BasePlugin):
232
230
  logger.info(f"Error parsing .authors.yml: {e}")
233
231
 
234
232
 
235
- def _render_recently_updated_html(self, docs_dir, template_path, recently_updated_data):
236
- # 获取自定义模板路径
237
- if template_path:
238
- user_full_path = docs_dir / template_path
239
-
240
- # 选择模板路径
241
- if template_path and user_full_path.is_file():
242
- template_dir = user_full_path.parent
243
- template_file = user_full_path.name
244
- else:
245
- # 默认模板路径
246
- default_template_path = Path(__file__).parent / 'static' / 'templates' / 'recently_updated.html'
247
- template_dir = default_template_path.parent
248
- template_file = default_template_path.name
233
+ def _render_recently_updated_html(self, recently_updated_data):
234
+ default_template_path = Path(__file__).parent / 'static' / 'templates' / 'recently_updated_group.html'
235
+ template_dir = default_template_path.parent
236
+ template_file = default_template_path.name
249
237
 
250
238
  # 加载模板
251
239
  env = Environment(
@@ -362,10 +350,14 @@ class DocumentDatesPlugin(BasePlugin):
362
350
  return date.strftime(f"{self.config['date_format']} {self.config['time_format']}")
363
351
  return date.strftime(self.config['date_format'])
364
352
 
365
- def _generate_html_info(self, created: datetime, updated: datetime, authors=None):
353
+ def _generate_html_info(self, meta, created: datetime, updated: datetime, authors=None):
366
354
  try:
367
- show_dates = self.config['show_created'] or self.config['show_updated']
368
- show_plugin = show_dates or self.config['show_author']
355
+ show_created = self.config['show_created'] and meta.get('show_created') is not False
356
+ show_updated = self.config['show_updated'] and meta.get('show_updated') is not False
357
+ show_author = self.config['show_author'] and meta.get('show_author') is not False
358
+
359
+ show_dates = show_created or show_updated
360
+ show_plugin = show_dates or show_author
369
361
  if not show_plugin:
370
362
  return ""
371
363
 
@@ -387,15 +379,15 @@ class DocumentDatesPlugin(BasePlugin):
387
379
  # 构建日期
388
380
  if show_dates:
389
381
  html_parts.append("<div class='dd-left'>")
390
- if self.config['show_created']:
382
+ if show_created:
391
383
  html_parts.append(build_time_icon(created, 'doc_created'))
392
- if self.config['show_updated']:
384
+ if show_updated:
393
385
  html_parts.append(build_time_icon(updated, 'doc_updated'))
394
386
  if show_dates:
395
387
  html_parts.append("</div>")
396
388
 
397
389
  # 构建作者
398
- if self.config['show_author'] and authors:
390
+ if show_author and authors:
399
391
  def get_author_tooltip(author):
400
392
  if author.url:
401
393
  return f'<a href="{author.url}" target="_blank">{author.name}</a>'
@@ -410,7 +402,8 @@ class DocumentDatesPlugin(BasePlugin):
410
402
  icon = 'doc_author' if len(authors) == 1 else 'doc_authors'
411
403
  html_parts.append(f"<span class='material-icons' data-icon='{icon}'></span>")
412
404
  html_parts.append("<div class='author-group'>")
413
- if self.config['show_author'] == 'text':
405
+ show_text = self.config['show_author'] == 'text' or meta.get('show_author') == 'text'
406
+ if show_text:
414
407
  # 显示文本模式
415
408
  for index, author in enumerate(authors):
416
409
  if index > 0:
@@ -424,7 +417,7 @@ class DocumentDatesPlugin(BasePlugin):
424
417
  html_parts.append(
425
418
  f"<div class='avatar-wrapper' data-name='{author.name}' data-tippy-content data-tippy-raw='{tooltip}'>"
426
419
  f"<span class='avatar-text'></span>"
427
- f"<img class='avatar' src='{author.avatar}' onerror=\"this.style.display='none'\" />"
420
+ f"<img class='avatar' data-src='{author.avatar}' data-email='{author.email}' />"
428
421
  f"</div>"
429
422
  )
430
423
  html_parts.append("</div>")
@@ -23,11 +23,11 @@
23
23
  color: #666;
24
24
  font-size: 0.9rem;
25
25
  display: flex;
26
- /* flex-wrap: nowrap; */
27
26
  align-items: center;
27
+ flex-wrap: nowrap;
28
28
  justify-content: space-between;
29
- padding: 0.2rem 0;
30
- margin-bottom: 0.6rem;
29
+ padding: 0.1rem 0;
30
+ margin-bottom: 0.5rem;
31
31
  }
32
32
  .md-main .document-dates-plugin {
33
33
  color: rgba(142, 142, 142, 0.7);
@@ -38,9 +38,6 @@
38
38
  font-size: 1rem;
39
39
  opacity: 0.85;
40
40
  margin-right: 0.3rem;
41
- display: inline-flex;
42
- align-items: center;
43
- line-height: 1;
44
41
  }
45
42
  .md-main .document-dates-plugin .material-icons {
46
43
  font-size: 0.9rem;
@@ -70,17 +67,16 @@
70
67
  .dd-left {
71
68
  display: flex;
72
69
  align-items: center;
73
- margin-right: 1.5rem;
70
+ flex-shrink: 0;
74
71
  }
75
72
  .dd-item {
76
73
  display: inline-flex;
77
74
  align-items: center;
78
75
  white-space: nowrap;
79
76
  flex-shrink: 0;
80
- line-height: 1;
81
77
  }
82
78
  .dd-left > .dd-item + .dd-item {
83
- margin-left: 1.5rem;
79
+ margin-left: 1.4rem;
84
80
  }
85
81
 
86
82
  .dd-right {
@@ -88,13 +84,25 @@
88
84
  align-items: center;
89
85
  justify-content: flex-end;
90
86
  flex: 1 1 auto;
91
- min-width: 110px;
87
+ min-width: 0;
88
+ overflow: hidden;
92
89
  }
93
-
90
+ /* Left-aligned when only dd-right */
94
91
  .dd-right.dd-right-start {
95
92
  justify-content: flex-start;
96
93
  }
97
94
 
95
+ /* JS control toggle */
96
+ .document-dates-plugin.is-wrapped {
97
+ flex-wrap: wrap;
98
+ }
99
+ .document-dates-plugin.is-wrapped .dd-right {
100
+ flex: 0 0 100%;
101
+ justify-content: flex-start;
102
+ margin-top: 10px;
103
+ }
104
+
105
+
98
106
  /* ==========================================================================
99
107
  3. Author Avatar styles
100
108
  ========================================================================== */
@@ -111,9 +119,11 @@
111
119
 
112
120
  margin-right: 10px;
113
121
 
122
+ /* Hide Firefox, IE scrollbar */
114
123
  scrollbar-width: none;
115
124
  -ms-overflow-style: none;
116
125
  }
126
+ /* Hide Chrome/Safari scrollbar */
117
127
  .author-group::-webkit-scrollbar {
118
128
  display: none;
119
129
  }
@@ -168,18 +178,6 @@
168
178
  flex-shrink: 0;
169
179
  }
170
180
 
171
- /* Optimize the experience with line breaks on very narrow screens */
172
- @media screen and (max-width: 359px) {
173
- .document-dates-plugin {
174
- flex-wrap: wrap;
175
- }
176
- .dd-right {
177
- justify-content: flex-start;
178
- width: 100%;
179
- margin: 10px 0 0 0;
180
- }
181
- }
182
-
183
181
 
184
182
  /* ==========================================================================
185
183
  4. Tooltip styles, including theme, arrow, font, color, background color, etc