mkdocs-include-markdown-plugin 6.0.3__py3-none-any.whl → 6.0.5__py3-none-any.whl
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.
- mkdocs_include_markdown_plugin/event.py +21 -41
- {mkdocs_include_markdown_plugin-6.0.3.dist-info → mkdocs_include_markdown_plugin-6.0.5.dist-info}/METADATA +57 -46
- {mkdocs_include_markdown_plugin-6.0.3.dist-info → mkdocs_include_markdown_plugin-6.0.5.dist-info}/RECORD +6 -6
- {mkdocs_include_markdown_plugin-6.0.3.dist-info → mkdocs_include_markdown_plugin-6.0.5.dist-info}/WHEEL +1 -1
- {mkdocs_include_markdown_plugin-6.0.3.dist-info → mkdocs_include_markdown_plugin-6.0.5.dist-info}/licenses/LICENSE +1 -1
- {mkdocs_include_markdown_plugin-6.0.3.dist-info → mkdocs_include_markdown_plugin-6.0.5.dist-info}/entry_points.txt +0 -0
|
@@ -48,7 +48,9 @@ class Settings: # noqa: D101
|
|
|
48
48
|
exclude: list[str] | None
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
|
|
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 '
|
|
283
|
-
' {relative_path}:{
|
|
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
|
-
|
|
457
|
-
if
|
|
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(
|
|
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 \"{
|
|
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
|
|
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
|
-
" '
|
|
593
|
-
' {relative_path}:{
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: mkdocs-include-markdown-plugin
|
|
3
|
-
Version: 6.0.
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
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 '
|
|
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 "
|
|
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
|
-
[
|
|
330
|
+
[`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
|
|
@@ -2,13 +2,13 @@ mkdocs_include_markdown_plugin/__init__.py,sha256=ByOde15RQSHlZTmkepPSzIt0GzUIv_
|
|
|
2
2
|
mkdocs_include_markdown_plugin/cache.py,sha256=2CAVNwDUHilY1-x1VMLw33hxv76z1wcpid22jTyoJyI,2784
|
|
3
3
|
mkdocs_include_markdown_plugin/config.py,sha256=qySvva9IBKtnyDEpbYeeXI0HiJ8ONhkVmxEIErW__f0,818
|
|
4
4
|
mkdocs_include_markdown_plugin/directive.py,sha256=Vva7wW2vUc3OUz6NZzlIjzlFCx-YRsD70U4Jdvghomo,7441
|
|
5
|
-
mkdocs_include_markdown_plugin/event.py,sha256=
|
|
5
|
+
mkdocs_include_markdown_plugin/event.py,sha256=xG-Cc-NnDCKrinL6n3rtjTNO0z4GK5WCZL4QmnknHRg,22963
|
|
6
6
|
mkdocs_include_markdown_plugin/files_watcher.py,sha256=hu-63u8syl00mXP59vP_iqD7T1R9iU9JjiZOHDV5fas,298
|
|
7
7
|
mkdocs_include_markdown_plugin/plugin.py,sha256=bnJCikomoNQlMhKbaK__wKXrd-wYssfTzhzLzCrWd5c,3829
|
|
8
8
|
mkdocs_include_markdown_plugin/process.py,sha256=uifgQdkn3lmAmztdEZK4LdaTNzEevx_jl0n3jQWIgWc,14404
|
|
9
9
|
mkdocs_include_markdown_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
mkdocs_include_markdown_plugin-6.0.
|
|
11
|
-
mkdocs_include_markdown_plugin-6.0.
|
|
12
|
-
mkdocs_include_markdown_plugin-6.0.
|
|
13
|
-
mkdocs_include_markdown_plugin-6.0.
|
|
14
|
-
mkdocs_include_markdown_plugin-6.0.
|
|
10
|
+
mkdocs_include_markdown_plugin-6.0.5.dist-info/METADATA,sha256=VcFeSqQDP1AK5kJ_6ghpRrwlY15JmjSpglEyaoQDJ5E,11158
|
|
11
|
+
mkdocs_include_markdown_plugin-6.0.5.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
|
|
12
|
+
mkdocs_include_markdown_plugin-6.0.5.dist-info/entry_points.txt,sha256=WEL5m7sw5ZMBwmdOs5S_9mGoZfLCaUDPkDKw7CUk16Q,96
|
|
13
|
+
mkdocs_include_markdown_plugin-6.0.5.dist-info/licenses/LICENSE,sha256=OunyKlPxiuvLB3ENbo2nyV-OPndkwzyZ5Gzwei0ofbc,11365
|
|
14
|
+
mkdocs_include_markdown_plugin-6.0.5.dist-info/RECORD,,
|
|
@@ -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-
|
|
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.
|
|
File without changes
|