mkdocs-document-dates 3.8.6__tar.gz → 3.8.8__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.8.6/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.8.8}/PKG-INFO +3 -7
  2. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/README.md +2 -6
  3. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/cache_manager.py +1 -1
  4. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/plugin.py +29 -8
  5. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/templates/recently_updated_detail.html +4 -4
  6. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/templates/recently_updated_grid.html +4 -4
  7. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/templates/recently_updated_group.html +5 -5
  8. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/utils.py +39 -15
  9. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8/mkdocs_document_dates.egg-info}/PKG-INFO +3 -7
  10. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/pyproject.toml +1 -1
  11. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/setup.py +1 -1
  12. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/LICENSE +0 -0
  13. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/MANIFEST.in +0 -0
  14. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/__init__.py +0 -0
  15. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/hooks/pre-commit +0 -0
  16. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/hooks_installer.py +0 -0
  17. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/.DS_Store +0 -0
  18. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/config/config.css +0 -0
  19. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/config/config.js +0 -0
  20. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/core.css +0 -0
  21. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/core.js +0 -0
  22. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/default.config.js +0 -0
  23. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/md5.min.js +0 -0
  24. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
  25. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
  26. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/core/utils.js +0 -0
  27. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/fonts/material-icons.css +0 -0
  28. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/fonts/materialicons.woff2 +0 -0
  29. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/templates/recently_updated_list.html +0 -0
  30. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
  31. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/light.css +0 -0
  32. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/material.css +0 -0
  33. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
  34. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/scale.css +0 -0
  35. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
  36. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
  37. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
  38. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  39. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  40. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  41. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  42. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  43. {mkdocs_document_dates-3.8.6 → mkdocs_document_dates-3.8.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.8.6
3
+ Version: 3.8.8
4
4
  Summary: A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents
5
5
  Author-email: Aaron Wang <aaronwqt@gmail.com>
6
6
  License-Expression: MIT
@@ -25,7 +25,7 @@ English | [简体中文](README_zh.md)
25
25
 
26
26
  A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
27
27
 
28
- ![render](render.gif)
28
+ ![render](docs/assets/document-dates.gif)
29
29
 
30
30
  ## Features
31
31
 
@@ -90,7 +90,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
90
90
 
91
91
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
92
92
 
93
- ![recently-updated](recently-updated-en.gif)
93
+ ![recently-updated](docs/assets/recently-updated-en.gif)
94
94
 
95
95
  ## Other Projects
96
96
 
@@ -102,7 +102,3 @@ Updates have been released that refactor and add a lot of new features, see http
102
102
  ## Chat Group
103
103
 
104
104
  **Discord**: https://discord.gg/cvTfge4AUy
105
-
106
- **Wechat**:
107
-
108
- <img src="wechat-group.jpg" width="140" />
@@ -6,7 +6,7 @@ English | [简体中文](README_zh.md)
6
6
 
7
7
  A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
8
8
 
9
- ![render](render.gif)
9
+ ![render](docs/assets/document-dates.gif)
10
10
 
11
11
  ## Features
12
12
 
@@ -71,7 +71,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
71
71
 
72
72
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
73
73
 
74
- ![recently-updated](recently-updated-en.gif)
74
+ ![recently-updated](docs/assets/recently-updated-en.gif)
75
75
 
76
76
  ## Other Projects
77
77
 
@@ -83,7 +83,3 @@ Updates have been released that refactor and add a lot of new features, see http
83
83
  ## Chat Group
84
84
 
85
85
  **Discord**: https://discord.gg/cvTfge4AUy
86
-
87
- **Wechat**:
88
-
89
- <img src="wechat-group.jpg" width="140" />
@@ -88,7 +88,7 @@ def _clean_git_env():
88
88
 
89
89
  return env
90
90
 
91
- def find_mkdocs_projects() -> dict[Path, Path]:
91
+ def find_mkdocs_projects():
92
92
  projects = {}
93
93
 
94
94
  try:
@@ -10,7 +10,7 @@ from mkdocs.structure.pages import Page
10
10
  from mkdocs.utils import get_relative_url
11
11
  from urllib.parse import urlparse
12
12
  from babel.dates import format_datetime
13
- from .utils import compile_exclude_patterns, is_excluded, get_recently_updated_files, load_dates_and_authors
13
+ from .utils import compile_exclude_patterns, is_excluded, get_recently_updated_files, load_dates_and_authors, DEFAULT_WPM, DEFAULT_WPM_CJK
14
14
 
15
15
  logger = logging.getLogger("mkdocs.plugins.document_dates")
16
16
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
@@ -23,6 +23,8 @@ class Author:
23
23
  self.avatar = avatar
24
24
  self.url = url
25
25
  self.description = description
26
+ for k, v in kwargs.items():
27
+ setattr(self, k, v)
26
28
 
27
29
 
28
30
  class DocumentDatesPlugin(BasePlugin):
@@ -38,6 +40,8 @@ class DocumentDatesPlugin(BasePlugin):
38
40
  ('show_created', config_options.Type(bool, default=True)),
39
41
  ('show_updated', config_options.Type(bool, default=True)),
40
42
  ('show_author', config_options.Choice((True, False, 'text'), default=True)),
43
+ ('readtime_wpm', config_options.Type(int, default=DEFAULT_WPM)),
44
+ ('readtime_wpm_cjk', config_options.Type(int, default=DEFAULT_WPM_CJK)),
41
45
  ('recently-updated', config_options.Type((dict, bool), default={}))
42
46
  )
43
47
 
@@ -219,9 +223,13 @@ class DocumentDatesPlugin(BasePlugin):
219
223
  base_path = urlparse(site_url).path.rstrip("/")
220
224
  prefix = f"{base_path}/" if base_path else "/"
221
225
 
226
+ # 获取阅读速度 WPM 配置
227
+ wpm = self.config.get('readtime_wpm', DEFAULT_WPM)
228
+ wpm_cjk = self.config.get('readtime_wpm_cjk', DEFAULT_WPM_CJK)
229
+
222
230
  # 获取最近更新的文档数据
223
231
  recent_exclude_patterns = compile_exclude_patterns(exclude_list)
224
- recently_updated_docs = get_recently_updated_files(self.data_cached, files, recent_exclude_patterns, limit, self.recent_enable, prefix)
232
+ recently_updated_docs = get_recently_updated_files(self.data_cached, files, recent_exclude_patterns, limit, self.recent_enable, prefix, wpm, wpm_cjk)
225
233
 
226
234
  # 将数据注入到 config['extra'] 中供全局访问
227
235
  if not config.get('extra', {}).get("recently_updated_docs", {}):
@@ -264,11 +272,15 @@ class DocumentDatesPlugin(BasePlugin):
264
272
  with open(file_path, 'r', encoding='utf-8') as f:
265
273
  data = yaml.safe_load(f)
266
274
  for key, info in (data or {}).get('authors', {}).items():
267
- self.authors_yml[key] = Author(**info)
275
+ author_obj = Author(**info)
276
+ self.authors_yml[key] = author_obj
277
+ if author_obj.name and author_obj.name not in self.authors_yml:
278
+ self.authors_yml[author_obj.name] = author_obj
279
+ if author_obj.email and author_obj.email not in self.authors_yml:
280
+ self.authors_yml[author_obj.email] = author_obj
268
281
  except Exception as e:
269
282
  logger.info(f"Error parsing .authors.yml: {e}")
270
283
 
271
-
272
284
  def _render_recently_updated_html(self, env, config, recently_updated_data, summary_lines):
273
285
  # 设置模板加载器
274
286
  template_path = Path(__file__).parent / 'static' / 'templates'
@@ -315,22 +327,31 @@ class DocumentDatesPlugin(BasePlugin):
315
327
  authors_list = self.data_cached.get(rel_path, {}).get('authors', None)
316
328
  if authors_list:
317
329
  authors = []
330
+ seen_names = set()
318
331
  for data in authors_list:
319
- full_author = self.authors_yml.get(data['name'])
332
+ full_author = self.authors_yml.get(data.get('name')) or self.authors_yml.get(data.get('email'))
320
333
  if full_author:
321
- authors.append(self._repair_author(full_author, page.url))
334
+ if getattr(full_author, 'ignore', False) or getattr(full_author, 'exclude', False) or getattr(full_author, 'hidden', False):
335
+ continue
336
+ repaired = self._repair_author(full_author, page.url)
337
+ if repaired.name not in seen_names:
338
+ seen_names.add(repaired.name)
339
+ authors.append(repaired)
322
340
  else:
323
- authors.append(Author(**data))
341
+ if data.get('name') not in seen_names:
342
+ seen_names.add(data.get('name'))
343
+ authors.append(Author(**data))
324
344
  return authors
325
345
 
326
346
  # 2. site_author 或 PC username
327
347
  name = config.get('site_author') or Path.home().name
328
348
  full_author = self.authors_yml.get(name)
329
349
  if full_author:
350
+ if getattr(full_author, 'ignore', False) or getattr(full_author, 'exclude', False) or getattr(full_author, 'hidden', False):
351
+ return []
330
352
  return [self._repair_author(full_author, page.url)]
331
353
  else:
332
354
  return [Author(name=name)]
333
-
334
355
  def _load_meta_author(self, meta, page_url):
335
356
  try:
336
357
  # 匹配 authors 数组
@@ -82,15 +82,15 @@
82
82
  <div>
83
83
  {%- for mtime, rel_path, title, url, cover, summary in recent_docs %}
84
84
  <div class="article-card">
85
- <a class="card-header" href="{{ url }}" target="_blank">
86
- <div class="card-title">{{ title }}</div>
85
+ <a class="card-header" href="{{ url | e }}" target="_blank">
86
+ <div class="card-title">{{ title | e }}</div>
87
87
  <time class="dd-timeago card-date" datetime="{{ mtime }}">{{ mtime[:10] }}</time>
88
88
  </a>
89
89
  <div class="card-body">
90
- <div class="card-summary">{{ summary }}</div>
90
+ <div class="card-summary">{{ summary | e }}</div>
91
91
  {%- if cover %}
92
92
  <div class="card-cover">
93
- <img src="{{ cover }}" alt="{{ title }}">
93
+ <img src="{{ cover | e }}" alt="{{ title | e }}">
94
94
  </div>
95
95
  {%- endif %}
96
96
  </div>
@@ -89,15 +89,15 @@
89
89
  <div class="article-grid">
90
90
  {%- for mtime, rel_path, title, url, cover, summary in recent_docs %}
91
91
  <div class="article-card">
92
- <a class="card-header" href="{{ url }}" target="_blank">
93
- <div class="card-title">{{ title }}</div>
92
+ <a class="card-header" href="{{ url | e }}" target="_blank">
93
+ <div class="card-title">{{ title | e }}</div>
94
94
  <time class="dd-timeago card-date" datetime="{{ mtime }}">{{ mtime[:10] }}</time>
95
95
  </a>
96
96
  <div class="card-body">
97
- <div class="card-summary">{{ summary }}</div>
97
+ <div class="card-summary">{{ summary | e }}</div>
98
98
  {%- if cover %}
99
99
  <div class="card-cover">
100
- <img src="{{ cover }}" alt="{{ title }}">
100
+ <img src="{{ cover | e }}" alt="{{ title | e }}">
101
101
  </div>
102
102
  {%- endif %}
103
103
  </div>
@@ -270,17 +270,17 @@
270
270
  {%- set readtime = doc.readtime | default(0) %}
271
271
  {%- set tags = doc.tags | default([]) %}
272
272
  <div class="article-card">
273
- <a class="card-header" href="{{ url }}" target="_blank">
274
- <div class="card-title">{{ title }}</div>
273
+ <a class="card-header" href="{{ url | e }}" target="_blank">
274
+ <div class="card-title">{{ title | e }}</div>
275
275
  <time class="dd-timeago card-date" datetime="{{ updated_dt }}">{{ updated }}</time>
276
276
  </a>
277
277
  <div class="card-body">
278
278
  {%- if cover %}
279
279
  <div class="card-cover">
280
- <img src="{{ cover }}" alt="{{ title }}">
280
+ <img src="{{ cover | e }}" alt="{{ title | e }}">
281
281
  </div>
282
282
  {%- endif %}
283
- <div class="card-summary">{{ summary }}</div>
283
+ <div class="card-summary">{{ summary | e }}</div>
284
284
  </div>
285
285
 
286
286
  {%- if tags or readtime > 0 %}
@@ -298,7 +298,7 @@
298
298
  {%- if tags %}
299
299
  <div class="md-tags">
300
300
  {%- for tag in tags %}
301
- <span class="md-tag md-tag-icon">{{- tag -}}</span>
301
+ <span class="md-tag md-tag-icon">{{- tag | e -}}</span>
302
302
  {%- endfor %}
303
303
  </div>
304
304
  {%- endif %}
@@ -17,6 +17,9 @@ logger = logging.getLogger("mkdocs.plugins.document_dates")
17
17
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
18
18
 
19
19
 
20
+ DEFAULT_WPM = 240
21
+ DEFAULT_WPM_CJK = 480
22
+
20
23
  def load_dates_and_authors(docs_dir_path: Path, files: Files):
21
24
 
22
25
  # git 创建日期
@@ -107,12 +110,38 @@ COAUTHOR_RE = re.compile(
107
110
  r'^Co-authored-by:\s*(.+?) <([^<>]+)>$',
108
111
  re.MULTILINE | re.IGNORECASE
109
112
  )
110
- def parse_commit_authors(name, email, body):
113
+ def check_mailmap(name: str, email: str, git_root: Path = None, cache: dict = None):
114
+ key = (name, email)
115
+ if cache is not None and key in cache:
116
+ return cache[key]
117
+ if git_root:
118
+ try:
119
+ proc = subprocess.run(
120
+ ['git', 'check-mailmap', f'{name} <{email}>'],
121
+ cwd=git_root,
122
+ capture_output=True,
123
+ encoding='utf-8'
124
+ )
125
+ if proc.returncode == 0 and proc.stdout.strip():
126
+ m = re.match(r'^(.*?)\s*<([^<>]+)>$', proc.stdout.strip())
127
+ if m:
128
+ res = (m.group(1).strip(), m.group(2).strip())
129
+ if cache is not None:
130
+ cache[key] = res
131
+ return res
132
+ except Exception as e:
133
+ logger.debug(f"Error checking mailmap for {name} <{email}>: {e}")
134
+ if cache is not None:
135
+ cache[key] = key
136
+ return key
137
+
138
+ def parse_commit_authors(name, email, body, git_root: Path = None, mailmap_cache: dict = None):
139
+ # name/email come from `git log --use-mailmap`; mapping them again can diverge on chained entries
111
140
  authors = [(name, email)]
112
141
  seen = {(name, email)}
113
142
 
114
143
  for co_name, co_email in COAUTHOR_RE.findall(body):
115
- author = (co_name, co_email)
144
+ author = check_mailmap(co_name, co_email, git_root, mailmap_cache)
116
145
  if author in seen:
117
146
  continue
118
147
 
@@ -154,6 +183,7 @@ def load_git_metadata(docs_dir_path: Path):
154
183
  authors_dict = defaultdict(dict)
155
184
  first_commit = {}
156
185
  current_commit = None
186
+ mailmap_cache = {}
157
187
 
158
188
  records = process.stdout.split('\x00')
159
189
  for item in records:
@@ -164,7 +194,7 @@ def load_git_metadata(docs_dir_path: Path):
164
194
  parts = item.split('\x1f', 3)
165
195
  if len(parts) == 4:
166
196
  name, email, created, body = parts
167
- authors = parse_commit_authors(name, email, body)
197
+ authors = parse_commit_authors(name, email, body, git_root, mailmap_cache)
168
198
  current_commit = (authors, int(created))
169
199
  elif item.endswith('.md') and current_commit:
170
200
  authors, created = current_commit
@@ -175,7 +205,6 @@ def load_git_metadata(docs_dir_path: Path):
175
205
  authors_dict[item].setdefault(author, None)
176
206
 
177
207
  first_commit.setdefault(item, created)
178
-
179
208
  # 构建最终的缓存数据
180
209
  for file_path in first_commit:
181
210
  authors_list = [
@@ -230,7 +259,7 @@ def load_git_last_updated_dates(docs_dir_path: Path):
230
259
  return doc_mtime_map
231
260
 
232
261
  # 建议在 on_page_markdown 之后的全局事件中调用,因为需要读取 page.meta 中的信息
233
- def get_recently_updated_files(existing_dates: dict, files: Files, exclude_list: list, limit: int = 10, recent_enable: bool = False, prefix: str = ""):
262
+ def get_recently_updated_files(existing_dates: dict, files: Files, exclude_list: list, limit: int = 10, recent_enable: bool = False, prefix: str = "", wpm: int = DEFAULT_WPM, wpm_cjk: int = DEFAULT_WPM_CJK):
234
263
  recently_updated_results = []
235
264
  if recent_enable:
236
265
  files_meta = []
@@ -262,7 +291,7 @@ def get_recently_updated_files(existing_dates: dict, files: Files, exclude_list:
262
291
  cover = prefix + cover.lstrip('/')
263
292
  # authors = file.page.meta.document_dates.authors
264
293
  if file.page.file:
265
- summary, readtime = analyze_markdown(file.page.file.content_string)
294
+ readtime, summary = analyze_markdown(file.page.file.content_string, wpm, wpm_cjk)
266
295
 
267
296
  meta_readtime = int((file.page.meta.get('readtime') or 0) if file.page else 0)
268
297
  readtime = meta_readtime if meta_readtime > 0 else readtime
@@ -360,9 +389,6 @@ def write_jsonl_cache(jsonl_file: Path, dates_cache, tracked_files):
360
389
  # - Supports mixed-language content (e.g. English + CJK)
361
390
  # ==================================================
362
391
 
363
- # ===== Extract Readtime =====
364
- DEFAULT_WPM = 240
365
-
366
392
  # Match Unicode "words" for space-delimited languages (English, Spanish, French, German, Russian, etc.)
367
393
  # CJK characters also match \w in Python, so they are removed before applying this regex to avoid double counting
368
394
  WORD_RE = re.compile(r"\w+", re.UNICODE)
@@ -434,7 +460,7 @@ BRACE_RE = re.compile(r"\{[^}]*\}")
434
460
  MD_SYNTAX_RE = re.compile(r"[`*_#]+")
435
461
 
436
462
 
437
- def analyze_markdown(md: str) -> list:
463
+ def analyze_markdown(md: str, readtime_wpm: int = DEFAULT_WPM, readtime_wpm_cjk: int = DEFAULT_WPM_CJK):
438
464
  # ---------- for Readtime ----------
439
465
  words = 0
440
466
  cjk = 0
@@ -600,15 +626,13 @@ def analyze_markdown(md: str) -> list:
600
626
  # ===============================
601
627
  # compute read time
602
628
  # ===============================
603
- units = words + cjk / 2
604
- seconds = math.ceil(units / DEFAULT_WPM * 60)
605
-
629
+ seconds = math.ceil((words / readtime_wpm + cjk / readtime_wpm_cjk) * 60)
606
630
  seconds += table_rows * 2
607
631
  seconds += code_rows
608
632
  seconds += math_blocks * 4
609
633
  seconds += images * 2
610
634
 
611
- summary = MD_SYNTAX_RE.sub("", " ".join(summary_lines)).strip()
612
635
  minutes = max(1, math.ceil(seconds / 60))
636
+ summary = MD_SYNTAX_RE.sub("", " ".join(summary_lines)).strip()
613
637
 
614
- return summary, minutes
638
+ return minutes, summary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.8.6
3
+ Version: 3.8.8
4
4
  Summary: A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents
5
5
  Author-email: Aaron Wang <aaronwqt@gmail.com>
6
6
  License-Expression: MIT
@@ -25,7 +25,7 @@ English | [简体中文](README_zh.md)
25
25
 
26
26
  A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
27
27
 
28
- ![render](render.gif)
28
+ ![render](docs/assets/document-dates.gif)
29
29
 
30
30
  ## Features
31
31
 
@@ -90,7 +90,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
90
90
 
91
91
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
92
92
 
93
- ![recently-updated](recently-updated-en.gif)
93
+ ![recently-updated](docs/assets/recently-updated-en.gif)
94
94
 
95
95
  ## Other Projects
96
96
 
@@ -102,7 +102,3 @@ Updates have been released that refactor and add a lot of new features, see http
102
102
  ## Chat Group
103
103
 
104
104
  **Discord**: https://discord.gg/cvTfge4AUy
105
-
106
- **Wechat**:
107
-
108
- <img src="wechat-group.jpg" width="140" />
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mkdocs-document-dates"
7
- version = "3.8.6"
7
+ version = "3.8.8"
8
8
  description = "A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.7"
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
  def legacy_setup():
5
5
  setup(
6
6
  name="mkdocs-document-dates",
7
- version="3.8.6",
7
+ version="3.8.8",
8
8
  author="Aaron Wang",
9
9
  author_email="aaronwqt@gmail.com",
10
10
  license="MIT",