mkdocs-recently-updated-docs 0.1__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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aaron Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: mkdocs-recently-updated-docs
3
+ Version: 0.1
4
+ Summary: A MkDocs plugin to show recently updated documents
5
+ Home-page: https://github.com/jaywhj/mkdocs-recently-updated-docs
6
+ Author: Aaron Wang
7
+ Author-email: aaronwqt@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: mkdocs>=1.1.0
15
+ Requires-Dist: mkdocs_document_dates>=3.4
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # mkdocs-recently-updated-docs
29
+
30
+ English | [简体中文](README_zh.md)
31
+
32
+
33
+
34
+ One line of code to display a list of recently updated documents
35
+
36
+ ## Features
37
+
38
+ - Supports display of recently updated documents in an overall list
39
+ - Flexible display position (`sidebar` or `in md document`)
40
+ - Rich template examples
41
+ - Works well for any environment (no-Git, Git, all CI/CD build systems, etc)
42
+
43
+ ## Preview
44
+
45
+ ![recently-updated](recently-updated.png)
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install mkdocs-recently-updated-docs
51
+ ```
52
+
53
+ ## Configuration
54
+
55
+ Just add the plugin to your `mkdocs.yml`:
56
+
57
+ ```yaml
58
+ plugins:
59
+ - recently-updated
60
+ ```
61
+
62
+ Or, personalize the configuration:
63
+
64
+ ```yaml
65
+ plugins:
66
+ - recently-updated:
67
+ limit: 10 # Limit the number of docs displayed
68
+ exclude: # List of excluded files
69
+ - index.md # Exclude specific file
70
+ - drafts/* # Exclude all files in drafts folder, including subfolders
71
+ template: templates/recently_updated_list.html # Custom rendering template
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ Just write this line in your md document anywhere:
77
+
78
+ ```markdown
79
+ <!-- RECENTLY_UPDATED_DOCS -->
80
+ ```
81
+
82
+ ## Custom template
83
+
84
+ See [templates](https://github.com/jaywhj/mkdocs-recently-updated-docs/tree/main/mkdocs_recently_updated_docs/templates) directory
85
+
86
+ <br />
87
+
88
+ ## Other plugins
89
+
90
+ [mkdocs-document-dates](https://github.com/jaywhj/mkdocs-document-dates)
91
+
92
+ A new generation MkDocs plugin for displaying exact **creation time, last update time, authors, email** of documents
93
+
94
+ ![render](render.gif)
@@ -0,0 +1,67 @@
1
+ # mkdocs-recently-updated-docs
2
+
3
+ English | [简体中文](README_zh.md)
4
+
5
+
6
+
7
+ One line of code to display a list of recently updated documents
8
+
9
+ ## Features
10
+
11
+ - Supports display of recently updated documents in an overall list
12
+ - Flexible display position (`sidebar` or `in md document`)
13
+ - Rich template examples
14
+ - Works well for any environment (no-Git, Git, all CI/CD build systems, etc)
15
+
16
+ ## Preview
17
+
18
+ ![recently-updated](recently-updated.png)
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install mkdocs-recently-updated-docs
24
+ ```
25
+
26
+ ## Configuration
27
+
28
+ Just add the plugin to your `mkdocs.yml`:
29
+
30
+ ```yaml
31
+ plugins:
32
+ - recently-updated
33
+ ```
34
+
35
+ Or, personalize the configuration:
36
+
37
+ ```yaml
38
+ plugins:
39
+ - recently-updated:
40
+ limit: 10 # Limit the number of docs displayed
41
+ exclude: # List of excluded files
42
+ - index.md # Exclude specific file
43
+ - drafts/* # Exclude all files in drafts folder, including subfolders
44
+ template: templates/recently_updated_list.html # Custom rendering template
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ Just write this line in your md document anywhere:
50
+
51
+ ```markdown
52
+ <!-- RECENTLY_UPDATED_DOCS -->
53
+ ```
54
+
55
+ ## Custom template
56
+
57
+ See [templates](https://github.com/jaywhj/mkdocs-recently-updated-docs/tree/main/mkdocs_recently_updated_docs/templates) directory
58
+
59
+ <br />
60
+
61
+ ## Other plugins
62
+
63
+ [mkdocs-document-dates](https://github.com/jaywhj/mkdocs-document-dates)
64
+
65
+ A new generation MkDocs plugin for displaying exact **creation time, last update time, authors, email** of documents
66
+
67
+ ![render](render.gif)
@@ -0,0 +1,62 @@
1
+ from jinja2 import Environment, FileSystemLoader, select_autoescape
2
+ from pathlib import Path
3
+ from mkdocs.plugins import BasePlugin
4
+ from mkdocs.config import config_options
5
+ from mkdocs_document_dates.utils import get_recently_modified_files
6
+
7
+
8
+ class RecentlyUpdatedPlugin(BasePlugin):
9
+ config_scheme = (
10
+ ('limit', config_options.Type(int, default=10)),
11
+ ('exclude', config_options.Type(list, default=[])),
12
+ ('template', config_options.Type(str, default=''))
13
+ )
14
+
15
+ def __init__(self):
16
+ super().__init__()
17
+
18
+ self.recent_docs_html = None
19
+
20
+ def on_nav(self, nav, config, files):
21
+ limit = self.config.get('limit')
22
+ exclude_list = self.config.get('exclude')
23
+ template_path = self.config.get("template")
24
+
25
+ # 获取 docs 目录下最近更新的文档
26
+ recently_modified_files = get_recently_modified_files(files, exclude_list, limit)
27
+
28
+ # 渲染HTML
29
+ docs_dir = Path(config['docs_dir'])
30
+ self.recent_docs_html = self._render_recently_updated_html(docs_dir, template_path, recently_modified_files)
31
+
32
+ return nav
33
+
34
+ def _render_recently_updated_html(self, docs_dir, template_path, recently_updated_data):
35
+ # 获取自定义模板路径
36
+ if template_path:
37
+ user_full_path = docs_dir / template_path
38
+
39
+ # 选择模板路径
40
+ if template_path and user_full_path.is_file():
41
+ template_dir = user_full_path.parent
42
+ template_file = user_full_path.name
43
+ else:
44
+ # 默认模板路径
45
+ default_template_path = Path(__file__).parent / 'templates' / 'recently_updated_list.html'
46
+ template_dir = default_template_path.parent
47
+ template_file = default_template_path.name
48
+
49
+ # 加载模板
50
+ env = Environment(
51
+ loader=FileSystemLoader(str(template_dir)),
52
+ autoescape=select_autoescape(["html", "xml"])
53
+ )
54
+ template = env.get_template(template_file)
55
+
56
+ # 渲染模板
57
+ return template.render(recent_docs=recently_updated_data)
58
+
59
+ def on_page_markdown(self, markdown, page, config, files):
60
+ if '<!-- RECENTLY_UPDATED_DOCS -->' in markdown:
61
+ markdown = markdown.replace('<!-- RECENTLY_UPDATED_DOCS -->', self.recent_docs_html or '')
62
+ return markdown
@@ -0,0 +1,48 @@
1
+ <style>
2
+ .recently-modified {
3
+ display: grid;
4
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
5
+ gap: 10px;
6
+ margin: 20px 0;
7
+ padding: 0;
8
+ }
9
+ .recently-modified-item {
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: space-between;
13
+ padding: 0.5rem 0.75rem;
14
+ border: 1px solid rgba(142, 142, 142, 0.15);
15
+ border-radius: 2px;
16
+ min-height: 40px;
17
+ transition: box-shadow 0.2s ease;
18
+ }
19
+ .recently-modified-item:hover {
20
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
21
+ }
22
+ .recently-modified-item a {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ height: 100%;
27
+ flex: 1;
28
+ text-decoration: none;
29
+ word-break: break-word;
30
+ color: #0077cc;
31
+ }
32
+ .recently-modified-item span {
33
+ flex: 0 0 90px;
34
+ text-align: right;
35
+ color: rgba(142, 142, 142, 0.5);
36
+ font-size: 0.85rem;
37
+ }
38
+ .md-main .recently-modified-item span {
39
+ font-size: 0.7rem;
40
+ }
41
+ </style>
42
+ <div class="recently-modified">
43
+ {%- for mtime, rel_path, title, url in recent_docs %}
44
+ <div class="recently-modified-item">
45
+ <a href="{{ url }}" target="_blank">{{ title }} <span>{{ mtime[:10] }}</span></a>
46
+ </div>
47
+ {%- endfor %}
48
+ </div>
@@ -0,0 +1,42 @@
1
+ <style>
2
+ .recently-updated {
3
+ display: grid;
4
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
5
+ gap: 10px;
6
+ margin: 0;
7
+ padding: 16px;
8
+ border: 1px solid rgba(142, 142, 142, 0.15);
9
+ border-radius: 4px;
10
+ font-family: system-ui, sans-serif;
11
+ }
12
+ .recently-updated-item {
13
+ display: flex;
14
+ align-items: center;
15
+ }
16
+ .recently-updated-item span {
17
+ font-size: 0.85em;
18
+ color: rgba(142, 142, 142, 0.5);
19
+ margin-right: 8px;
20
+ flex-shrink: 0;
21
+ width: 90px;
22
+ }
23
+ .recently-updated-item a {
24
+ overflow: hidden;
25
+ text-overflow: ellipsis;
26
+ white-space: nowrap;
27
+ color: #0077cc;
28
+ text-decoration: none;
29
+ transition: color 0.2s ease;
30
+ }
31
+ .recently-updated-item a:hover {
32
+ text-decoration: underline;
33
+ }
34
+ </style>
35
+ <div class="recently-updated">
36
+ {%- for mtime, rel_path, title, url in recent_docs %}
37
+ <div class="recently-updated-item">
38
+ <span>{{ mtime[:10] }}</span>
39
+ <a href="{{ url }}" target="_blank">{{ title }}</a>
40
+ </div>
41
+ {%- endfor %}
42
+ </div>
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: mkdocs-recently-updated-docs
3
+ Version: 0.1
4
+ Summary: A MkDocs plugin to show recently updated documents
5
+ Home-page: https://github.com/jaywhj/mkdocs-recently-updated-docs
6
+ Author: Aaron Wang
7
+ Author-email: aaronwqt@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: mkdocs>=1.1.0
15
+ Requires-Dist: mkdocs_document_dates>=3.4
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # mkdocs-recently-updated-docs
29
+
30
+ English | [简体中文](README_zh.md)
31
+
32
+
33
+
34
+ One line of code to display a list of recently updated documents
35
+
36
+ ## Features
37
+
38
+ - Supports display of recently updated documents in an overall list
39
+ - Flexible display position (`sidebar` or `in md document`)
40
+ - Rich template examples
41
+ - Works well for any environment (no-Git, Git, all CI/CD build systems, etc)
42
+
43
+ ## Preview
44
+
45
+ ![recently-updated](recently-updated.png)
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install mkdocs-recently-updated-docs
51
+ ```
52
+
53
+ ## Configuration
54
+
55
+ Just add the plugin to your `mkdocs.yml`:
56
+
57
+ ```yaml
58
+ plugins:
59
+ - recently-updated
60
+ ```
61
+
62
+ Or, personalize the configuration:
63
+
64
+ ```yaml
65
+ plugins:
66
+ - recently-updated:
67
+ limit: 10 # Limit the number of docs displayed
68
+ exclude: # List of excluded files
69
+ - index.md # Exclude specific file
70
+ - drafts/* # Exclude all files in drafts folder, including subfolders
71
+ template: templates/recently_updated_list.html # Custom rendering template
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ Just write this line in your md document anywhere:
77
+
78
+ ```markdown
79
+ <!-- RECENTLY_UPDATED_DOCS -->
80
+ ```
81
+
82
+ ## Custom template
83
+
84
+ See [templates](https://github.com/jaywhj/mkdocs-recently-updated-docs/tree/main/mkdocs_recently_updated_docs/templates) directory
85
+
86
+ <br />
87
+
88
+ ## Other plugins
89
+
90
+ [mkdocs-document-dates](https://github.com/jaywhj/mkdocs-document-dates)
91
+
92
+ A new generation MkDocs plugin for displaying exact **creation time, last update time, authors, email** of documents
93
+
94
+ ![render](render.gif)
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ mkdocs_recently_updated_docs/__init__.py
5
+ mkdocs_recently_updated_docs/plugin.py
6
+ mkdocs_recently_updated_docs.egg-info/PKG-INFO
7
+ mkdocs_recently_updated_docs.egg-info/SOURCES.txt
8
+ mkdocs_recently_updated_docs.egg-info/dependency_links.txt
9
+ mkdocs_recently_updated_docs.egg-info/entry_points.txt
10
+ mkdocs_recently_updated_docs.egg-info/requires.txt
11
+ mkdocs_recently_updated_docs.egg-info/top_level.txt
12
+ mkdocs_recently_updated_docs/templates/recently_updated_card.html
13
+ mkdocs_recently_updated_docs/templates/recently_updated_list.html
@@ -0,0 +1,2 @@
1
+ [mkdocs.plugins]
2
+ recently-updated = mkdocs_recently_updated_docs.plugin:RecentlyUpdatedPlugin
@@ -0,0 +1,2 @@
1
+ mkdocs>=1.1.0
2
+ mkdocs_document_dates>=3.4
@@ -0,0 +1 @@
1
+ mkdocs_recently_updated_docs
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,35 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ VERSION = '0.1'
4
+
5
+ setup(
6
+ name="mkdocs-recently-updated-docs",
7
+ version=VERSION,
8
+ author="Aaron Wang",
9
+ author_email="aaronwqt@gmail.com",
10
+ license="MIT",
11
+ description="A MkDocs plugin to show recently updated documents",
12
+ long_description=open("README.md", encoding="utf-8").read(),
13
+ long_description_content_type="text/markdown",
14
+ url="https://github.com/jaywhj/mkdocs-recently-updated-docs",
15
+ packages=find_packages(),
16
+ install_requires=[
17
+ 'mkdocs>=1.1.0',
18
+ 'mkdocs_document_dates>=3.4',
19
+ ],
20
+ classifiers=[
21
+ "Programming Language :: Python :: 3",
22
+ "Operating System :: OS Independent",
23
+ ],
24
+ entry_points={
25
+ 'mkdocs.plugins': [
26
+ 'recently-updated = mkdocs_recently_updated_docs.plugin:RecentlyUpdatedPlugin',
27
+ ]
28
+ },
29
+ package_data={
30
+ 'mkdocs_recently_updated_docs': [
31
+ 'templates/*'
32
+ ],
33
+ },
34
+ python_requires=">=3.7",
35
+ )