mkdocs2confluence 0.20.4__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.4/src/mkdocs2confluence.egg-info → mkdocs2confluence-0.21.0}/PKG-INFO +9 -1
  2. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/README.md +8 -0
  3. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/pyproject.toml +1 -1
  4. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0/src/mkdocs2confluence.egg-info}/PKG-INFO +9 -1
  5. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/SOURCES.txt +2 -0
  6. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/cli.py +4 -7
  7. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/page.py +14 -3
  8. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/emitter/xhtml.py +56 -37
  9. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/treeutil.py +24 -5
  10. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/config.py +24 -0
  11. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/changelog.py +20 -9
  12. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/client.py +40 -16
  13. mkdocs2confluence-0.21.0/src/mkdocs_to_confluence/publisher/digest.py +42 -0
  14. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/executor.py +36 -26
  15. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/models.py +1 -1
  16. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/planner.py +11 -4
  17. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/assets.py +25 -3
  18. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_admonition_titles.py +13 -24
  19. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_changelog_publish.py +25 -0
  20. mkdocs2confluence-0.21.0/tests/test_exclude_attachments.py +123 -0
  21. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_extra_css.py +32 -23
  22. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_publish_client.py +46 -0
  23. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_publish_pipeline.py +87 -16
  24. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_treeutil.py +13 -0
  25. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/LICENSE +0 -0
  26. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/setup.cfg +0 -0
  27. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/dependency_links.txt +0 -0
  28. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/entry_points.txt +0 -0
  29. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/requires.txt +0 -0
  30. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs2confluence.egg-info/top_level.txt +0 -0
  31. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/__init__.py +0 -0
  32. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/__init__.py +0 -0
  33. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/compiler/models.py +0 -0
  34. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/emitter/__init__.py +0 -0
  35. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/__init__.py +0 -0
  36. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/ir/nodes.py +0 -0
  37. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/__init__.py +0 -0
  38. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/extra_css.py +0 -0
  39. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/nav.py +0 -0
  40. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/loader/page.py +0 -0
  41. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/parser/__init__.py +0 -0
  42. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/parser/markdown.py +0 -0
  43. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/__init__.py +0 -0
  44. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/generator.py +0 -0
  45. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/pdf/render.py +0 -0
  46. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/__init__.py +0 -0
  47. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/abbrevs.py +0 -0
  48. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/captions.py +0 -0
  49. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/fence.py +0 -0
  50. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/frontmatter.py +0 -0
  51. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/icons.py +0 -0
  52. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/includes.py +0 -0
  53. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preprocess/linkdefs.py +0 -0
  54. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/__init__.py +0 -0
  55. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/render.py +0 -0
  56. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/preview/server.py +0 -0
  57. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/__init__.py +0 -0
  58. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/publisher/http_retry.py +0 -0
  59. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skill_installer.py +0 -0
  60. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/SKILL.md +0 -0
  61. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/scripts/changelog_data.py +0 -0
  62. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/__init__.py +0 -0
  63. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/anchoring.py +0 -0
  64. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/command.py +0 -0
  65. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/comments.py +0 -0
  66. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/github.py +0 -0
  67. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/platform.py +0 -0
  68. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/sync/state.py +0 -0
  69. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/__init__.py +0 -0
  70. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/_kroki.py +0 -0
  71. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/abbrevs.py +0 -0
  72. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/admonition_titles.py +0 -0
  73. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/attachment_previews.py +0 -0
  74. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/captions.py +0 -0
  75. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/editlink.py +0 -0
  76. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/footer.py +0 -0
  77. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/images.py +0 -0
  78. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/internallinks.py +0 -0
  79. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/mermaid.py +0 -0
  80. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/src/mkdocs_to_confluence/transforms/plantuml.py +0 -0
  81. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_abbrevs.py +0 -0
  82. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_attachment_previews.py +0 -0
  83. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_captions.py +0 -0
  84. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_changelog_config.py +0 -0
  85. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_children_macro.py +0 -0
  86. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_cli.py +0 -0
  87. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_editlink.py +0 -0
  88. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_emitter.py +0 -0
  89. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_exclude_properties_config.py +0 -0
  90. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_footer.py +0 -0
  91. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_frontmatter.py +0 -0
  92. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_icons.py +0 -0
  93. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_images.py +0 -0
  94. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_internallinks.py +0 -0
  95. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_ir.py +0 -0
  96. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_linkdefs.py +0 -0
  97. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_loader.py +0 -0
  98. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_mermaid.py +0 -0
  99. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_page_loader.py +0 -0
  100. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_parser.py +0 -0
  101. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_pdf.py +0 -0
  102. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_plantuml.py +0 -0
  103. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_preprocess.py +0 -0
  104. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_preview.py +0 -0
  105. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_publish_config.py +0 -0
  106. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_server.py +0 -0
  107. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_skill_installer.py +0 -0
  108. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_sync_anchoring.py +0 -0
  109. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_sync_command.py +0 -0
  110. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_sync_comments.py +0 -0
  111. {mkdocs2confluence-0.20.4 → mkdocs2confluence-0.21.0}/tests/test_sync_github.py +0 -0
  112. {mkdocs2confluence-0.20.4 → 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.4
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
@@ -109,6 +109,11 @@ on:
109
109
  branches: [main]
110
110
  paths: ['docs/**', 'mkdocs.yml']
111
111
 
112
+ # One publish at a time: overlapping runs can race to create the same page.
113
+ concurrency:
114
+ group: confluence-publish
115
+ cancel-in-progress: false
116
+
112
117
  jobs:
113
118
  publish:
114
119
  runs-on: ubuntu-latest
@@ -162,6 +167,7 @@ confluence:
162
167
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
163
168
  full_width: true # default: true
164
169
  attachment_preview: false # default: false — inline PDF/Office previews
170
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
165
171
  children_macro: true # default: true — child page list on section index pages
166
172
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
167
173
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -173,6 +179,8 @@ confluence:
173
179
 
174
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.
175
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
+
176
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.
177
185
 
178
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`.
@@ -66,6 +66,11 @@ on:
66
66
  branches: [main]
67
67
  paths: ['docs/**', 'mkdocs.yml']
68
68
 
69
+ # One publish at a time: overlapping runs can race to create the same page.
70
+ concurrency:
71
+ group: confluence-publish
72
+ cancel-in-progress: false
73
+
69
74
  jobs:
70
75
  publish:
71
76
  runs-on: ubuntu-latest
@@ -119,6 +124,7 @@ confluence:
119
124
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
120
125
  full_width: true # default: true
121
126
  attachment_preview: false # default: false — inline PDF/Office previews
127
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
122
128
  children_macro: true # default: true — child page list on section index pages
123
129
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
124
130
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -130,6 +136,8 @@ confluence:
130
136
 
131
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.
132
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
+
133
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.
134
142
 
135
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.4"
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.4
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
@@ -109,6 +109,11 @@ on:
109
109
  branches: [main]
110
110
  paths: ['docs/**', 'mkdocs.yml']
111
111
 
112
+ # One publish at a time: overlapping runs can race to create the same page.
113
+ concurrency:
114
+ group: confluence-publish
115
+ cancel-in-progress: false
116
+
112
117
  jobs:
113
118
  publish:
114
119
  runs-on: ubuntu-latest
@@ -162,6 +167,7 @@ confluence:
162
167
  mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
163
168
  full_width: true # default: true
164
169
  attachment_preview: false # default: false — inline PDF/Office previews
170
+ exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
165
171
  children_macro: true # default: true — child page list on section index pages
166
172
  changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
167
173
  exclude_properties: # optional: front matter keys to hide from Page Properties
@@ -173,6 +179,8 @@ confluence:
173
179
 
174
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.
175
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
+
176
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.
177
185
 
178
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`.
@@ -42,6 +42,7 @@ src/mkdocs_to_confluence/preview/server.py
42
42
  src/mkdocs_to_confluence/publisher/__init__.py
43
43
  src/mkdocs_to_confluence/publisher/changelog.py
44
44
  src/mkdocs_to_confluence/publisher/client.py
45
+ src/mkdocs_to_confluence/publisher/digest.py
45
46
  src/mkdocs_to_confluence/publisher/executor.py
46
47
  src/mkdocs_to_confluence/publisher/http_retry.py
47
48
  src/mkdocs_to_confluence/publisher/models.py
@@ -78,6 +79,7 @@ tests/test_children_macro.py
78
79
  tests/test_cli.py
79
80
  tests/test_editlink.py
80
81
  tests/test_emitter.py
82
+ tests/test_exclude_attachments.py
81
83
  tests/test_exclude_properties_config.py
82
84
  tests/test_extra_css.py
83
85
  tests/test_footer.py
@@ -10,7 +10,7 @@ from pathlib import Path
10
10
 
11
11
  from mkdocs_to_confluence import __version__
12
12
  from mkdocs_to_confluence.compiler.page import compile_page
13
- from mkdocs_to_confluence.emitter.xhtml import configure_admonitions, configure_styles
13
+ from mkdocs_to_confluence.emitter.xhtml import warn_unknown_admonition_kinds
14
14
  from mkdocs_to_confluence.loader.config import load_config
15
15
  from mkdocs_to_confluence.loader.nav import find_section, find_section_by_folder, flat_pages, resolve_nav
16
16
  from mkdocs_to_confluence.loader.page import PageLoadError, find_page
@@ -339,8 +339,7 @@ def _parse_out_path(out_arg: str | None) -> tuple[Path, str]:
339
339
  def _cmd_preview(args: argparse.Namespace) -> None:
340
340
  config_path = Path(args.config).resolve()
341
341
  config = load_config(config_path)
342
- configure_styles(config.extra_styles)
343
- configure_admonitions(config.confluence.admonitions if config.confluence else None)
342
+ warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
344
343
 
345
344
  all_nodes = resolve_nav(config)
346
345
 
@@ -495,8 +494,7 @@ def _cmd_preview(args: argparse.Namespace) -> None:
495
494
  def _cmd_publish(args: argparse.Namespace) -> None:
496
495
  config_path = Path(args.config).resolve()
497
496
  config = load_config(config_path)
498
- configure_styles(config.extra_styles)
499
- configure_admonitions(config.confluence.admonitions if config.confluence else None)
497
+ warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
500
498
 
501
499
  conf_config = config.confluence
502
500
  if conf_config is None:
@@ -688,8 +686,7 @@ def _cmd_pdf(args: argparse.Namespace) -> None:
688
686
 
689
687
  config_path = Path(args.config).resolve()
690
688
  config = load_config(config_path)
691
- configure_styles(config.extra_styles)
692
- configure_admonitions(config.confluence.admonitions if config.confluence else None)
689
+ warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
693
690
 
694
691
  nodes = resolve_nav(config)
695
692
 
@@ -3,9 +3,9 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from mkdocs_to_confluence.compiler.models import CompileResult
6
- from mkdocs_to_confluence.emitter.xhtml import emit
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 = (
@@ -129,7 +134,13 @@ def compile_page(
129
134
  version_message = f"{node_item.commit_sha}: {node_item.commit_summary}"
130
135
 
131
136
  return CompileResult(
132
- xhtml=emit(ir_nodes),
137
+ xhtml=emit(
138
+ ir_nodes,
139
+ EmitOptions(
140
+ styles=config.extra_styles,
141
+ admonition_aliases=config.confluence.admonitions if config.confluence else {},
142
+ ),
143
+ ),
133
144
  attachments=attachments,
134
145
  labels=labels,
135
146
  confluence_status=confluence_status,
@@ -18,8 +18,10 @@ from __future__ import annotations
18
18
 
19
19
  import html
20
20
  import sys
21
+ from collections.abc import Mapping, Sequence
22
+ from contextvars import ContextVar
23
+ from dataclasses import dataclass, field
21
24
  from pathlib import Path
22
- from typing import Sequence
23
25
 
24
26
  from mkdocs_to_confluence.ir.nodes import (
25
27
  AbbrevFootnoteNode,
@@ -68,34 +70,41 @@ from mkdocs_to_confluence.ir.nodes import (
68
70
  )
69
71
  from mkdocs_to_confluence.loader.extra_css import ExtraStyles, styles_to_attr
70
72
 
71
- # ── Extra-CSS style state (set once per run via configure_styles) ──────────────
73
+ # ── Emit options (config-driven, scoped to one emit() call) ────────────────────
72
74
 
73
- _styles: ExtraStyles | None = None
74
75
 
76
+ @dataclass(frozen=True)
77
+ class EmitOptions:
78
+ """Config-driven settings the emitter applies to a page.
79
+
80
+ Attributes:
81
+ styles: Extra-CSS styles inlined into headings, table cells and inline code.
82
+ admonition_aliases: Custom admonition kinds mapped onto built-in ones,
83
+ from ``confluence.admonitions``.
84
+ """
85
+
86
+ styles: ExtraStyles | None = None
87
+ admonition_aliases: Mapping[str, str] = field(default_factory=dict)
75
88
 
76
- def configure_styles(styles: ExtraStyles | None) -> None:
77
- """Set the module-level extra-CSS styles used during emit."""
78
- global _styles
79
- _styles = styles
80
89
 
90
+ _DEFAULT_OPTIONS = EmitOptions()
81
91
 
82
- # ── Custom admonition aliases (set once per run via configure_admonitions) ─────
92
+ # The options of the emit() call in progress. Only emit() sets it, and it resets
93
+ # it when it returns, so no setting outlives the call that passed it.
94
+ _current_options: ContextVar[EmitOptions | None] = ContextVar("_current_options", default=None)
83
95
 
84
- _admonition_aliases: dict[str, str] = {}
85
96
 
97
+ def _options() -> EmitOptions:
98
+ return _current_options.get() or _DEFAULT_OPTIONS
86
99
 
87
- def configure_admonitions(aliases: dict[str, str] | None) -> None:
88
- """Map custom admonition kinds onto built-in ones, from ``confluence.admonitions``.
89
100
 
90
- Targets naming no built-in kind are kept but warned about — they resolve
91
- through the same fallback as any unknown kind, so a typo degrades rather
92
- than fails the build.
101
+ def warn_unknown_admonition_kinds(aliases: Mapping[str, str]) -> None:
102
+ """Warn about ``confluence.admonitions`` targets that name no built-in kind.
103
+
104
+ Such targets are kept: they resolve through the same fallback as any
105
+ unknown kind, so a typo degrades rather than fails the build.
93
106
  """
94
- global _admonition_aliases
95
- _admonition_aliases = dict(aliases or {})
96
- unknown = sorted(
97
- f"{k} -> {v}" for k, v in _admonition_aliases.items() if v not in _KNOWN_ADMONITION_KINDS
98
- )
107
+ unknown = sorted(f"{k} -> {v}" for k, v in aliases.items() if v not in _KNOWN_ADMONITION_KINDS)
99
108
  if unknown:
100
109
  print(
101
110
  "warning: confluence.admonitions targets an unknown admonition kind: "
@@ -104,6 +113,7 @@ def configure_admonitions(aliases: dict[str, str] | None) -> None:
104
113
  file=sys.stderr,
105
114
  )
106
115
 
116
+
107
117
  # ── Admonition kind → Confluence macro name ───────────────────────────────────
108
118
 
109
119
  # Types that map to Confluence's four native panel macros (include built-in icons).
@@ -176,20 +186,26 @@ _DEFAULT_ADMONITION_TITLES: dict[str, str] = {
176
186
  # ── Public API ─────────────────────────────────────────────────────────────────
177
187
 
178
188
 
179
- def emit(nodes: Sequence[IRNode]) -> str:
189
+ def emit(nodes: Sequence[IRNode], options: EmitOptions | None = None) -> str:
180
190
  """Convert a sequence of top-level IR nodes to Confluence storage XHTML.
181
191
 
182
192
  Args:
183
193
  nodes: Top-level IR nodes as returned by the parser.
194
+ options: Config-driven settings for this page; defaults apply none.
184
195
 
185
196
  Returns:
186
197
  A UTF-8 string of valid Confluence storage format XML, without an XML
187
198
  declaration (Confluence expects the body fragment only).
188
199
  """
189
- parts: list[str] = []
190
- for node in nodes:
191
- parts.append(_emit_node(node))
192
- return "".join(parts)
200
+ token = _current_options.set(options or _DEFAULT_OPTIONS)
201
+ try:
202
+ return _emit_blocks(nodes)
203
+ finally:
204
+ _current_options.reset(token)
205
+
206
+
207
+ def _emit_blocks(nodes: Sequence[IRNode]) -> str:
208
+ return "".join(_emit_node(node) for node in nodes)
193
209
 
194
210
 
195
211
  # ── Node dispatch ─────────────────────────────────────────────────────────────
@@ -251,8 +267,9 @@ def _emit_section(node: Section) -> str:
251
267
  tag = f"h{node.level}"
252
268
  title_html = _emit_inlines(node.title)
253
269
  style_attr = ""
254
- if _styles:
255
- style_attr = styles_to_attr(_styles.headings.get(f"h{node.level}", {}))
270
+ styles = _options().styles
271
+ if styles:
272
+ style_attr = styles_to_attr(styles.headings.get(f"h{node.level}", {}))
256
273
  anchor = ""
257
274
  # Emit an anchor macro for every heading so links resolve to the section.
258
275
  # Confluence's auto heading-anchors use a different naming scheme than the
@@ -262,7 +279,7 @@ def _emit_section(node: Section) -> str:
262
279
  if name:
263
280
  anchor = _anchor_macro(name)
264
281
  heading = f"{anchor}<{tag}{style_attr}>{title_html}</{tag}>\n"
265
- body = emit(node.children)
282
+ body = _emit_blocks(node.children)
266
283
  return heading + body
267
284
 
268
285
 
@@ -398,7 +415,7 @@ def _resolve_admonition_kind(kind: str) -> str:
398
415
  Order: an explicit ``confluence.admonitions`` alias, then the built-in kinds,
399
416
  then ``success`` for anything unrecognised.
400
417
  """
401
- alias = _admonition_aliases.get(kind)
418
+ alias = _options().admonition_aliases.get(kind)
402
419
  if alias is not None:
403
420
  return alias
404
421
  if kind in _KNOWN_ADMONITION_KINDS:
@@ -411,7 +428,7 @@ def _emit_admonition(node: Admonition) -> str:
411
428
  # follows the resolved kind.
412
429
  title = node.title or _DEFAULT_ADMONITION_TITLES.get(node.kind, node.kind.capitalize())
413
430
  kind = _resolve_admonition_kind(node.kind)
414
- body = emit(node.children)
431
+ body = _emit_blocks(node.children)
415
432
 
416
433
  # ??? and ???+ → Confluence expand macro (collapsible)
417
434
  # ???+ means "expanded by default" — Confluence expand has no such option,
@@ -511,7 +528,7 @@ def _emit_list_item(item: ListItem) -> str:
511
528
  parts: list[str] = []
512
529
  if first_block > 0:
513
530
  parts.append(f"<p>{_emit_inlines(item.children[:first_block])}</p>\n")
514
- parts.append(emit(item.children[first_block:]))
531
+ parts.append(_emit_blocks(item.children[first_block:]))
515
532
  return f" <li>{''.join(parts).strip()}</li>\n"
516
533
 
517
534
 
@@ -532,8 +549,9 @@ def _emit_table_row(row: TableRow, *, is_header: bool) -> str:
532
549
  def _emit_table_cell(cell: TableCell, *, force_header: bool) -> str:
533
550
  tag = "th" if (cell.is_header or force_header) else "td"
534
551
  props: dict[str, str] = {}
535
- if _styles:
536
- props = dict(_styles.th if tag == "th" else _styles.td)
552
+ styles = _options().styles
553
+ if styles:
554
+ props = dict(styles.th if tag == "th" else styles.td)
537
555
  if cell.align:
538
556
  props["text-align"] = cell.align
539
557
  style_attr = styles_to_attr(props)
@@ -542,7 +560,7 @@ def _emit_table_cell(cell: TableCell, *, force_header: bool) -> str:
542
560
 
543
561
 
544
562
  def _emit_blockquote(node: BlockQuote) -> str:
545
- body = emit(node.children)
563
+ body = _emit_blocks(node.children)
546
564
  return f"<blockquote>\n{body}</blockquote>\n"
547
565
 
548
566
 
@@ -597,7 +615,7 @@ def _emit_content_tabs(node: ContentTabs) -> str:
597
615
  # Degrade to a series of expand macros (one per tab)
598
616
  parts: list[str] = []
599
617
  for tab in node.tabs:
600
- body = emit(tab.children)
618
+ body = _emit_blocks(tab.children)
601
619
  parts.append(
602
620
  '<ac:structured-macro ac:name="expand">\n'
603
621
  f' <ac:parameter ac:name="title">{html.escape(tab.label)}</ac:parameter>\n'
@@ -608,7 +626,7 @@ def _emit_content_tabs(node: ContentTabs) -> str:
608
626
 
609
627
 
610
628
  def _emit_expandable(node: Expandable) -> str:
611
- body = emit(node.children)
629
+ body = _emit_blocks(node.children)
612
630
  return (
613
631
  '<ac:structured-macro ac:name="expand">\n'
614
632
  f' <ac:parameter ac:name="title">{html.escape(node.title)}</ac:parameter>\n'
@@ -652,7 +670,7 @@ def _emit_grid_cards(node: GridCards) -> str:
652
670
  parts.append(f' <ac:layout-section ac:type="{layout_type}">\n')
653
671
  for card_nodes in row:
654
672
  parts.append(" <ac:layout-cell>\n")
655
- parts.append(emit(card_nodes))
673
+ parts.append(_emit_blocks(card_nodes))
656
674
  parts.append(" </ac:layout-cell>\n")
657
675
  # Pad last row with empty cells if needed.
658
676
  for _ in range(cols - len(row)):
@@ -760,7 +778,8 @@ def _emit_inline(node: IRNode) -> str:
760
778
  if isinstance(node, InsertNode):
761
779
  return f"<u>{_emit_inlines(node.children)}</u>"
762
780
  if isinstance(node, CodeInlineNode):
763
- style_attr = styles_to_attr(_styles.code_inline) if _styles else ""
781
+ styles = _options().styles
782
+ style_attr = styles_to_attr(styles.code_inline) if styles else ""
764
783
  return f"<code{style_attr}>{html.escape(node.code)}</code>"
765
784
  if isinstance(node, LinkNode):
766
785
  return _emit_link(node)
@@ -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
  )
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import hashlib
6
5
  import sys
7
6
  from pathlib import Path
8
7
  from typing import TYPE_CHECKING
@@ -12,6 +11,7 @@ import yaml
12
11
  from mkdocs_to_confluence.compiler.page import compile_page
13
12
  from mkdocs_to_confluence.loader.nav import NavNode
14
13
  from mkdocs_to_confluence.preprocess.frontmatter import _FRONT_MATTER_RE
14
+ from mkdocs_to_confluence.publisher.digest import page_content_hash
15
15
  from mkdocs_to_confluence.publisher.executor import upload_assets
16
16
 
17
17
  if TYPE_CHECKING:
@@ -74,10 +74,14 @@ def publish_changelog(
74
74
 
75
75
  result = compile_page(node, config, link_map or {}, quiet=quiet)
76
76
 
77
- xhtml_hash = hashlib.sha256(result.xhtml.encode()).hexdigest()
77
+ content_hash = page_content_hash(result.xhtml, result.attachments, config.docs_dir)
78
78
  existing = client.find_page(space_id, title)
79
79
 
80
- if existing is not None and client.get_content_hash(str(existing["id"])) == xhtml_hash:
80
+ if (
81
+ existing is not None
82
+ and content_hash is not None
83
+ and client.get_content_hash(str(existing["id"])) == content_hash
84
+ ):
81
85
  if not quiet:
82
86
  print(f" unchanged '{title}' (changelog)")
83
87
  return
@@ -102,15 +106,22 @@ def publish_changelog(
102
106
  if not quiet:
103
107
  print(f" updated '{title}' (changelog)")
104
108
 
109
+ asset_errors: list[tuple[str, str]] = []
105
110
  if result.attachments:
106
- upload_assets(page_id, result.attachments, config.docs_dir, client, quiet=quiet)
111
+ _, _, asset_errors = upload_assets(
112
+ page_id, result.attachments, config.docs_dir, client, quiet=quiet
113
+ )
114
+ for name, msg in asset_errors:
115
+ print(f" [warn] changelog: could not upload {name}: {msg}", file=sys.stderr)
107
116
 
108
117
  # content hash is an internal optimization; if it fails the next run just
109
- # re-publishes, so a failure is self-healing and stays silent.
110
- try:
111
- client.set_content_hash(page_id, xhtml_hash)
112
- except Exception:
113
- pass # non-fatal
118
+ # re-publishes, so a failure is self-healing and stays silent. After a failed
119
+ # upload it is not stored, so the next run retries the attachment.
120
+ if content_hash is not None and not asset_errors:
121
+ try:
122
+ client.set_content_hash(page_id, content_hash)
123
+ except Exception:
124
+ pass # non-fatal
114
125
 
115
126
  # labels / full-width / status are user-configured presentation. They must
116
127
  # never fail an already-saved page (catch broadly so a transient network