mkdocs-include-markdown-plugin 7.2.0__py3-none-any.whl → 7.2.1__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.
@@ -140,7 +140,7 @@ def _maybe_arguments_iter(arguments_string: str) -> Iterable[str]:
140
140
  inside_string = False
141
141
  escaping = False
142
142
  opening_argument = False # whether we are at the beginning of an argument
143
- current_value = ''
143
+ current_value: list[str] = []
144
144
 
145
145
  for c in arguments_string:
146
146
  if inside_string:
@@ -153,24 +153,25 @@ def _maybe_arguments_iter(arguments_string: str) -> Iterable[str]:
153
153
  else:
154
154
  escaping = False
155
155
  elif c == '=':
156
+ current_value_str = ''.join(current_value)
156
157
  new_current_value = ''
157
- for ch in reversed(current_value):
158
+ for ch in reversed(current_value_str):
158
159
  if ch in string.whitespace:
159
- current_value = new_current_value[::-1]
160
+ current_value_str = new_current_value[::-1]
160
161
  break
161
162
  new_current_value += ch
162
- yield current_value
163
- current_value = ''
163
+ yield current_value_str
164
+ current_value = []
164
165
  opening_argument = True
165
166
  elif opening_argument:
166
167
  opening_argument = False
167
168
  if c in ('"', "'"):
168
169
  current_string_opening = c
169
170
  inside_string = True
170
- current_value += c
171
- current_value += c
171
+ current_value.append(c)
172
+ current_value.append(c)
172
173
  else:
173
- current_value += c
174
+ current_value.append(c)
174
175
 
175
176
 
176
177
  def warn_invalid_directive_arguments(
@@ -545,7 +545,7 @@ def get_file_content( # noqa: PLR0913, PLR0915
545
545
  # but they have been specified, so the warning(s) must be raised
546
546
  expected_but_any_found = [start is not None, end is not None]
547
547
 
548
- text_to_include = ''
548
+ text_to_include_parts = []
549
549
  for file_path in file_paths_to_include:
550
550
  if process.is_url(filename):
551
551
  new_text_to_include = process.read_url(
@@ -621,11 +621,10 @@ def get_file_content( # noqa: PLR0913, PLR0915
621
621
  new_text_to_include
622
622
  ):
623
623
  lines = new_text_to_include.splitlines(keepends=True)
624
- new_text_to_include = lines[0]
624
+ indented_lines = [lines[0]]
625
625
  for i in range(1, len(lines)):
626
- new_text_to_include += (
627
- filled_includer_indent + lines[i]
628
- )
626
+ indented_lines.append(filled_includer_indent + lines[i])
627
+ new_text_to_include = ''.join(indented_lines)
629
628
 
630
629
  if offset:
631
630
  new_text_to_include = process.increase_headings_offset(
@@ -633,7 +632,9 @@ def get_file_content( # noqa: PLR0913, PLR0915
633
632
  offset=offset + cumulative_heading_offset,
634
633
  )
635
634
 
636
- text_to_include += new_text_to_include
635
+ text_to_include_parts.append(new_text_to_include)
636
+
637
+ text_to_include = ''.join(text_to_include_parts)
637
638
 
638
639
  # warn if expected start or ends haven't been found in included content
639
640
  for i, delimiter_name in enumerate(['start', 'end']):
@@ -174,10 +174,12 @@ def transform_p_by_p_skipping_codeblocks( # noqa: PLR0912, PLR0915
174
174
  _maybe_icodeblock_lines: list[str] = []
175
175
  _previous_line_was_empty = False
176
176
 
177
- lines, current_paragraph = ([], '')
177
+ lines = []
178
+ current_paragraph_lines: list[str] = []
178
179
 
179
180
  def process_current_paragraph() -> None:
180
- lines.extend(func(current_paragraph).splitlines(keepends=True))
181
+ lines.extend(func(''.join(current_paragraph_lines),
182
+ ).splitlines(keepends=True))
181
183
 
182
184
  # The next implementation takes into account that indented code
183
185
  # blocks must be surrounded by newlines as per the CommonMark
@@ -191,25 +193,24 @@ def transform_p_by_p_skipping_codeblocks( # noqa: PLR0912, PLR0915
191
193
  if lstripped_line.startswith(('```', '~~~')):
192
194
  _current_fcodeblock_delimiter = lstripped_line[:3]
193
195
  process_current_paragraph()
194
- current_paragraph = ''
196
+ current_paragraph_lines = []
195
197
  lines.append(line)
196
198
  elif line.startswith(' '):
197
199
  if not lstripped_line or _maybe_icodeblock_lines:
198
200
  # maybe enter indented codeblock
199
201
  _maybe_icodeblock_lines.append(line)
200
202
  else:
201
- current_paragraph += line
203
+ current_paragraph_lines.append(line)
202
204
  elif _maybe_icodeblock_lines:
203
205
  process_current_paragraph()
204
- current_paragraph = ''
206
+ current_paragraph_lines = []
205
207
  if not _previous_line_was_empty:
206
208
  # wasn't an indented code block
207
- for line_ in _maybe_icodeblock_lines:
208
- current_paragraph += line_
209
+ current_paragraph_lines.extend(_maybe_icodeblock_lines)
209
210
  _maybe_icodeblock_lines = []
210
- current_paragraph += line
211
+ current_paragraph_lines.append(line)
211
212
  process_current_paragraph()
212
- current_paragraph = ''
213
+ current_paragraph_lines = []
213
214
  else:
214
215
  # exit indented codeblock
215
216
  for line_ in _maybe_icodeblock_lines:
@@ -217,7 +218,7 @@ def transform_p_by_p_skipping_codeblocks( # noqa: PLR0912, PLR0915
217
218
  _maybe_icodeblock_lines = []
218
219
  lines.append(line)
219
220
  else:
220
- current_paragraph += line
221
+ current_paragraph_lines.append(line)
221
222
  _previous_line_was_empty = not lstripped_line
222
223
  else:
223
224
  lines.append(line)
@@ -230,14 +231,13 @@ def transform_p_by_p_skipping_codeblocks( # noqa: PLR0912, PLR0915
230
231
  if not _previous_line_was_empty:
231
232
  # at EOF
232
233
  process_current_paragraph()
233
- current_paragraph = ''
234
- for line_ in _maybe_icodeblock_lines:
235
- current_paragraph += line_
234
+ current_paragraph_lines = []
235
+ current_paragraph_lines.extend(_maybe_icodeblock_lines)
236
236
  process_current_paragraph()
237
- current_paragraph = ''
237
+ current_paragraph_lines = []
238
238
  else:
239
239
  process_current_paragraph()
240
- current_paragraph = ''
240
+ current_paragraph_lines = []
241
241
  for line_ in _maybe_icodeblock_lines:
242
242
  lines.append(line_)
243
243
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-include-markdown-plugin
3
- Version: 7.2.0
3
+ Version: 7.2.1
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
@@ -181,6 +181,8 @@ plugins:
181
181
  This plugin provides two directives, one to include Markdown files and another
182
182
  to include files of any type.
183
183
 
184
+ #### Common arguments
185
+
184
186
  Paths of included files can be either:
185
187
 
186
188
  - URLs to include remote content.
@@ -199,34 +201,27 @@ single `'` quotes, which can be escaped prepending them a `\` character as
199
201
  The arguments **start** and **end** may contain usual (Python-style) escape
200
202
  sequences like `\n` to match against newlines.
201
203
 
202
- <!-- mdpo-disable-next-line -->
203
-
204
- #### **`include-markdown`**
205
-
206
- Includes Markdown files content, optionally using two delimiters to filter the
207
- content to include.
208
-
209
- - <a name="include-markdown_start" href="#include-markdown_start">#</a>
204
+ - <a name="include_start" href="#include_start">#</a>
210
205
  **start**: Delimiter that marks the beginning of the content to include.
211
- - <a name="include-markdown_end" href="#include-markdown_end">#</a>
206
+ - <a name="include_end" href="#include_end">#</a>
212
207
  **end**: Delimiter that marks the end of the content to include.
213
- - <a name="include-markdown_preserve-includer-indent" href="#include-markdown_preserve-includer-indent">#</a>
208
+ - <a name="include_preserve-includer-indent" href="#include_preserve-includer-indent">#</a>
214
209
  **preserve-includer-indent** (_true_): When this option is enabled (default),
215
210
  every line of the content to include is indented with the same number of
216
211
  spaces used to indent the includer `{% %}` template. Possible values are
217
212
  `true` and `false`.
218
- - <a name="include-markdown_dedent" href="#include-markdown_dedent">#</a>
213
+ - <a name="include_dedent" href="#include_dedent">#</a>
219
214
  **dedent** (_false_): If enabled, the included content will be dedented.
220
- - <a name="include-markdown_exclude" href="#include-markdown_exclude">#</a>
215
+ - <a name="include_exclude" href="#include_exclude">#</a>
221
216
  **exclude**: Specify with a glob which files should be ignored. Only useful
222
217
  when passing globs to include multiple files.
223
- - <a name="include-markdown_trailing-newlines" href="#include-markdown_trailing-newlines">#</a>
218
+ - <a name="include_trailing-newlines" href="#include_trailing-newlines">#</a>
224
219
  **trailing-newlines** (_true_): When this option is disabled, the trailing newlines
225
220
  found in the content to include are stripped. Possible values are `true` and `false`.
226
- - <a name="include-markdown_recursive" href="#include-markdown_recursive">#</a>
221
+ - <a name="include_recursive" href="#include_recursive">#</a>
227
222
  **recursive** (_true_): When this option is disabled, included files are not
228
223
  processed for recursive includes. Possible values are `true` and `false`.
229
- - <a name="include-markdown_order" href="#include-markdown_order">#</a>
224
+ - <a name="include_order" href="#include_order">#</a>
230
225
  **order** (_'alpha-path'_): Define the order in which multiple files are included
231
226
  when using globs. Possible values are:
232
227
  - A combination of an optional order type and an optional order by separated
@@ -241,20 +236,28 @@ content to include.
241
236
  - `'path'` (default): Order by full file path.
242
237
  - `'name'`: Order by file name only.
243
238
  - `'extension'`: Order by file extension.
244
- - A combination of an optional prefix hyphen to denote ascending order and
245
- one of the following values in the form `[-]<value>` where `<value>` is one of:
239
+ - A combination of an optional prefix hyphen to denote ascending order and one
240
+ of the following values in the form `[-]<value>` where `<value>` is one of:
246
241
  - `'size'`: Order by file size.
247
242
  - `'mtime'`: Order by file modification time.
248
243
  - `'ctime'`: Order by file creation time (or the last metadata change time
249
244
  on Unix systems).
250
245
  - `'atime'`: Order by file last access time.
246
+ - `'system'`: Order provided by the operating system. This is the same as not
247
+ specifying any order and relying on the default order of the filesystem.
248
+ This may be different between operating systems, so use it with care.
251
249
  - `'random'`: Random order.
252
- - `'system'`: Order provided by the operating system. This is the same as not
253
- specifying any order and relying on the default order of the filesystem. This
254
- may be different between operating systems, so use it with care.
255
- - <a name="include-markdown_encoding" href="#include-markdown_encoding">#</a>
250
+ - <a name="include_encoding" href="#include_encoding">#</a>
256
251
  **encoding** (_'utf-8'_): Specify the encoding of the included file.
257
252
  If not defined `'utf-8'` will be used.
253
+
254
+ <!-- mdpo-disable-next-line -->
255
+
256
+ #### **`include-markdown`**
257
+
258
+ Includes Markdown files content, optionally using two delimiters to filter the
259
+ content to include.
260
+
258
261
  - <a name="include-markdown_rewrite-relative-urls" href="#include-markdown_rewrite-relative-urls">#</a>
259
262
  **rewrite-relative-urls** (_true_): When this option is enabled (default),
260
263
  Markdown links and images in the content that are specified by a relative URL
@@ -331,56 +334,6 @@ content to include.
331
334
 
332
335
  Includes the content of a file or a group of files.
333
336
 
334
- - <a name="include_start" href="#include_start">#</a>
335
- **start**: Delimiter that marks the beginning of the content to include.
336
- - <a name="include_end" href="#include_end">#</a>
337
- **end**: Delimiter that marks the end of the content to include.
338
- - <a name="include_preserve-includer-indent" href="#include_preserve-includer-indent">#</a>
339
- **preserve-includer-indent** (_true_): When this option is enabled (default),
340
- every line of the content to include is indented with the same number of
341
- spaces used to indent the includer `{% %}` template. Possible values are
342
- `true` and `false`.
343
- - <a name="include_dedent" href="#include_dedent">#</a>
344
- **dedent** (_false_): If enabled, the included content will be dedented.
345
- - <a name="include_exclude" href="#include_exclude">#</a>
346
- **exclude**: Specify with a glob which files should be ignored. Only useful
347
- when passing globs to include multiple files.
348
- - <a name="include_trailing-newlines" href="#include_trailing-newlines">#</a>
349
- **trailing-newlines** (_true_): When this option is disabled, the trailing newlines
350
- found in the content to include are stripped. Possible values are `true` and `false`.
351
- - <a name="include_recursive" href="#include_recursive">#</a>
352
- **recursive** (_true_): When this option is disabled, included files are not
353
- processed for recursive includes. Possible values are `true` and `false`.
354
- - <a name="include_order" href="#include_order">#</a>
355
- **order** (_'alpha-path'_): Define the order in which multiple files are included
356
- when using globs. Possible values are:
357
- - A combination of an optional order type and an optional order by separated
358
- by a hyphen (`-`), and optionally prefixed by a hyphen (`-`) to indicate
359
- ascending order. If an order type or an order by is not specified, the defaults
360
- are used. It follows the form:
361
- `[-]<order_type>-<order_by>` where:
362
- - **Order type**:
363
- - `'alpha'` (default): Alphabetical order.
364
- - `'natural'`: Natural order, so that e.g. `file2.md` comes before `file10.md`.
365
- - **Order by**:
366
- - `'path'` (default): Order by full file path.
367
- - `'name'`: Order by file name only.
368
- - `'extension'`: Order by file extension.
369
- - A combination of an optional prefix hyphen to denote ascending order and
370
- one of the following values in the form `[-]<value>` where `<value>` is one of:
371
- - `'size'`: Order by file size.
372
- - `'mtime'`: Order by file modification time.
373
- - `'ctime'`: Order by file creation time (or the last metadata change time
374
- on Unix systems).
375
- - `'atime'`: Order by file last access time.
376
- - `'random'`: Random order.
377
- - `'system'`: Order provided by the operating system. This is the same as not
378
- specifying any order and relying on the default order of the filesystem. This
379
- may be different between operating systems, so use it with care.
380
- - <a name="include_encoding" href="#include_encoding">#</a>
381
- **encoding** (_'utf-8'_): Specify the encoding of the included file.
382
- If not defined `'utf-8'` will be used.
383
-
384
337
  ##### Examples
385
338
 
386
339
  ```jinja
@@ -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
3
  mkdocs_include_markdown_plugin/config.py,sha256=AuJWYB_sAbRYpecXy6HHugQR09kKjlibcYX6kkWmBVc,1137
4
- mkdocs_include_markdown_plugin/directive.py,sha256=NiW8rtNJB2PzZE2fIPlqACc4oK8-XvQsV3D4uV5LJqs,14659
5
- mkdocs_include_markdown_plugin/event.py,sha256=BXPoc7q66QWrojI4ypMfRR9FT567vpNmaXDgiWtKW38,26341
4
+ mkdocs_include_markdown_plugin/directive.py,sha256=K8L2ozzeCzSJ1N3owPAdETWEIM80kJCU2pygpYjg1F4,14752
5
+ mkdocs_include_markdown_plugin/event.py,sha256=uzns7ARTwL8vH1VTqp6eSdZb8S9IQrxFIGUDk5VAH3o,26427
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
- mkdocs_include_markdown_plugin/process.py,sha256=J7P7x70nXD9GGs2bbBzdJmlm9LcujMTtdfKUsyBhK0k,22601
10
+ mkdocs_include_markdown_plugin/process.py,sha256=u7D1Lgk1kb9pR5hAo7-_9n4HE1DvC6jVzrGwaJie74k,22674
11
11
  mkdocs_include_markdown_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- mkdocs_include_markdown_plugin-7.2.0.dist-info/METADATA,sha256=axDz994hej34gNXyh8DsBNwB7n8zuyOy_oue70M3Gfk,15851
13
- mkdocs_include_markdown_plugin-7.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- mkdocs_include_markdown_plugin-7.2.0.dist-info/entry_points.txt,sha256=WEL5m7sw5ZMBwmdOs5S_9mGoZfLCaUDPkDKw7CUk16Q,96
15
- mkdocs_include_markdown_plugin-7.2.0.dist-info/licenses/LICENSE,sha256=qm1MNzU_lIANFB-1cBpD9hqdD_Htv3_Xr6hobt0IHq8,11365
16
- mkdocs_include_markdown_plugin-7.2.0.dist-info/RECORD,,
12
+ mkdocs_include_markdown_plugin-7.2.1.dist-info/METADATA,sha256=GiQX7WtSJYA0eNUAwGdDNhfQT2iOgx1QY5HTz9nEwJM,12697
13
+ mkdocs_include_markdown_plugin-7.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ mkdocs_include_markdown_plugin-7.2.1.dist-info/entry_points.txt,sha256=WEL5m7sw5ZMBwmdOs5S_9mGoZfLCaUDPkDKw7CUk16Q,96
15
+ mkdocs_include_markdown_plugin-7.2.1.dist-info/licenses/LICENSE,sha256=Fyr5Goos1Rh671K_-S1AC7jTp1ng4xQdFjv-qbmCWLc,11365
16
+ mkdocs_include_markdown_plugin-7.2.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -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-2025 Joe Rickerby and contributors
190
+ Copyright 2017-2026 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.