mkdocs-include-markdown-plugin 6.2.0__tar.gz → 6.2.2__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 (15) hide show
  1. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/PKG-INFO +10 -6
  2. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/README.md +7 -4
  3. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/pyproject.toml +9 -8
  4. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/cache.py +6 -6
  5. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/directive.py +2 -2
  6. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/event.py +10 -4
  7. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/process.py +8 -4
  8. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/.gitignore +0 -0
  9. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/LICENSE +0 -0
  10. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/__init__.py +0 -0
  11. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/config.py +0 -0
  12. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/files_watcher.py +0 -0
  13. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/logger.py +0 -0
  14. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/plugin.py +0 -0
  15. {mkdocs_include_markdown_plugin-6.2.0 → mkdocs_include_markdown_plugin-6.2.2}/src/mkdocs_include_markdown_plugin/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mkdocs-include-markdown-plugin
3
- Version: 6.2.0
3
+ Version: 6.2.2
4
4
  Summary: Mkdocs Markdown includer plugin.
5
5
  Project-URL: Source, https://github.com/mondeja/mkdocs-include-markdown-plugin
6
6
  Project-URL: Documentation, https://github.com/mondeja/mkdocs-include-markdown-plugin#documentation
@@ -22,13 +22,14 @@ Classifier: Programming Language :: Python :: 3.9
22
22
  Classifier: Programming Language :: Python :: 3.10
23
23
  Classifier: Programming Language :: Python :: 3.11
24
24
  Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
25
26
  Classifier: Topic :: Documentation
26
27
  Classifier: Topic :: Software Development :: Documentation
27
28
  Classifier: Topic :: Text Processing
28
29
  Classifier: Topic :: Text Processing :: Markup :: Markdown
29
30
  Requires-Python: >=3.8
30
31
  Requires-Dist: mkdocs>=1.4
31
- Requires-Dist: wcmatch<9,>=8
32
+ Requires-Dist: wcmatch
32
33
  Provides-Extra: cache
33
34
  Requires-Dist: platformdirs; extra == 'cache'
34
35
  Description-Content-Type: text/markdown
@@ -43,6 +44,7 @@ Description-Content-Type: text/markdown
43
44
  [![License][license-image]][license-link]
44
45
  [![Tests][tests-image]][tests-link]
45
46
  [![Coverage status][coverage-image]][coverage-link]
47
+ [![Downloads][downloads-image]][downloads-link]
46
48
 
47
49
  <!-- mdpo-enable -->
48
50
 
@@ -194,8 +196,8 @@ content to include.
194
196
  **recursive** (_true_): When this option is disabled, included files are not
195
197
  processed for recursive includes. Possible values are `true` and `false`.
196
198
  - <a name="include-markdown_encoding" href="#include-markdown_encoding">#</a>
197
- **encoding** (_utf-8_): Specify the encoding of the included file.
198
- If not defined `utf-8` will be used.
199
+ **encoding** (_'utf-8'_): Specify the encoding of the included file.
200
+ If not defined `'utf-8'` will be used.
199
201
  - <a name="include-markdown_rewrite-relative-urls" href="#include-markdown_rewrite-relative-urls">#</a>
200
202
  **rewrite-relative-urls** (_true_): When this option is enabled (default),
201
203
  Markdown links and images in the content that are specified by a relative URL
@@ -285,8 +287,8 @@ Includes the content of a file or a group of files.
285
287
  **recursive** (_true_): When this option is disabled, included files are not
286
288
  processed for recursive includes. Possible values are `true` and `false`.
287
289
  - <a name="include_encoding" href="#include_encoding">#</a>
288
- **encoding** (_utf-8_): Specify the encoding of the included file.
289
- If not defined `utf-8` will be used.
290
+ **encoding** (_'utf-8'_): Specify the encoding of the included file.
291
+ If not defined `'utf-8'` will be used.
290
292
 
291
293
  ##### Examples
292
294
 
@@ -330,6 +332,8 @@ Includes the content of a file or a group of files.
330
332
  [coverage-link]: https://app.codecov.io/gh/mondeja/mkdocs-include-markdown-plugin
331
333
  [license-image]: https://img.shields.io/pypi/l/mkdocs-include-markdown-plugin?color=light-green&logo=apache&logoColor=white
332
334
  [license-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/LICENSE
335
+ [downloads-image]: https://img.shields.io/pypi/dm/mkdocs-include-markdown-plugin
336
+ [downloads-link]: https://pepy.tech/project/mkdocs-include-markdown-plugin
333
337
  [platformdirs]: https://pypi.org/project/platformdirs/
334
338
  [cibuildwheel-470]: https://github.com/pypa/cibuildwheel/issues/470
335
339
  [cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475
@@ -8,6 +8,7 @@
8
8
  [![License][license-image]][license-link]
9
9
  [![Tests][tests-image]][tests-link]
10
10
  [![Coverage status][coverage-image]][coverage-link]
11
+ [![Downloads][downloads-image]][downloads-link]
11
12
 
12
13
  <!-- mdpo-enable -->
13
14
 
@@ -159,8 +160,8 @@ content to include.
159
160
  **recursive** (_true_): When this option is disabled, included files are not
160
161
  processed for recursive includes. Possible values are `true` and `false`.
161
162
  - <a name="include-markdown_encoding" href="#include-markdown_encoding">#</a>
162
- **encoding** (_utf-8_): Specify the encoding of the included file.
163
- If not defined `utf-8` will be used.
163
+ **encoding** (_'utf-8'_): Specify the encoding of the included file.
164
+ If not defined `'utf-8'` will be used.
164
165
  - <a name="include-markdown_rewrite-relative-urls" href="#include-markdown_rewrite-relative-urls">#</a>
165
166
  **rewrite-relative-urls** (_true_): When this option is enabled (default),
166
167
  Markdown links and images in the content that are specified by a relative URL
@@ -250,8 +251,8 @@ Includes the content of a file or a group of files.
250
251
  **recursive** (_true_): When this option is disabled, included files are not
251
252
  processed for recursive includes. Possible values are `true` and `false`.
252
253
  - <a name="include_encoding" href="#include_encoding">#</a>
253
- **encoding** (_utf-8_): Specify the encoding of the included file.
254
- If not defined `utf-8` will be used.
254
+ **encoding** (_'utf-8'_): Specify the encoding of the included file.
255
+ If not defined `'utf-8'` will be used.
255
256
 
256
257
  ##### Examples
257
258
 
@@ -295,6 +296,8 @@ Includes the content of a file or a group of files.
295
296
  [coverage-link]: https://app.codecov.io/gh/mondeja/mkdocs-include-markdown-plugin
296
297
  [license-image]: https://img.shields.io/pypi/l/mkdocs-include-markdown-plugin?color=light-green&logo=apache&logoColor=white
297
298
  [license-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/LICENSE
299
+ [downloads-image]: https://img.shields.io/pypi/dm/mkdocs-include-markdown-plugin
300
+ [downloads-link]: https://pepy.tech/project/mkdocs-include-markdown-plugin
298
301
  [platformdirs]: https://pypi.org/project/platformdirs/
299
302
  [cibuildwheel-470]: https://github.com/pypa/cibuildwheel/issues/470
300
303
  [cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocs-include-markdown-plugin"
3
- version = "6.2.0"
3
+ version = "6.2.2"
4
4
  description = "Mkdocs Markdown includer plugin."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -19,12 +19,13 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.9",
20
20
  "Programming Language :: Python :: 3.10",
21
21
  "Programming Language :: Python :: 3.11",
22
- "Programming Language :: Python :: 3.12"
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
23
24
  ]
24
25
  keywords = ["markdown", "mkdocs", "includer", "plugin"]
25
26
  dependencies = [
26
27
  "mkdocs>=1.4",
27
- "wcmatch>=8,<9"
28
+ "wcmatch"
28
29
  ]
29
30
 
30
31
  [[project.authors]]
@@ -73,7 +74,7 @@ matrix-name-format = "{variable}-{value}"
73
74
  dependencies = ["pytest~=7.0", "coverage~=6.4", "covdefaults"]
74
75
 
75
76
  [[tool.hatch.envs.tests.matrix]]
76
- python = ["py38", "py39", "py310", "py311", "py312"]
77
+ python = ["py38", "py39", "py310", "py311", "py312", "py313"]
77
78
  mkdocs = ["1.4.0", "1.4.3", "1.5.0", "1.5.3", "1.6.0"]
78
79
  cache = ["yes", "no"]
79
80
 
@@ -104,9 +105,9 @@ targets = [{ file = "pyproject.toml" }]
104
105
  [tool.project-config]
105
106
  cache = "2 days"
106
107
  style = [
107
- "gh://mondeja/project-config-styles@v5.2.1/base/pre-commit/md2po2md.json5",
108
- "gh://mondeja/project-config-styles@v5.2.1/python/base.json5",
109
- "gh://mondeja/project-config-styles@v5.2.1/python/mypy.json5",
108
+ "gh://mondeja/project-config-styles@v5.3/base/pre-commit/md2po2md.json5",
109
+ "gh://mondeja/project-config-styles@v5.3/python/base.json5",
110
+ "gh://mondeja/project-config-styles@v5.3/python/mypy.json5",
110
111
  ]
111
112
 
112
113
  [tool.coverage.run]
@@ -203,7 +204,7 @@ extra-standard-library = [
203
204
 
204
205
  [tool.mypy]
205
206
  strict = true
206
- python_version = "3.11"
207
+ python_version = "3.12"
207
208
  allow_untyped_calls = true
208
209
  allow_any_generics = true
209
210
 
@@ -39,24 +39,24 @@ class Cache:
39
39
  hashlib.sha3_512(url.encode()).digest(),
40
40
  ).decode('utf-8')
41
41
 
42
- def read_file(self, fpath: str) -> str: # noqa: D102
43
- with open(fpath, encoding='utf-8') as f:
42
+ def read_file(self, fpath: str, encoding: str = 'utf-8') -> str: # noqa: D102
43
+ with open(fpath, encoding=encoding) as f:
44
44
  return f.read().split('\n', 1)[1]
45
45
 
46
- def get_(self, url: str) -> str | None: # noqa: D102
46
+ def get_(self, url: str, encoding: str = 'utf-8') -> str | None: # noqa: D102
47
47
  key = self.generate_unique_key_from_url(url)
48
48
  fpath = os.path.join(self.cache_dir, key)
49
49
  if os.path.isfile(fpath):
50
50
  creation_time = self.get_creation_time_from_fpath(fpath)
51
51
  if time.time() < creation_time + self.expiration_seconds:
52
- return self.read_file(fpath)
52
+ return self.read_file(fpath, encoding=encoding)
53
53
  os.remove(fpath)
54
54
  return None
55
55
 
56
- def set_(self, url: str, value: str) -> None: # noqa: D102
56
+ def set_(self, url: str, value: str, encoding: str = 'utf-8') -> None: # noqa: D102
57
57
  key = self.generate_unique_key_from_url(url)
58
58
  fpath = os.path.join(self.cache_dir, key)
59
- with open(fpath, 'w', encoding='utf-8') as f:
59
+ with open(fpath, 'w', encoding=encoding) as f:
60
60
  f.write(f'{int(time.time())}\n')
61
61
  f.write(value)
62
62
 
@@ -52,7 +52,7 @@ SINGLE_QUOTED_STR_RE = r"([^']|(?<=\\)')+"
52
52
  # and "$CLOSING_TAG" will be replaced by the effective opening and
53
53
  # closing tags in the `on_config` plugin event.
54
54
  INCLUDE_TAG_RE = rf'''
55
- (?P<_includer_indent>[ \t\f\v\w{re.escape(string.punctuation)}]*?)$OPENING_TAG
55
+ (?P<_includer_indent>[ \t\w\\.]*?)$OPENING_TAG
56
56
  \s*
57
57
  include
58
58
  \s+
@@ -171,7 +171,7 @@ def create_include_tag(
171
171
  """Create a regex pattern to match an inclusion tag directive.
172
172
 
173
173
  Replaces the substrings '$OPENING_TAG' and '$CLOSING_TAG' from
174
- INCLUDE_TAG_REGEX by the effective tag.
174
+ INCLUDE_TAG_RE by the effective tag.
175
175
  """
176
176
  return re.compile(
177
177
  INCLUDE_TAG_RE.replace(' include', f' {tag}').replace(
@@ -230,7 +230,9 @@ def get_file_content( # noqa: PLR0913, PLR0915
230
230
  expected_but_any_found = [start is not None, end is not None]
231
231
  for file_path in file_paths_to_include:
232
232
  if process.is_url(filename):
233
- new_text_to_include = process.read_url(file_path, http_cache)
233
+ new_text_to_include = process.read_url(
234
+ file_path, http_cache, encoding,
235
+ )
234
236
  else:
235
237
  new_text_to_include = process.read_file(file_path, encoding)
236
238
 
@@ -481,7 +483,9 @@ def get_file_content( # noqa: PLR0913, PLR0915
481
483
  text_to_include = ''
482
484
  for file_path in file_paths_to_include:
483
485
  if process.is_url(filename):
484
- new_text_to_include = process.read_url(file_path, http_cache)
486
+ new_text_to_include = process.read_url(
487
+ file_path, http_cache, encoding,
488
+ )
485
489
  else:
486
490
  new_text_to_include = process.read_file(file_path, encoding)
487
491
 
@@ -587,9 +591,11 @@ def get_file_content( # noqa: PLR0913, PLR0915
587
591
  nonlocal new_found_include_markdown_contents
588
592
  markdown_include_index = len(new_found_include_markdown_contents)
589
593
  placeholder = build_placeholder(
590
- markdown_include_index, 'include-markdown')
594
+ markdown_include_index, 'include-markdown',
595
+ )
591
596
  new_found_include_markdown_contents.append(
592
- (placeholder, text_to_include))
597
+ (placeholder, text_to_include),
598
+ )
593
599
  return placeholder
594
600
 
595
601
  # Replace contents by placeholders
@@ -443,16 +443,20 @@ def read_file(file_path: str, encoding: str) -> str:
443
443
  return f.read()
444
444
 
445
445
 
446
- def read_url(url: str, http_cache: Cache | None) -> Any:
446
+ def read_url(
447
+ url: str,
448
+ http_cache: Cache | None,
449
+ encoding: str = 'utf-8',
450
+ ) -> Any:
447
451
  """Read an HTTP location and return its content."""
448
452
  if http_cache is not None:
449
- cached_content = http_cache.get_(url)
453
+ cached_content = http_cache.get_(url, encoding)
450
454
  if cached_content is not None:
451
455
  return cached_content
452
456
  with urlopen(Request(url)) as response:
453
- content = response.read().decode('UTF-8')
457
+ content = response.read().decode(encoding)
454
458
  if http_cache is not None:
455
- http_cache.set_(url, content)
459
+ http_cache.set_(url, content, encoding)
456
460
  return content
457
461
 
458
462