mkdocs-include-markdown-plugin 7.2.2__py3-none-any.whl → 7.3.0__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.
@@ -35,3 +35,4 @@ class PluginConfig(Config): # noqa: D101
35
35
  'include-markdown': 'include-markdown',
36
36
  },
37
37
  )
38
+ include_from_url = MkType(bool, default=True)
@@ -55,6 +55,7 @@ if TYPE_CHECKING: # pragma: no cover
55
55
  @dataclass
56
56
  class Settings: # noqa: D101
57
57
  exclude: list[str] | None
58
+ include_from_url: bool = False
58
59
 
59
60
 
60
61
  def get_file_content( # noqa: PLR0913, PLR0915
@@ -169,14 +170,25 @@ def get_file_content( # noqa: PLR0913, PLR0915
169
170
  order,
170
171
  )
171
172
 
172
- if is_url and 'order' in used_arguments: # pragma: no cover
173
- location = process.file_lineno_message(
174
- page_src_path, docs_dir, directive_lineno(),
175
- )
176
- logger.warning(
177
- f"Ignoring 'order' argument of 'include' directive"
178
- f" at {location} because the included path is a URL",
179
- )
173
+ if is_url:
174
+ if 'order' in used_arguments: # pragma: no cover
175
+ location = process.file_lineno_message(
176
+ page_src_path, docs_dir, directive_lineno(),
177
+ )
178
+ logger.warning(
179
+ f"Ignoring 'order' argument of 'include' directive"
180
+ f" at {location} because the included path is a URL",
181
+ )
182
+
183
+ if not settings.include_from_url:
184
+ location = process.file_lineno_message(
185
+ page_src_path, docs_dir, directive_lineno(),
186
+ )
187
+ raise PluginError(
188
+ f'Including from URL at {location} is not allowed because'
189
+ ' include-markdown is configured with include_from_url set'
190
+ ' to false',
191
+ )
180
192
 
181
193
  if not file_paths_to_include:
182
194
  location = process.file_lineno_message(
@@ -414,14 +426,25 @@ def get_file_content( # noqa: PLR0913, PLR0915
414
426
  order,
415
427
  )
416
428
 
417
- if is_url and 'order' in used_arguments: # pragma: no cover
418
- location = process.file_lineno_message(
419
- page_src_path, docs_dir, directive_lineno(),
420
- )
421
- logger.warning(
422
- f"Ignoring 'order' argument of 'include-markdown' directive"
423
- f" at {location} because the included path is a URL",
424
- )
429
+ if is_url:
430
+ if 'order' in used_arguments: # pragma: no cover
431
+ location = process.file_lineno_message(
432
+ page_src_path, docs_dir, directive_lineno(),
433
+ )
434
+ logger.warning(
435
+ f"Ignoring 'order' argument of 'include-markdown' directive"
436
+ f" at {location} because the included path is a URL",
437
+ )
438
+
439
+ if not settings.include_from_url:
440
+ location = process.file_lineno_message(
441
+ page_src_path, docs_dir, directive_lineno(),
442
+ )
443
+ raise PluginError(
444
+ f'Including from URL at {location} is not allowed because'
445
+ ' include-markdown is configured with include_from_url set'
446
+ ' to false',
447
+ )
425
448
 
426
449
  if not file_paths_to_include:
427
450
  location = process.file_lineno_message(
@@ -713,6 +736,7 @@ def on_page_markdown(
713
736
  },
714
737
  Settings(
715
738
  exclude=config.exclude,
739
+ include_from_url=config.include_from_url,
716
740
  ),
717
741
  files_watcher=plugin._files_watcher,
718
742
  http_cache=plugin._cache or http_cache,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-include-markdown-plugin
3
- Version: 7.2.2
3
+ Version: 7.3.0
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,6 +96,7 @@ plugins:
96
96
  start: <!--start-->
97
97
  end: <!--end-->
98
98
  recursive: true
99
+ order: alpha-path
99
100
  ```
100
101
 
101
102
  #### `opening_tag` and `closing_tag`
@@ -176,6 +177,18 @@ plugins:
176
177
  include: replace
177
178
  ```
178
179
 
180
+ <!-- mdpo-disable-next-line -->
181
+
182
+ #### `include_from_url`
183
+
184
+ Allow including content from URLs.
185
+
186
+ ```yaml
187
+ plugins:
188
+ - include-markdown:
189
+ include_from_url: true
190
+ ```
191
+
179
192
  ### Reference
180
193
 
181
194
  This plugin provides two directives, one to include Markdown files and another
@@ -1,16 +1,16 @@
1
1
  mkdocs_include_markdown_plugin/__init__.py,sha256=ByOde15RQSHlZTmkepPSzIt0GzUIv_-GKORFDnxnOmc,193
2
2
  mkdocs_include_markdown_plugin/cache.py,sha256=iKZXwehr2Mus0NRcsKFRC6xMC4B5aG4pP-Yb1ooCQo4,3836
3
- mkdocs_include_markdown_plugin/config.py,sha256=AuJWYB_sAbRYpecXy6HHugQR09kKjlibcYX6kkWmBVc,1137
3
+ mkdocs_include_markdown_plugin/config.py,sha256=rY4tZqDGLfL_Y5jNdKd5aEWFAKYY5ct75A4axXgIb-U,1187
4
4
  mkdocs_include_markdown_plugin/directive.py,sha256=K8L2ozzeCzSJ1N3owPAdETWEIM80kJCU2pygpYjg1F4,14752
5
- mkdocs_include_markdown_plugin/event.py,sha256=uzns7ARTwL8vH1VTqp6eSdZb8S9IQrxFIGUDk5VAH3o,26427
5
+ mkdocs_include_markdown_plugin/event.py,sha256=ZHy-2acYaj-00WCHaR4WW8RkqiJRG2RbdJz8mT413cg,27458
6
6
  mkdocs_include_markdown_plugin/files_watcher.py,sha256=hu-63u8syl00mXP59vP_iqD7T1R9iU9JjiZOHDV5fas,298
7
7
  mkdocs_include_markdown_plugin/logger.py,sha256=nl63G4IJSt5mEYHbObuh7BmmowSv-aa1l_v9I257570,230
8
8
  mkdocs_include_markdown_plugin/placeholders.py,sha256=LBxFagmDDJ8le4AYrLJbt7WqYBu-kpJP6QqGWH7tDrs,1132
9
9
  mkdocs_include_markdown_plugin/plugin.py,sha256=t7eIgB3Z6XmcPOzlTqE15ajhY3oYPNKOZLb6D1_hx7I,4334
10
10
  mkdocs_include_markdown_plugin/process.py,sha256=TKT1V0VHGqLGeFDrsNoKroXmqkjqwPM22IRDwvsemtE,22776
11
11
  mkdocs_include_markdown_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- mkdocs_include_markdown_plugin-7.2.2.dist-info/METADATA,sha256=d8TeVaRuDIEtFBCqZH_0130M1twMcULakZJRFKhCpoU,12697
13
- mkdocs_include_markdown_plugin-7.2.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
14
- mkdocs_include_markdown_plugin-7.2.2.dist-info/entry_points.txt,sha256=WEL5m7sw5ZMBwmdOs5S_9mGoZfLCaUDPkDKw7CUk16Q,96
15
- mkdocs_include_markdown_plugin-7.2.2.dist-info/licenses/LICENSE,sha256=Fyr5Goos1Rh671K_-S1AC7jTp1ng4xQdFjv-qbmCWLc,11365
16
- mkdocs_include_markdown_plugin-7.2.2.dist-info/RECORD,,
12
+ mkdocs_include_markdown_plugin-7.3.0.dist-info/METADATA,sha256=IyyxjZ2hzzW366rIknx70GnykwJ1zU4R2SGYkSDuFkY,12888
13
+ mkdocs_include_markdown_plugin-7.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
14
+ mkdocs_include_markdown_plugin-7.3.0.dist-info/entry_points.txt,sha256=WEL5m7sw5ZMBwmdOs5S_9mGoZfLCaUDPkDKw7CUk16Q,96
15
+ mkdocs_include_markdown_plugin-7.3.0.dist-info/licenses/LICENSE,sha256=Fyr5Goos1Rh671K_-S1AC7jTp1ng4xQdFjv-qbmCWLc,11365
16
+ mkdocs_include_markdown_plugin-7.3.0.dist-info/RECORD,,