mkdocs2confluence 0.20.5__tar.gz → 0.21.0__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 (112) hide show
  1. {mkdocs2confluence-0.20.5/src/mkdocs2confluence.egg-info → mkdocs2confluence-0.21.0}/PKG-INFO +4 -1
  2. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/README.md +3 -0
  3. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/pyproject.toml +1 -1
  4. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0/src/mkdocs2confluence.egg-info}/PKG-INFO +4 -1
  5. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/SOURCES.txt +1 -0
  6. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/page.py +6 -1
  7. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/treeutil.py +24 -5
  8. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/config.py +24 -0
  9. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/assets.py +25 -3
  10. mkdocs2confluence-0.21.0/tests/test_exclude_attachments.py +123 -0
  11. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_treeutil.py +13 -0
  12. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/LICENSE +0 -0
  13. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/setup.cfg +0 -0
  14. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/dependency_links.txt +0 -0
  15. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/entry_points.txt +0 -0
  16. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/requires.txt +0 -0
  17. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/top_level.txt +0 -0
  18. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/__init__.py +0 -0
  19. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/cli.py +0 -0
  20. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/__init__.py +0 -0
  21. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/models.py +0 -0
  22. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/emitter/__init__.py +0 -0
  23. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/emitter/xhtml.py +0 -0
  24. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/__init__.py +0 -0
  25. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/nodes.py +0 -0
  26. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/__init__.py +0 -0
  27. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/extra_css.py +0 -0
  28. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/nav.py +0 -0
  29. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/page.py +0 -0
  30. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/parser/__init__.py +0 -0
  31. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/parser/markdown.py +0 -0
  32. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/__init__.py +0 -0
  33. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/generator.py +0 -0
  34. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/render.py +0 -0
  35. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/__init__.py +0 -0
  36. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/abbrevs.py +0 -0
  37. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/captions.py +0 -0
  38. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/fence.py +0 -0
  39. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/frontmatter.py +0 -0
  40. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/icons.py +0 -0
  41. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/includes.py +0 -0
  42. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/linkdefs.py +0 -0
  43. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/__init__.py +0 -0
  44. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/render.py +0 -0
  45. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/server.py +0 -0
  46. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/__init__.py +0 -0
  47. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/changelog.py +0 -0
  48. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/client.py +0 -0
  49. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/digest.py +0 -0
  50. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/executor.py +0 -0
  51. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/http_retry.py +0 -0
  52. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/models.py +0 -0
  53. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/planner.py +0 -0
  54. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skill_installer.py +0 -0
  55. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/SKILL.md +0 -0
  56. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/scripts/changelog_data.py +0 -0
  57. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/__init__.py +0 -0
  58. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/anchoring.py +0 -0
  59. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/command.py +0 -0
  60. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/comments.py +0 -0
  61. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/github.py +0 -0
  62. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/platform.py +0 -0
  63. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/state.py +0 -0
  64. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/__init__.py +0 -0
  65. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/_kroki.py +0 -0
  66. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/abbrevs.py +0 -0
  67. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/admonition_titles.py +0 -0
  68. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/attachment_previews.py +0 -0
  69. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/captions.py +0 -0
  70. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/editlink.py +0 -0
  71. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/footer.py +0 -0
  72. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/images.py +0 -0
  73. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/internallinks.py +0 -0
  74. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/mermaid.py +0 -0
  75. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/plantuml.py +0 -0
  76. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_abbrevs.py +0 -0
  77. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_admonition_titles.py +0 -0
  78. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_attachment_previews.py +0 -0
  79. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_captions.py +0 -0
  80. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_changelog_config.py +0 -0
  81. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_changelog_publish.py +0 -0
  82. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_children_macro.py +0 -0
  83. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_cli.py +0 -0
  84. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_editlink.py +0 -0
  85. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_emitter.py +0 -0
  86. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_exclude_properties_config.py +0 -0
  87. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_extra_css.py +0 -0
  88. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_footer.py +0 -0
  89. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_frontmatter.py +0 -0
  90. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_icons.py +0 -0
  91. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_images.py +0 -0
  92. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_internallinks.py +0 -0
  93. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_ir.py +0 -0
  94. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_linkdefs.py +0 -0
  95. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_loader.py +0 -0
  96. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_mermaid.py +0 -0
  97. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_page_loader.py +0 -0
  98. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_parser.py +0 -0
  99. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_pdf.py +0 -0
  100. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_plantuml.py +0 -0
  101. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_preprocess.py +0 -0
  102. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_preview.py +0 -0
  103. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_publish_client.py +0 -0
  104. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_publish_config.py +0 -0
  105. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_publish_pipeline.py +0 -0
  106. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_server.py +0 -0
  107. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_skill_installer.py +0 -0
  108. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_sync_anchoring.py +0 -0
  109. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_sync_command.py +0 -0
  110. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_sync_comments.py +0 -0
  111. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_sync_github.py +0 -0
  112. {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.21.0}/tests/test_sync_state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs2confluence
3
- Version: 0.20.5
3
+ Version: 0.21.0
4
4
  Summary: Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more
5
5
  Author: Anders Hybertz
6
6
  License: GPL-3.0-or-later
@@ -167,6 +167,7 @@ confluence:
167
167
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
168
168
  full_width: true # default: true
169
169
  attachment_preview: false # default: false — inline PDF/Office previews
170
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
170
171
  children_macro: true # default: true — child page list on section index pages
171
172
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
172
173
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -178,6 +179,8 @@ confluence:
178
179
 
179
180
  `attachment_preview` (bool, default `false`) renders links to local PDF/Office files (`.pdf`, `.doc(x)`, `.xls(x)`, `.ppt(x)`) as inline `view-file` previews instead of download links. Other file types always remain download links.
180
181
 
182
+ `exclude_attachments` (list of file extensions, default `[.yml, .yaml]`) names linked local file types that are never uploaded as attachments, because they are source files (CI pipelines, tool configs) rather than reader-facing content. A link to such a file is published as its plain link text, and a warning names the file. Matching ignores case and the leading dot is optional. Set it to `[]` to upload every linked file type. Attachments already uploaded by earlier runs are not removed.
183
+
181
184
  `children_macro` (bool, default `true`) controls the native Children Display macro appended to section index pages (a nav section with an `index.md`). Set it to `false` to publish those pages without the auto-generated child page list; the change takes effect on the next publish.
182
185
 
183
186
  The `confluence:` block is also accepted under `extra:` for MkDocs strict-mode compatibility. The API token is read from `token:` in `mkdocs.yml`, then `CONFLUENCE_API_TOKEN`, then `MK2CONF_TOKEN`.
@@ -124,6 +124,7 @@ confluence:
124
124
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
125
125
  full_width: true # default: true
126
126
  attachment_preview: false # default: false — inline PDF/Office previews
127
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
127
128
  children_macro: true # default: true — child page list on section index pages
128
129
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
129
130
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -135,6 +136,8 @@ confluence:
135
136
 
136
137
  `attachment_preview` (bool, default `false`) renders links to local PDF/Office files (`.pdf`, `.doc(x)`, `.xls(x)`, `.ppt(x)`) as inline `view-file` previews instead of download links. Other file types always remain download links.
137
138
 
139
+ `exclude_attachments` (list of file extensions, default `[.yml, .yaml]`) names linked local file types that are never uploaded as attachments, because they are source files (CI pipelines, tool configs) rather than reader-facing content. A link to such a file is published as its plain link text, and a warning names the file. Matching ignores case and the leading dot is optional. Set it to `[]` to upload every linked file type. Attachments already uploaded by earlier runs are not removed.
140
+
138
141
  `children_macro` (bool, default `true`) controls the native Children Display macro appended to section index pages (a nav section with an `index.md`). Set it to `false` to publish those pages without the auto-generated child page list; the change takes effect on the next publish.
139
142
 
140
143
  The `confluence:` block is also accepted under `extra:` for MkDocs strict-mode compatibility. The API token is read from `token:` in `mkdocs.yml`, then `CONFLUENCE_API_TOKEN`, then `MK2CONF_TOKEN`.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocs2confluence"
3
- version = "0.20.5"
3
+ version = "0.21.0"
4
4
  description = "Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more"
5
5
  readme = "README.md"
6
6
  license = { text = "GPL-3.0-or-later" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs2confluence
3
- Version: 0.20.5
3
+ Version: 0.21.0
4
4
  Summary: Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more
5
5
  Author: Anders Hybertz
6
6
  License: GPL-3.0-or-later
@@ -167,6 +167,7 @@ confluence:
167
167
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
168
168
  full_width: true # default: true
169
169
  attachment_preview: false # default: false — inline PDF/Office previews
170
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
170
171
  children_macro: true # default: true — child page list on section index pages
171
172
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
172
173
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -178,6 +179,8 @@ confluence:
178
179
 
179
180
  `attachment_preview` (bool, default `false`) renders links to local PDF/Office files (`.pdf`, `.doc(x)`, `.xls(x)`, `.ppt(x)`) as inline `view-file` previews instead of download links. Other file types always remain download links.
180
181
 
182
+ `exclude_attachments` (list of file extensions, default `[.yml, .yaml]`) names linked local file types that are never uploaded as attachments, because they are source files (CI pipelines, tool configs) rather than reader-facing content. A link to such a file is published as its plain link text, and a warning names the file. Matching ignores case and the leading dot is optional. Set it to `[]` to upload every linked file type. Attachments already uploaded by earlier runs are not removed.
183
+
181
184
  `children_macro` (bool, default `true`) controls the native Children Display macro appended to section index pages (a nav section with an `index.md`). Set it to `false` to publish those pages without the auto-generated child page list; the change takes effect on the next publish.
182
185
 
183
186
  The `confluence:` block is also accepted under `extra:` for MkDocs strict-mode compatibility. The API token is read from `token:` in `mkdocs.yml`, then `CONFLUENCE_API_TOKEN`, then `MK2CONF_TOKEN`.
@@ -79,6 +79,7 @@ tests/test_children_macro.py
79
79
  tests/test_cli.py
80
80
  tests/test_editlink.py
81
81
  tests/test_emitter.py
82
+ tests/test_exclude_attachments.py
82
83
  tests/test_exclude_properties_config.py
83
84
  tests/test_extra_css.py
84
85
  tests/test_footer.py
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  from mkdocs_to_confluence.compiler.models import CompileResult
6
6
  from mkdocs_to_confluence.emitter.xhtml import EmitOptions, emit
7
7
  from mkdocs_to_confluence.ir.nodes import ChildrenMacro, FrontMatter, SourceFooter
8
- from mkdocs_to_confluence.loader.config import MkDocsConfig
8
+ from mkdocs_to_confluence.loader.config import DEFAULT_EXCLUDE_ATTACHMENTS, MkDocsConfig
9
9
  from mkdocs_to_confluence.loader.nav import NavNode
10
10
  from mkdocs_to_confluence.loader.page import PageLoadError, load_page
11
11
  from mkdocs_to_confluence.parser.markdown import parse, parse_inline
@@ -89,6 +89,11 @@ def compile_page(
89
89
  ir_nodes,
90
90
  page_path=node.source_path,
91
91
  docs_dir=config.docs_dir,
92
+ exclude_extensions=(
93
+ config.confluence.exclude_attachments
94
+ if config.confluence
95
+ else DEFAULT_EXCLUDE_ATTACHMENTS
96
+ ),
92
97
  )
93
98
  ir_nodes = resolve_captions(ir_nodes)
94
99
  attachment_preview = (
@@ -13,31 +13,50 @@ modified.
13
13
  from __future__ import annotations
14
14
 
15
15
  import dataclasses
16
+ from collections.abc import Mapping
16
17
 
17
18
  from mkdocs_to_confluence.ir.nodes import IRNode
18
19
 
20
+ # A replacement is either a single node, or a tuple of nodes spliced into the
21
+ # parent's sequence in place of the original (e.g. a link unwrapped to its text).
22
+ Replacement = IRNode | tuple[IRNode, ...]
23
+
19
24
 
20
25
  def replace_nodes(
21
26
  nodes: tuple[IRNode, ...],
22
- replacements: dict[int, IRNode],
27
+ replacements: Mapping[int, Replacement],
23
28
  ) -> tuple[IRNode, ...]:
24
- """Recursively rebuild *nodes*, substituting entries from *replacements*."""
29
+ """Recursively rebuild *nodes*, substituting entries from *replacements*.
30
+
31
+ A tuple replacement is spliced into the sequence, and its own nodes are
32
+ rebuilt with the same *replacements*.
33
+ """
25
34
  result: list[IRNode] = []
26
35
  for node in nodes:
27
36
  if id(node) in replacements:
28
- result.append(replacements[id(node)])
37
+ replacement = replacements[id(node)]
38
+ if isinstance(replacement, tuple):
39
+ result.extend(replace_nodes(replacement, replacements))
40
+ else:
41
+ result.append(replacement)
29
42
  continue
30
43
  result.append(_rebuild(node, replacements))
31
44
  return tuple(result)
32
45
 
33
46
 
34
- def _rebuild(node: IRNode, replacements: dict[int, IRNode]) -> IRNode:
47
+ def _rebuild(node: IRNode, replacements: Mapping[int, Replacement]) -> IRNode:
35
48
  """Return *node* with any matching descendants replaced."""
36
49
  changes: dict[str, object] = {}
37
50
  for field in dataclasses.fields(node):
38
51
  value = getattr(node, field.name)
39
52
  if isinstance(value, IRNode):
40
- replaced = replacements.get(id(value), _rebuild(value, replacements))
53
+ # A single-node field cannot take a spliced tuple; rebuild instead.
54
+ candidate = replacements.get(id(value))
55
+ replaced = (
56
+ candidate
57
+ if isinstance(candidate, IRNode)
58
+ else _rebuild(value, replacements)
59
+ )
41
60
  if replaced is not value:
42
61
  changes[field.name] = replaced
43
62
  elif isinstance(value, tuple) and any(isinstance(item, IRNode) for item in value):
@@ -18,6 +18,11 @@ class ConfigError(ValueError):
18
18
  """Raised when mkdocs.yml is missing required fields or is malformed."""
19
19
 
20
20
 
21
+ # Linked local files with these extensions are never uploaded as attachments:
22
+ # they are source files (CI pipelines, tool configs), not reader-facing content.
23
+ DEFAULT_EXCLUDE_ATTACHMENTS: tuple[str, ...] = (".yml", ".yaml")
24
+
25
+
21
26
  @dataclass(frozen=True)
22
27
  class ConfluenceConfig:
23
28
  """Confluence Cloud connection settings, parsed from the ``confluence:`` block."""
@@ -37,6 +42,8 @@ class ConfluenceConfig:
37
42
  changelog_file: str | None = None # path relative to docs_dir; None means disabled
38
43
  exclude_properties: tuple[str, ...] = () # front matter keys to omit from Page Properties table
39
44
  attachment_preview: bool = False # render PDF/Office attachment links as view-file macros
45
+ # lowercase extensions (with dot) of linked files never uploaded as attachments
46
+ exclude_attachments: tuple[str, ...] = DEFAULT_EXCLUDE_ATTACHMENTS
40
47
  children_macro: bool = True # append Children Display macro to section index pages
41
48
  # Custom admonition kind → built-in kind it should render as, e.g.
42
49
  # {"value-driver": "tip"}. Kinds absent here fall back to the built-in
@@ -309,6 +316,22 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
309
316
  )
310
317
  attachment_preview = raw_preview
311
318
 
319
+ # exclude_attachments (optional) — extensions of linked local files that
320
+ # are never uploaded. Normalised to lowercase with a leading dot.
321
+ raw_excl_att = raw_conf.get("exclude_attachments", list(DEFAULT_EXCLUDE_ATTACHMENTS))
322
+ if raw_excl_att is None:
323
+ raw_excl_att = []
324
+ if not isinstance(raw_excl_att, list) or not all(
325
+ isinstance(ext, str) and ext.strip().lstrip(".") for ext in raw_excl_att
326
+ ):
327
+ raise ConfigError(
328
+ "mkdocs.yml: 'confluence.exclude_attachments' must be a list of "
329
+ "file extensions (e.g. ['.yml', '.yaml'])."
330
+ )
331
+ exclude_attachments = tuple(
332
+ "." + ext.strip().lstrip(".").lower() for ext in raw_excl_att
333
+ )
334
+
312
335
  # children_macro (optional) — child page list on section index pages
313
336
  raw_children = raw_conf.get("children_macro", True)
314
337
  if not isinstance(raw_children, bool):
@@ -358,6 +381,7 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
358
381
  changelog_file=changelog_file,
359
382
  exclude_properties=exclude_properties,
360
383
  attachment_preview=attachment_preview,
384
+ exclude_attachments=exclude_attachments,
361
385
  children_macro=children_macro,
362
386
  admonitions=admonitions,
363
387
  )
@@ -7,7 +7,9 @@ upload them to Confluence without name collisions.
7
7
 
8
8
  URLs (``http://``, ``https://``, ``//``, ``data:``) are left unchanged.
9
9
  Links to other ``.md`` pages are skipped (handled by the link-resolution
10
- transform).
10
+ transform). Links to local files whose extension is excluded (by default
11
+ ``.yml`` / ``.yaml`` source files) are never uploaded: the link is replaced
12
+ by its text and a transpiler warning is emitted.
11
13
  """
12
14
 
13
15
  from __future__ import annotations
@@ -23,7 +25,8 @@ from mkdocs_to_confluence.ir.nodes import (
23
25
  LinkNode,
24
26
  walk,
25
27
  )
26
- from mkdocs_to_confluence.ir.treeutil import replace_nodes
28
+ from mkdocs_to_confluence.ir.treeutil import Replacement, replace_nodes
29
+ from mkdocs_to_confluence.transforms._kroki import warn as _warn
27
30
 
28
31
 
29
32
  def is_url(value: str) -> bool:
@@ -51,6 +54,7 @@ def resolve_local_assets(
51
54
  *,
52
55
  page_path: Path,
53
56
  docs_dir: Path,
57
+ exclude_extensions: tuple[str, ...] = (),
54
58
  ) -> tuple[tuple[IRNode, ...], list[Path]]:
55
59
  """Resolve local image and file-link paths; collect attachment paths.
56
60
 
@@ -62,6 +66,9 @@ def resolve_local_assets(
62
66
  Absolute path to the source Markdown file.
63
67
  docs_dir:
64
68
  Absolute path to the MkDocs ``docs/`` directory.
69
+ exclude_extensions:
70
+ Lowercase extensions (with leading dot) of linked files that must not
71
+ be uploaded. Such links are replaced by their text, with a warning.
65
72
 
66
73
  Returns
67
74
  -------
@@ -72,7 +79,7 @@ def resolve_local_assets(
72
79
  """
73
80
  attachments: list[Path] = []
74
81
  seen: dict[Path, None] = {} # ordered deduplication
75
- replacements: dict[int, IRNode] = {}
82
+ replacements: dict[int, Replacement] = {}
76
83
  page_dir = page_path.parent
77
84
 
78
85
  for top_node in nodes:
@@ -114,6 +121,13 @@ def resolve_local_assets(
114
121
  stacklevel=2,
115
122
  )
116
123
  continue
124
+ if candidate.suffix.lower() in exclude_extensions:
125
+ _warn(
126
+ f"link to excluded file type not uploaded (using link text): "
127
+ f"{href!r} in {_display_path(page_path, docs_dir)}"
128
+ )
129
+ replacements[id(node)] = node.children
130
+ continue
117
131
  attachment_name = make_attachment_name(candidate, docs_dir)
118
132
  if candidate not in seen:
119
133
  seen[candidate] = None
@@ -130,6 +144,14 @@ def resolve_local_assets(
130
144
  return updated, attachments
131
145
 
132
146
 
147
+ def _display_path(page_path: Path, docs_dir: Path) -> str:
148
+ """Return *page_path* relative to *docs_dir* for messages, else its name."""
149
+ try:
150
+ return str(page_path.relative_to(docs_dir))
151
+ except ValueError:
152
+ return page_path.name
153
+
154
+
133
155
  def _resolve_asset_path(src: str, page_dir: Path, docs_dir: Path) -> Path | None:
134
156
  """Try to find *src* relative to *page_dir* then *docs_dir*.
135
157
 
@@ -0,0 +1,123 @@
1
+ """Tests for confluence.exclude_attachments (config, assets transform, compile)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import pytest
8
+
9
+ from mkdocs_to_confluence.compiler.page import compile_page
10
+ from mkdocs_to_confluence.ir.nodes import BoldNode, LinkNode, Paragraph, TextNode
11
+ from mkdocs_to_confluence.loader.config import (
12
+ ConfigError,
13
+ ConfluenceConfig,
14
+ MkDocsConfig,
15
+ load_config,
16
+ )
17
+ from mkdocs_to_confluence.loader.nav import NavNode
18
+ from mkdocs_to_confluence.transforms.assets import resolve_local_assets
19
+
20
+ _BASE = """
21
+ confluence:
22
+ base_url: https://example.atlassian.net
23
+ space_key: TECH
24
+ email: user@example.com
25
+ token: tok
26
+ """
27
+
28
+
29
+ def _load(tmp_path: Path, extra: str = "") -> ConfluenceConfig:
30
+ (tmp_path / "docs").mkdir(exist_ok=True)
31
+ (tmp_path / "mkdocs.yml").write_text(f"site_name: Test\n{_BASE}{extra}", encoding="utf-8")
32
+ cfg = load_config(tmp_path / "mkdocs.yml")
33
+ assert cfg.confluence is not None
34
+ return cfg.confluence
35
+
36
+
37
+ # ── config ───────────────────────────────────────────────────────────────────
38
+
39
+
40
+ def test_default_excludes_yaml(tmp_path: Path) -> None:
41
+ assert _load(tmp_path).exclude_attachments == (".yml", ".yaml")
42
+
43
+
44
+ def test_custom_list_normalised(tmp_path: Path) -> None:
45
+ conf = _load(tmp_path, " exclude_attachments: [yaml, .JSON, ' .sh ']\n")
46
+ assert conf.exclude_attachments == (".yaml", ".json", ".sh")
47
+
48
+
49
+ def test_empty_list_disables_exclusion(tmp_path: Path) -> None:
50
+ assert _load(tmp_path, " exclude_attachments: []\n").exclude_attachments == ()
51
+
52
+
53
+ @pytest.mark.parametrize("value", ["'.yaml'", "[1]", "['']", "['.']"])
54
+ def test_invalid_value_raises(tmp_path: Path, value: str) -> None:
55
+ with pytest.raises(ConfigError, match="exclude_attachments"):
56
+ _load(tmp_path, f" exclude_attachments: {value}\n")
57
+
58
+
59
+ # ── transform ────────────────────────────────────────────────────────────────
60
+
61
+
62
+ def _docs(tmp_path: Path) -> tuple[Path, Path]:
63
+ docs = tmp_path / "docs"
64
+ docs.mkdir()
65
+ (docs / "pipeline.YAML").write_text("steps: []\n", encoding="utf-8")
66
+ (docs / "report.pdf").write_bytes(b"PDF")
67
+ return docs, docs / "index.md"
68
+
69
+
70
+ def test_excluded_link_unwrapped_to_text_and_not_collected(
71
+ tmp_path: Path, capsys: pytest.CaptureFixture[str]
72
+ ) -> None:
73
+ docs, page = _docs(tmp_path)
74
+ link = LinkNode(href="pipeline.YAML", children=(TextNode("the "), BoldNode((TextNode("pipeline"),))))
75
+ pdf = LinkNode(href="report.pdf", children=(TextNode("report"),))
76
+ nodes = (Paragraph(children=(TextNode("See "), link, TextNode(" and "), pdf)),)
77
+
78
+ updated, attachments = resolve_local_assets(
79
+ nodes, page_path=page, docs_dir=docs, exclude_extensions=(".yml", ".yaml")
80
+ )
81
+
82
+ assert attachments == [(docs / "report.pdf").resolve()]
83
+ para = updated[0]
84
+ assert isinstance(para, Paragraph)
85
+ assert para.children[:3] == (TextNode("See "), TextNode("the "), BoldNode((TextNode("pipeline"),)))
86
+ assert isinstance(para.children[4], LinkNode)
87
+ assert para.children[4].attachment_name == "report.pdf"
88
+ err = capsys.readouterr().err
89
+ assert "pipeline.YAML" in err and "index.md" in err
90
+
91
+
92
+ def test_no_exclusions_uploads_yaml(tmp_path: Path) -> None:
93
+ docs, page = _docs(tmp_path)
94
+ nodes = (Paragraph(children=(LinkNode(href="pipeline.YAML", children=(TextNode("p"),)),)),)
95
+ _, attachments = resolve_local_assets(nodes, page_path=page, docs_dir=docs)
96
+ assert attachments == [(docs / "pipeline.YAML").resolve()]
97
+
98
+
99
+ # ── compile ──────────────────────────────────────────────────────────────────
100
+
101
+
102
+ def test_compile_page_excludes_yaml_by_default(tmp_path: Path) -> None:
103
+ docs = tmp_path / "docs"
104
+ docs.mkdir()
105
+ (docs / "ci.yml").write_text("on: push\n", encoding="utf-8")
106
+ (docs / "index.md").write_text("See [the CI config](ci.yml).\n", encoding="utf-8")
107
+ node = NavNode(title="Index", docs_path="index.md", source_path=docs / "index.md", level=0)
108
+ cfg = MkDocsConfig(
109
+ site_name="T",
110
+ docs_dir=docs,
111
+ repo_url=None,
112
+ edit_uri=None,
113
+ nav=None,
114
+ confluence=ConfluenceConfig(
115
+ base_url="https://x.atlassian.net", space_key="TECH", email="a@b.test", token="t"
116
+ ),
117
+ )
118
+
119
+ result = compile_page(node, cfg)
120
+
121
+ assert result.attachments == []
122
+ assert "See the CI config." in result.xhtml
123
+ assert "ci.yml" not in result.xhtml
@@ -24,6 +24,19 @@ def _section(*children):
24
24
 
25
25
 
26
26
  class TestReplaceNodes:
27
+ def test_tuple_replacement_spliced_and_rebuilt(self):
28
+ inner = _text("old")
29
+ link = LinkNode(href="x.yaml", children=(_text("a "), BoldNode(children=(inner,))))
30
+ para = _para(_text("see "), link, _text("."))
31
+ new_inner = _text("new")
32
+ result = replace_nodes((para,), {id(link): link.children, id(inner): new_inner})
33
+ assert result[0].children == ( # type: ignore[attr-defined]
34
+ _text("see "),
35
+ _text("a "),
36
+ BoldNode(children=(new_inner,)),
37
+ _text("."),
38
+ )
39
+
27
40
  def test_no_replacements_returns_same_tuple(self):
28
41
  nodes = (_para(_text("a")),)
29
42
  result = replace_nodes(nodes, {})