diff --git a/README.md b/README.md
index 67b6624..bd21d5b 100644
--- a/README.md
+++ b/README.md
@@ -155,6 +155,9 @@ content to include.
- #
**trailing-newlines** (_true_): When this option is disabled, the trailing newlines
found in the content to include are stripped. Possible values are `true` and `false`.
+- #
+ **recursive** (_true_): When this option is disabled, included files are not
+ processed for recursive includes. Possible values are `true` and `false`.
- #
**encoding** (_utf-8_): Specify the encoding of the included file.
If not defined `utf-8` will be used.
@@ -243,12 +246,12 @@ Includes the content of a file or a group of files.
- #
**trailing-newlines** (_true_): When this option is disabled, the trailing newlines
found in the content to include are stripped. Possible values are `true` and `false`.
+- #
+ **recursive** (_true_): When this option is disabled, included files are not
+ processed for recursive includes. Possible values are `true` and `false`.
- #
**encoding** (_utf-8_): Specify the encoding of the included file.
If not defined `utf-8` will be used.
-- #
- **recursive** (_true_): When this option is disabled, included files are not
- processed for recursive includes. Possible values are `true` and `false`.
##### Examples
@@ -275,8 +278,9 @@ Includes the content of a file or a group of files.
## Acknowledgment
-- Joe Rickerby and contributors for
- [giving me the permissions][cibuildwheel-470] to separate this plugin from the
+- [Joe Rickerby] and [contributors] for
+ [giving me the permissions][cibuildwheel-470] to
+ [separate this plugin][cibuildwheel-475] from the
documentation of [cibuildwheel][cibuildwheel-repo-link].
[Bash wildcard globs]: https://facelessuser.github.io/wcmatch/glob/#syntax
@@ -293,7 +297,10 @@ Includes the content of a file or a group of files.
[license-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/LICENSE
[platformdirs]: https://pypi.org/project/platformdirs/
[cibuildwheel-470]: https://github.com/pypa/cibuildwheel/issues/470
+[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475
[cibuildwheel-repo-link]: https://github.com/pypa/cibuildwheel
[es-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/es/README.md
[fr-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/fr/README.md
[`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
+[Joe Rickerby]: https://github.com/joerick
+[contributors]: https://github.com/mondeja/mkdocs-include-markdown-plugin/graphs/contributors
diff --git a/locale/es/README.md b/locale/es/README.md
index b5c7856..8433f1c 100644
--- a/locale/es/README.md
+++ b/locale/es/README.md
@@ -144,6 +144,10 @@ href="#include-markdown_trailing-newlines"># **trailing-newlines**
(*true*): Cuando esta opción está deshabilitada, los saltos de línea finales que
se encuentran en el contenido a incluir se eliminan. Los valores posibles son
`true` y `false`.
+- #
+**recursive** (*true*): Cuando esta opción está deshabilitada, los archivos
+incluidos no son procesados para incluir de forma recursiva. Los valores
+posibles son `true` y `false`.
- #
**encoding** (*utf-8*): Especifica la codificación del archivo incluído. Si no
se define, se usará `utf-8`.
@@ -234,13 +238,13 @@ globs para incluir múltiples archivos.
**trailing-newlines** (*true*): Cuando esta opción está deshabilitada, los
saltos de línea finales que se encuentran en el contenido a incluir se eliminan.
Los valores posibles son `true` y `false`.
+- # **recursive**
+(*true*): Cuando esta opción está deshabilitada, los archivos incluidos no son
+procesados para incluir de forma recursiva. Los valores posibles son `true` y
+`false`.
- # **encoding**
(*utf-8*): Especifica la codificación del archivo incluído. Si no se define,
se usará `utf-8`.
-- # **recursive** (*true*):
-Cuando esta opción está deshabilitada, los archivos incluidos no son
-procesados para incluir de forma recursiva. Los valores posibles son `true` y
-`false`.
##### Ejemplos
@@ -267,8 +271,8 @@ procesados para incluir de forma recursiva. Los valores posibles son `true` y
## Agradecimiento
-- Joe Rickerby y contribuidores por [darme los permisos][cibuildwheel-470] para
-separar este plugin de la documentación de
+- [Joe Rickerby] y [contribuidores] por [darme los permisos][cibuildwheel-470]
+para [separar este plugin][cibuildwheel-475] de la documentación de
[cibuildwheel][cibuildwheel-repo-link].
[Patrones glob de Bash]: https://facelessuser.github.io/wcmatch/glob/#syntax
@@ -282,7 +286,10 @@ separar este plugin de la documentación de
[license-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/LICENSE
[platformdirs]: https://pypi.org/project/platformdirs/
[cibuildwheel-470]: https://github.com/pypa/cibuildwheel/issues/470
+[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475
[cibuildwheel-repo-link]: https://github.com/pypa/cibuildwheel
[es-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/es/README.md
[fr-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/fr/README.md
[`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
+[Joe Rickerby]: https://github.com/joerick
+[contribuidores]: https://github.com/mondeja/mkdocs-include-markdown-plugin/graphs/contributors
diff --git a/locale/es/README.md.po b/locale/es/README.md.po
index fa593f6..c10cf1e 100644
--- a/locale/es/README.md.po
+++ b/locale/es/README.md.po
@@ -31,13 +31,13 @@ msgid "Acknowledgment"
msgstr "Agradecimiento"
msgid ""
-"Joe Rickerby and contributors for [giving me the "
-"permissions][cibuildwheel-470] to separate this plugin from the "
-"documentation of [cibuildwheel][cibuildwheel-repo-link]."
+"[Joe Rickerby] and [contributors] for [giving me the "
+"permissions][cibuildwheel-470] to [separate this plugin][cibuildwheel-475] "
+"from the documentation of [cibuildwheel][cibuildwheel-repo-link]."
msgstr ""
-"Joe Rickerby y contribuidores por [darme los permisos][cibuildwheel-470] "
-"para separar este plugin de la documentación de [cibuildwheel][cibuildwheel-"
-"repo-link]."
+"[Joe Rickerby] y [contribuidores] por [darme los permisos][cibuildwheel-470]"
+" para [separar este plugin][cibuildwheel-475] de la documentación de "
+"[cibuildwheel][cibuildwheel-repo-link]."
msgid ""
"[pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-include-"
@@ -408,11 +408,35 @@ msgid "[pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin"
msgstr "[pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin"
msgid ""
-"# **recursive** "
-"(*true*): When this option is disabled, included files are not processed for"
-" recursive includes. Possible values are `true` and `false`."
+"# "
+"**recursive** (*true*): When this option is disabled, included files are not"
+" processed for recursive includes. Possible values are `true` and `false`."
msgstr ""
-"# **recursive** "
-"(*true*): Cuando esta opción está deshabilitada, los archivos incluidos no "
-"son procesados para incluir de forma recursiva. Los valores posibles son "
-"`true` y `false`."
+"# "
+"**recursive** (*true*): Cuando esta opción está deshabilitada, los archivos "
+"incluidos no son procesados para incluir de forma recursiva. Los valores "
+"posibles son `true` y `false`."
+
+msgid ""
+"# **recursive** (*true*): When this option is "
+"disabled, included files are not processed for recursive includes. Possible "
+"values are `true` and `false`."
+msgstr ""
+"# **recursive** (*true*): Cuando esta opción está "
+"deshabilitada, los archivos incluidos no son procesados para incluir de "
+"forma recursiva. Los valores posibles son `true` y `false`."
+
+msgid "[Joe Rickerby]: https://github.com/joerick"
+msgstr "[Joe Rickerby]: https://github.com/joerick"
+
+msgid ""
+"[contributors]: https://github.com/mondeja/mkdocs-include-markdown-"
+"plugin/graphs/contributors"
+msgstr ""
+"[contribuidores]: https://github.com/mondeja/mkdocs-include-markdown-"
+"plugin/graphs/contributors"
+
+msgid "[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475"
+msgstr "[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475"
diff --git a/locale/fr/README.md b/locale/fr/README.md
index 0e6dee0..44de45e 100644
--- a/locale/fr/README.md
+++ b/locale/fr/README.md
@@ -144,6 +144,10 @@ href="#include-markdown_trailing-newlines"># **trailing-newlines**
(*true*): Lorsque cette option est désactivée, les nouvelles lignes de fin
trouvées dans le contenu à inclure sont supprimées. Les valeurs possibles sont
`true` et `false`.
+- #
+**recursive** (*true*): Lorsque cette option est désactivée, les fichiers
+inclus ne sont pas traités pour des inclusions récursives. Les valeurs possibles
+sont `true` et `false`.
- #
**encoding** (*utf-8*): Spécifiez l'encodage du fichier inclus. S'il n'est pas
défini, `utf-8` sera utilisé.
@@ -233,12 +237,13 @@ passage de globs pour inclure plusieurs fichiers.
**trailing-newlines** (*true*): Lorsque cette option est désactivée, les
nouvelles lignes de fin trouvées dans le contenu à inclure sont supprimées. Les
valeurs possibles sont `true` et `false`.
+- # **recursive**
+(*true*): Lorsque cette option est désactivée, les fichiers inclus ne sont pas
+traités pour des inclusions récursives. Les valeurs possibles sont `true` et
+`false`.
- # **encoding**
(*utf-8*): Spécifiez l'encodage du fichier inclus. S'il n'est pas défini,
`utf-8` sera utilisé.
-- # **recursive** (*true*):
-Lorsque cette option est désactivée, les fichiers inclus ne sont pas traités
-pour des inclusions récursives. Les valeurs possibles sont `true` et `false`.
##### Exemples
@@ -265,9 +270,9 @@ pour des inclusions récursives. Les valeurs possibles sont `true` et `false`.
## Reconnaissance
-- Joe Rickerby et des contributeurs pour [m'avoir donné les
-autorisations][cibuildwheel-470] pour séparer ce plugin de la documentation de
-[cibuildwheel][cibuildwheel-repo-link].
+- [Joe Rickerby] et [des contributeurs] pour [m'avoir donné les
+autorisations][cibuildwheel-470] pour [séparer ce plugin][cibuildwheel-475] de
+la documentation de [cibuildwheel][cibuildwheel-repo-link].
[Globs génériques Bash]: https://facelessuser.github.io/wcmatch/glob/#syntax
[pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin
@@ -280,7 +285,10 @@ autorisations][cibuildwheel-470] pour séparer ce plugin de la documentation de
[license-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/LICENSE
[platformdirs]: https://pypi.org/project/platformdirs/
[cibuildwheel-470]: https://github.com/pypa/cibuildwheel/issues/470
+[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475
[cibuildwheel-repo-link]: https://github.com/pypa/cibuildwheel
[es-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/es/README.md
[fr-readme-link]: https://github.com/mondeja/mkdocs-include-markdown-plugin/blob/master/locale/fr/README.md
[`docs_dir`]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
+[Joe Rickerby]: https://github.com/joerick
+[des contributeurs]: https://github.com/mondeja/mkdocs-include-markdown-plugin/graphs/contributors
diff --git a/locale/fr/README.md.po b/locale/fr/README.md.po
index dd59dfa..e912288 100644
--- a/locale/fr/README.md.po
+++ b/locale/fr/README.md.po
@@ -44,13 +44,13 @@ msgid "Acknowledgment"
msgstr "Reconnaissance"
msgid ""
-"Joe Rickerby and contributors for [giving me the "
-"permissions][cibuildwheel-470] to separate this plugin from the "
-"documentation of [cibuildwheel][cibuildwheel-repo-link]."
+"[Joe Rickerby] and [contributors] for [giving me the "
+"permissions][cibuildwheel-470] to [separate this plugin][cibuildwheel-475] "
+"from the documentation of [cibuildwheel][cibuildwheel-repo-link]."
msgstr ""
-"Joe Rickerby et des contributeurs pour [m'avoir donné les "
-"autorisations][cibuildwheel-470] pour séparer ce plugin de la documentation "
-"de [cibuildwheel][cibuildwheel-repo-link]."
+"[Joe Rickerby] et [des contributeurs] pour [m'avoir donné les "
+"autorisations][cibuildwheel-470] pour [séparer ce plugin][cibuildwheel-475] "
+"de la documentation de [cibuildwheel][cibuildwheel-repo-link]."
msgid ""
"[pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-include-"
@@ -406,11 +406,35 @@ msgid "[pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin"
msgstr "[pypi-link]: https://pypi.org/project/mkdocs-include-markdown-plugin"
msgid ""
-"# **recursive** "
-"(*true*): When this option is disabled, included files are not processed for"
-" recursive includes. Possible values are `true` and `false`."
+"# "
+"**recursive** (*true*): When this option is disabled, included files are not"
+" processed for recursive includes. Possible values are `true` and `false`."
msgstr ""
-"# **recursive** "
-"(*true*): Lorsque cette option est désactivée, les fichiers inclus ne sont "
-"pas traités pour des inclusions récursives. Les valeurs possibles sont "
-"`true` et `false`."
+"# "
+"**recursive** (*true*): Lorsque cette option est désactivée, les fichiers "
+"inclus ne sont pas traités pour des inclusions récursives. Les valeurs "
+"possibles sont `true` et `false`."
+
+msgid ""
+"# **recursive** (*true*): When this option is "
+"disabled, included files are not processed for recursive includes. Possible "
+"values are `true` and `false`."
+msgstr ""
+"# **recursive** (*true*): Lorsque cette option est "
+"désactivée, les fichiers inclus ne sont pas traités pour des inclusions "
+"récursives. Les valeurs possibles sont `true` et `false`."
+
+msgid "[Joe Rickerby]: https://github.com/joerick"
+msgstr "[Joe Rickerby]: https://github.com/joerick"
+
+msgid ""
+"[contributors]: https://github.com/mondeja/mkdocs-include-markdown-"
+"plugin/graphs/contributors"
+msgstr ""
+"[des contributeurs]: https://github.com/mondeja/mkdocs-include-markdown-"
+"plugin/graphs/contributors"
+
+msgid "[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475"
+msgstr "[cibuildwheel-475]: https://github.com/pypa/cibuildwheel/pull/475"
diff --git a/pyproject.toml b/pyproject.toml
index 269b4e1..6c21393 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "mkdocs-include-markdown-plugin"
-version = "6.1.2"
+version = "6.2.0"
description = "Mkdocs Markdown includer plugin."
readme = "README.md"
license = "Apache-2.0"
diff --git a/src/mkdocs_include_markdown_plugin/directive.py b/src/mkdocs_include_markdown_plugin/directive.py
index 22ea614..71de648 100644
--- a/src/mkdocs_include_markdown_plugin/directive.py
+++ b/src/mkdocs_include_markdown_plugin/directive.py
@@ -110,9 +110,7 @@ def str_arg(arg: str) -> re.Pattern[str]:
)
}
-INCLUDE_MARKDOWN_DIRECTIVE_ARGS = {
- key for key in ARGUMENT_REGEXES if key != 'recursive'
-}
+INCLUDE_MARKDOWN_DIRECTIVE_ARGS = set(ARGUMENT_REGEXES)
def warn_invalid_directive_arguments(
diff --git a/src/mkdocs_include_markdown_plugin/event.py b/src/mkdocs_include_markdown_plugin/event.py
index 760c692..e7c55a4 100644
--- a/src/mkdocs_include_markdown_plugin/event.py
+++ b/src/mkdocs_include_markdown_plugin/event.py
@@ -379,7 +379,7 @@ def found_include_markdown_tag( # noqa: PLR0912, PLR0915
[
'rewrite-relative-urls', 'comments',
'preserve-includer-indent', 'dedent',
- 'trailing-newlines',
+ 'trailing-newlines', 'recursive',
],
defaults,
arguments_string,
@@ -498,16 +498,17 @@ def found_include_markdown_tag( # noqa: PLR0912, PLR0915
expected_but_any_found[i] = False
# nested includes
- new_text_to_include = get_file_content(
- new_text_to_include,
- file_path,
- docs_dir,
- tags,
- defaults,
- settings,
- files_watcher=files_watcher,
- http_cache=http_cache,
- )
+ if bool_options['recursive'].value:
+ new_text_to_include = get_file_content(
+ new_text_to_include,
+ file_path,
+ docs_dir,
+ tags,
+ defaults,
+ settings,
+ files_watcher=files_watcher,
+ http_cache=http_cache,
+ )
# trailing newlines right stripping
if not bool_options['trailing-newlines'].value:
diff --git a/tests/test_unit/test_nested_includes.py b/tests/test_unit/test_nested_includes.py
index 9780989..d157b01 100644
--- a/tests/test_unit/test_nested_includes.py
+++ b/tests/test_unit/test_nested_includes.py
@@ -251,6 +251,32 @@
[],
id='include-recursive=false',
),
+ # recursive inclusion disabled with `include-markdown` directive
+ pytest.param(
+ '''# Header
+
+{%
+ include-markdown "{filepath}"
+ recursive=false
+ comments=false
+%}''',
+ '''# Header 2
+
+{% include-markdown "{filepath}" %}
+''',
+ '''# Header 3
+
+This content must not be included.
+''',
+ '''# Header
+
+# Header 2
+
+{% include-markdown "{filepath}" %}
+''',
+ [],
+ id='include-markdown-recursive=false',
+ ),
),
)
def test_nested_include(