mkdocs-include-markdown-plugin 6.0.3__tar.gz → 6.0.5__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 (14) hide show
  1. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/LICENSE +1 -1
  2. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/PKG-INFO +57 -46
  3. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/README.md +55 -44
  4. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/pyproject.toml +15 -11
  5. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/event.py +21 -41
  6. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/.gitignore +0 -0
  7. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/__init__.py +0 -0
  8. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/cache.py +0 -0
  9. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/config.py +0 -0
  10. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/directive.py +0 -0
  11. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/files_watcher.py +0 -0
  12. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/plugin.py +0 -0
  13. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/process.py +0 -0
  14. {mkdocs_include_markdown_plugin-6.0.3 → mkdocs_include_markdown_plugin-6.0.5}/src/mkdocs_include_markdown_plugin/py.typed +0 -0
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright 2017-2023 Joe Rickerby and contributors
190
+ Copyright 2017-2024 Joe Rickerby and contributors
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: mkdocs-include-markdown-plugin
3
- Version: 6.0.3
3
+ Version: 6.0.5
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
@@ -96,46 +96,51 @@ plugins:
96
96
  end: <!--end-->
97
97
  ```
98
98
 
99
- - <a name="config_tags" href="#config_tags">#</a> **opening_tag** and
100
- **closing_tag**: The default opening and closing tags. By default are
101
- `{%` and `%}`.
102
-
103
- ```yaml
104
- plugins:
105
- - include-markdown:
106
- opening_tag: "{!"
107
- closing_tag: "!}"
108
- ```
109
-
110
- - <a name="config_exclude" href="#config_exclude">#</a> **exclude**: Define
111
- global exclusion wildcard patterns. Relative paths defined here will be
112
- relative to the _docs/_ directory.
113
-
114
- ```yaml
115
- plugins:
116
- - include-markdown:
117
- exclude:
118
- - LICENSE.md
119
- - api/**
120
- ```
121
-
122
- - <a name="config_cache" href="#config_cache">#</a> **cache**: Define a
123
- expiration time in seconds for cached HTTP requests when including
124
- from URLs.
125
-
126
- ```yaml
127
- plugins:
128
- - include-markdown:
129
- cache: 600
130
- ```
131
-
132
- In order to use this feature, the dependency [platformdirs] must be installed.
133
- You can include it in the installation of the plugin adding the `cache` extra:
134
-
135
- ```txt
136
- # requirements.txt
137
- mkdocs-include-markdown-plugin[cache]
138
- ```
99
+ #### `opening_tag` and `closing_tag`
100
+
101
+ Default opening and closing tags. When not specified they are `{%` and `%}`.
102
+
103
+ ```yaml
104
+ plugins:
105
+ - include-markdown:
106
+ opening_tag: "{!"
107
+ closing_tag: "!}"
108
+ ```
109
+
110
+ <!-- mdpo-disable-next-line -->
111
+
112
+ #### `exclude`
113
+
114
+ Global exclusion wildcard patterns. Relative paths defined here will be
115
+ relative to the [`docs_dir`] directory.
116
+
117
+ ```yaml
118
+ plugins:
119
+ - include-markdown:
120
+ exclude:
121
+ - LICENSE.md
122
+ - api/**
123
+ ```
124
+
125
+ <!-- mdpo-disable-next-line -->
126
+
127
+ #### `cache`
128
+
129
+ Expiration time in seconds for cached HTTP requests when including from URLs.
130
+
131
+ ```yaml
132
+ plugins:
133
+ - include-markdown:
134
+ cache: 600
135
+ ```
136
+
137
+ In order to use this feature, the dependency [platformdirs] must be installed.
138
+ You can include it in the installation of the plugin adding the `cache` extra:
139
+
140
+ ```txt
141
+ # requirements.txt
142
+ mkdocs-include-markdown-plugin[cache]
143
+ ```
139
144
 
140
145
  ### Reference
141
146
 
@@ -148,7 +153,9 @@ Paths of included files can be either:
148
153
  - Local files:
149
154
  - Absolute paths (starting with a path separator).
150
155
  - Relative from the file that includes them (starting with `./` or `../`).
151
- - Relative from the _docs/_ directory.
156
+ - Relative to the [`docs_dir`] directory. For instance if your `docs_dir` is
157
+ _./docs/_, then `includes/header.md` will match the file
158
+ _./docs/includes/header.md_.
152
159
  - [Bash wildcard globs] matching multiple local files.
153
160
 
154
161
  File paths to include and string arguments can be wrapped by double `"` or
@@ -212,7 +219,7 @@ content to include.
212
219
 
213
220
  ```jinja
214
221
  {%
215
- include-markdown 'docs/includes/header.md'
222
+ include-markdown 'includes/header.md'
216
223
  start='<!--\n\ttable-start\n-->'
217
224
  end='<!--\n\ttable-end\n-->'
218
225
  rewrite-relative-urls=false
@@ -222,7 +229,7 @@ content to include.
222
229
 
223
230
  ```jinja
224
231
  {%
225
- include-markdown "docs/includes/header.md"
232
+ include-markdown "includes/header.md"
226
233
  heading-offset=1
227
234
  %}
228
235
  ```
@@ -303,6 +310,10 @@ Includes the content of a file or a group of files.
303
310
  [giving me the permissions][cibuildwheel-470] to separate this plugin from the
304
311
  documentation of [cibuildwheel][cibuildwheel-repo-link].
305
312
 
313
+ [Bash wildcard globs]: https://facelessuser.github.io/wcmatch/glob/#syntax
314
+
315
+ <!-- mdpo-disable -->
316
+
306
317
  [pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin
307
318
  [pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-include-markdown-plugin?logo=pypi&logoColor=white
308
319
  [tests-image]: https://img.shields.io/github/actions/workflow/status/mondeja/mkdocs-include-markdown-plugin/ci.yml?logo=github&label=tests&branch=master
@@ -316,4 +327,4 @@ Includes the content of a file or a group of files.
316
327
  [cibuildwheel-repo-link]: https://github.com/pypa/cibuildwheel
317
328
  [es-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/es/README.md
318
329
  [fr-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/fr/README.md
319
- [Bash wildcard globs]: https://facelessuser.github.io/wcmatch/glob/#syntax
330
+ [`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
@@ -61,46 +61,51 @@ plugins:
61
61
  end: <!--end-->
62
62
  ```
63
63
 
64
- - <a name="config_tags" href="#config_tags">#</a> **opening_tag** and
65
- **closing_tag**: The default opening and closing tags. By default are
66
- `{%` and `%}`.
67
-
68
- ```yaml
69
- plugins:
70
- - include-markdown:
71
- opening_tag: "{!"
72
- closing_tag: "!}"
73
- ```
74
-
75
- - <a name="config_exclude" href="#config_exclude">#</a> **exclude**: Define
76
- global exclusion wildcard patterns. Relative paths defined here will be
77
- relative to the _docs/_ directory.
78
-
79
- ```yaml
80
- plugins:
81
- - include-markdown:
82
- exclude:
83
- - LICENSE.md
84
- - api/**
85
- ```
86
-
87
- - <a name="config_cache" href="#config_cache">#</a> **cache**: Define a
88
- expiration time in seconds for cached HTTP requests when including
89
- from URLs.
90
-
91
- ```yaml
92
- plugins:
93
- - include-markdown:
94
- cache: 600
95
- ```
96
-
97
- In order to use this feature, the dependency [platformdirs] must be installed.
98
- You can include it in the installation of the plugin adding the `cache` extra:
99
-
100
- ```txt
101
- # requirements.txt
102
- mkdocs-include-markdown-plugin[cache]
103
- ```
64
+ #### `opening_tag` and `closing_tag`
65
+
66
+ Default opening and closing tags. When not specified they are `{%` and `%}`.
67
+
68
+ ```yaml
69
+ plugins:
70
+ - include-markdown:
71
+ opening_tag: "{!"
72
+ closing_tag: "!}"
73
+ ```
74
+
75
+ <!-- mdpo-disable-next-line -->
76
+
77
+ #### `exclude`
78
+
79
+ Global exclusion wildcard patterns. Relative paths defined here will be
80
+ relative to the [`docs_dir`] directory.
81
+
82
+ ```yaml
83
+ plugins:
84
+ - include-markdown:
85
+ exclude:
86
+ - LICENSE.md
87
+ - api/**
88
+ ```
89
+
90
+ <!-- mdpo-disable-next-line -->
91
+
92
+ #### `cache`
93
+
94
+ Expiration time in seconds for cached HTTP requests when including from URLs.
95
+
96
+ ```yaml
97
+ plugins:
98
+ - include-markdown:
99
+ cache: 600
100
+ ```
101
+
102
+ In order to use this feature, the dependency [platformdirs] must be installed.
103
+ You can include it in the installation of the plugin adding the `cache` extra:
104
+
105
+ ```txt
106
+ # requirements.txt
107
+ mkdocs-include-markdown-plugin[cache]
108
+ ```
104
109
 
105
110
  ### Reference
106
111
 
@@ -113,7 +118,9 @@ Paths of included files can be either:
113
118
  - Local files:
114
119
  - Absolute paths (starting with a path separator).
115
120
  - Relative from the file that includes them (starting with `./` or `../`).
116
- - Relative from the _docs/_ directory.
121
+ - Relative to the [`docs_dir`] directory. For instance if your `docs_dir` is
122
+ _./docs/_, then `includes/header.md` will match the file
123
+ _./docs/includes/header.md_.
117
124
  - [Bash wildcard globs] matching multiple local files.
118
125
 
119
126
  File paths to include and string arguments can be wrapped by double `"` or
@@ -177,7 +184,7 @@ content to include.
177
184
 
178
185
  ```jinja
179
186
  {%
180
- include-markdown 'docs/includes/header.md'
187
+ include-markdown 'includes/header.md'
181
188
  start='<!--\n\ttable-start\n-->'
182
189
  end='<!--\n\ttable-end\n-->'
183
190
  rewrite-relative-urls=false
@@ -187,7 +194,7 @@ content to include.
187
194
 
188
195
  ```jinja
189
196
  {%
190
- include-markdown "docs/includes/header.md"
197
+ include-markdown "includes/header.md"
191
198
  heading-offset=1
192
199
  %}
193
200
  ```
@@ -268,6 +275,10 @@ Includes the content of a file or a group of files.
268
275
  [giving me the permissions][cibuildwheel-470] to separate this plugin from the
269
276
  documentation of [cibuildwheel][cibuildwheel-repo-link].
270
277
 
278
+ [Bash wildcard globs]: https://facelessuser.github.io/wcmatch/glob/#syntax
279
+
280
+ <!-- mdpo-disable -->
281
+
271
282
  [pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin
272
283
  [pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-include-markdown-plugin?logo=pypi&logoColor=white
273
284
  [tests-image]: https://img.shields.io/github/actions/workflow/status/mondeja/mkdocs-include-markdown-plugin/ci.yml?logo=github&label=tests&branch=master
@@ -281,4 +292,4 @@ Includes the content of a file or a group of files.
281
292
  [cibuildwheel-repo-link]: https://github.com/pypa/cibuildwheel
282
293
  [es-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/es/README.md
283
294
  [fr-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/fr/README.md
284
- [Bash wildcard globs]: https://facelessuser.github.io/wcmatch/glob/#syntax
295
+ [`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocs-include-markdown-plugin"
3
- version = "6.0.3"
3
+ version = "6.0.5"
4
4
  description = "Mkdocs Markdown includer plugin."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -74,7 +74,7 @@ dependencies = ["pytest~=7.0", "coverage~=6.4", "covdefaults"]
74
74
 
75
75
  [[tool.hatch.envs.tests.matrix]]
76
76
  python = ["py38", "py39", "py310", "py311", "py312"]
77
- mkdocs = ["1.4.0", "1.4.3", "1.5.0", "1.5.1"]
77
+ mkdocs = ["1.4.0", "1.4.3", "1.5.0", "1.5.3"]
78
78
  cache = ["yes", "no"]
79
79
 
80
80
  [tool.hatch.envs.tests.overrides]
@@ -82,7 +82,7 @@ matrix.mkdocs.dependencies = [
82
82
  { value = "mkdocs==1.4.0", if = ["1.4.0"] },
83
83
  { value = "mkdocs==1.4.3", if = ["1.4.3"] },
84
84
  { value = "mkdocs==1.5.0", if = ["1.5.0"] },
85
- { value = "mkdocs==1.5.1", if = ["1.5.1"] },
85
+ { value = "mkdocs==1.5.3", if = ["1.5.3"] },
86
86
  ]
87
87
  matrix.cache.dependencies = [{ value = "platformdirs", if = ["yes"] }]
88
88
 
@@ -103,9 +103,9 @@ targets = [{ file = "pyproject.toml" }]
103
103
  [tool.project-config]
104
104
  cache = "2 days"
105
105
  style = [
106
- "gh://mondeja/project-config-styles@v5/base/pre-commit/md2po2md.json5",
107
- "gh://mondeja/project-config-styles@v5/python/base.json5",
108
- "gh://mondeja/project-config-styles@v5/python/mypy.json5",
106
+ "gh://mondeja/project-config-styles@v5.2.1/base/pre-commit/md2po2md.json5",
107
+ "gh://mondeja/project-config-styles@v5.2.1/python/base.json5",
108
+ "gh://mondeja/project-config-styles@v5.2.1/python/mypy.json5",
109
109
  ]
110
110
 
111
111
  [tool.coverage.run]
@@ -121,6 +121,8 @@ fail_under = 1
121
121
  [tool.ruff]
122
122
  line-length = 80
123
123
  target-version = "py38"
124
+
125
+ [tool.ruff.lint]
124
126
  select = [
125
127
  "W",
126
128
  "B",
@@ -148,23 +150,25 @@ select = [
148
150
  "COM",
149
151
  "SLOT",
150
152
  ]
153
+ ignore = ["G004"]
151
154
 
152
- [tool.ruff.pydocstyle]
155
+ [tool.ruff.lint.pydocstyle]
153
156
  convention = "google"
154
157
 
155
- [tool.ruff.flake8-quotes]
158
+ [tool.ruff.lint.flake8-quotes]
156
159
  inline-quotes = "single"
157
160
  multiline-quotes = "single"
158
161
 
159
- [tool.ruff.flake8-pytest-style]
162
+ [tool.ruff.lint.flake8-pytest-style]
160
163
  fixture-parentheses = false
161
164
  parametrize-values-type = "tuple"
162
165
  parametrize-values-row-type = "tuple"
163
166
 
164
- [tool.ruff.isort]
167
+ [tool.ruff.lint.isort]
165
168
  lines-after-imports = 2
166
169
  combine-as-imports = true
167
170
  force-wrap-aliases = true
171
+ known-first-party = ["mkdocs_include_markdown_plugin", "testing_helpers"]
168
172
  known-local-folder = ["tests"]
169
173
  required-imports = ["from __future__ import annotations"]
170
174
  extra-standard-library = [
@@ -174,7 +178,7 @@ extra-standard-library = [
174
178
  "wsgiref.types"
175
179
  ]
176
180
 
177
- [tool.ruff.per-file-ignores]
181
+ [tool.ruff.lint.per-file-ignores]
178
182
  "tests/**" = [
179
183
  "I002",
180
184
  "D100",
@@ -48,7 +48,9 @@ class Settings: # noqa: D101
48
48
  exclude: list[str] | None
49
49
 
50
50
 
51
- logger = logging.getLogger('mkdocs.plugins.mkdocs_include_markdown_plugin')
51
+ # TODO: when Mkdocs < 1.5.0 support is dropped, use
52
+ # mkdocs.plugin.get_plugin_logger
53
+ logger = logging.getLogger('mkdocs.plugins.include_markdown')
52
54
 
53
55
 
54
56
  def lineno_from_content_start(content: str, start: int) -> int:
@@ -276,26 +278,15 @@ def get_file_content( # noqa: PLR0913, PLR0915
276
278
  markdown,
277
279
  directive_match_start,
278
280
  )
281
+ relative_path = os.path.relpath(page_src_path, docs_dir)
279
282
  logger.warning(
280
283
  (
281
- "Delimiter {delimiter_name} '{delimiter_value}'"
282
- " of '{directive}' directive at"
283
- ' {relative_path}:{line_number}'
284
- ' not detected in the file{plural_suffix}'
285
- ' {readable_files_to_include}'
284
+ f"Delimiter {delimiter_name} '{delimiter_value}'"
285
+ " of 'include' directive at"
286
+ f' {relative_path}:{lineno}'
287
+ f' not detected in the file{plural_suffix}'
288
+ f' {readable_files_to_include}'
286
289
  ),
287
- extra={
288
- 'delimiter_name': delimiter_name,
289
- 'delimiter_value': delimiter_value,
290
- 'directive': 'include',
291
- 'relative_path': os.path.relpath(
292
- page_src_path,
293
- docs_dir,
294
- ),
295
- 'line_number': lineno,
296
- 'plural_suffix': plural_suffix,
297
- 'readable_files_to_include': readable_files_to_include,
298
- },
299
290
  )
300
291
 
301
292
  return text_to_include
@@ -453,8 +444,8 @@ def get_file_content( # noqa: PLR0913, PLR0915
453
444
  arguments_string,
454
445
  )
455
446
  if offset_match:
456
- offset = offset_match[1]
457
- if offset == '':
447
+ offset_raw_value = offset_match[1]
448
+ if offset_raw_value == '':
458
449
  lineno = lineno_from_content_start(
459
450
  markdown,
460
451
  directive_match_start,
@@ -465,15 +456,15 @@ def get_file_content( # noqa: PLR0913, PLR0915
465
456
  f' {os.path.relpath(page_src_path, docs_dir)}:{lineno}',
466
457
  )
467
458
  try:
468
- offset = int(offset)
459
+ offset = int(offset_raw_value)
469
460
  except ValueError:
470
461
  lineno = lineno_from_content_start(
471
462
  markdown,
472
463
  directive_match_start,
473
464
  )
474
465
  raise PluginError(
475
- f"Invalid 'heading-offset' argument \"{offset}\" in"
476
- " 'include-markdown' directive at "
466
+ f"Invalid 'heading-offset' argument \"{offset_raw_value}\""
467
+ " in 'include-markdown' directive at "
477
468
  f'{os.path.relpath(page_src_path, docs_dir)}:{lineno}',
478
469
  ) from None
479
470
  else:
@@ -565,7 +556,7 @@ def get_file_content( # noqa: PLR0913, PLR0915
565
556
  )
566
557
  )
567
558
 
568
- if offset_match:
559
+ if offset:
569
560
  new_text_to_include = process.increase_headings_offset(
570
561
  new_text_to_include,
571
562
  offset=offset + cumulative_heading_offset,
@@ -586,26 +577,15 @@ def get_file_content( # noqa: PLR0913, PLR0915
586
577
  markdown,
587
578
  directive_match_start,
588
579
  )
580
+ relative_path = os.path.relpath(page_src_path, docs_dir)
589
581
  logger.warning(
590
582
  (
591
- "Delimiter {delimiter_name} '{delimiter_value}' of"
592
- " '{directive}' directive at"
593
- ' {relative_path}:{line_number}'
594
- ' not detected in the file{plural_suffix}'
595
- ' {readable_files_to_include}'
583
+ f"Delimiter {delimiter_name} '{delimiter_value}' of"
584
+ " 'include-markdown' directive at"
585
+ f' {relative_path}:{lineno}'
586
+ f' not detected in the file{plural_suffix}'
587
+ f' {readable_files_to_include}'
596
588
  ),
597
- extra={
598
- 'delimiter_name': delimiter_name,
599
- 'delimiter_value': delimiter_value,
600
- 'directive': 'include-markdown',
601
- 'relative_path': os.path.relpath(
602
- page_src_path,
603
- docs_dir,
604
- ),
605
- 'line_number': lineno,
606
- 'plural_suffix': plural_suffix,
607
- 'readable_files_to_include': readable_files_to_include,
608
- },
609
589
  )
610
590
 
611
591
  return text_to_include