mkdocs2confluence 0.20.5__tar.gz → 0.22.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.
- {mkdocs2confluence-0.20.5/src/mkdocs2confluence.egg-info → mkdocs2confluence-0.22.0}/PKG-INFO +7 -2
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/README.md +6 -1
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/pyproject.toml +1 -1
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0/src/mkdocs2confluence.egg-info}/PKG-INFO +7 -2
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/SOURCES.txt +2 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/cli.py +27 -19
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/compiler/page.py +6 -1
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/ir/treeutil.py +24 -5
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/config.py +69 -22
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/assets.py +25 -3
- mkdocs2confluence-0.22.0/tests/test_config_discovery.py +83 -0
- mkdocs2confluence-0.22.0/tests/test_exclude_attachments.py +123 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_loader.py +1 -1
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_treeutil.py +13 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/LICENSE +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/setup.cfg +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/dependency_links.txt +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/entry_points.txt +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/requires.txt +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/top_level.txt +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/compiler/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/compiler/models.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/emitter/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/emitter/xhtml.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/ir/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/ir/nodes.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/extra_css.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/nav.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/page.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/parser/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/parser/markdown.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/pdf/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/pdf/generator.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/pdf/render.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/abbrevs.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/captions.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/fence.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/frontmatter.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/icons.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/includes.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preprocess/linkdefs.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preview/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preview/render.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/preview/server.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/changelog.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/client.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/digest.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/executor.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/http_retry.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/models.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/publisher/planner.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/skill_installer.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/SKILL.md +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/skills/mkdocs-changelog/scripts/changelog_data.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/anchoring.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/command.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/comments.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/github.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/platform.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/sync/state.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/__init__.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/_kroki.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/abbrevs.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/admonition_titles.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/attachment_previews.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/captions.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/editlink.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/footer.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/images.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/internallinks.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/mermaid.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/transforms/plantuml.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_abbrevs.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_admonition_titles.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_attachment_previews.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_captions.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_changelog_config.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_changelog_publish.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_children_macro.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_cli.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_editlink.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_emitter.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_exclude_properties_config.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_extra_css.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_footer.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_frontmatter.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_icons.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_images.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_internallinks.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_ir.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_linkdefs.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_mermaid.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_page_loader.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_parser.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_pdf.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_plantuml.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_preprocess.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_preview.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_publish_client.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_publish_config.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_publish_pipeline.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_server.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_skill_installer.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_sync_anchoring.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_sync_command.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_sync_comments.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_sync_github.py +0 -0
- {mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/tests/test_sync_state.py +0 -0
{mkdocs2confluence-0.20.5/src/mkdocs2confluence.egg-info → mkdocs2confluence-0.22.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs2confluence
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.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
|
|
@@ -67,6 +67,8 @@ A Python CLI tool that compiles MkDocs-flavoured Markdown into **native Confluen
|
|
|
67
67
|
|
|
68
68
|
> **Zensical compatible** — [Zensical](https://zensical.org/) is the modern successor to MkDocs + Material for MkDocs. Since it uses the same `mkdocs.yml` format and Python Markdown extensions, your Zensical project works with mk2conf today with no changes required.
|
|
69
69
|
|
|
70
|
+
> **ProperDocs compatible** — [ProperDocs](https://properdocs.org/) is a fork of MkDocs that reads `properdocs.yml`, which has the same format as `mkdocs.yml`. Without `--config`, mk2conf looks in the current directory for `properdocs.yml` first, then `mkdocs.yml`, the same order ProperDocs uses. All `mkdocs.yml` settings in this README, including the `confluence:` block, work the same in `properdocs.yml`.
|
|
71
|
+
|
|
70
72
|
---
|
|
71
73
|
|
|
72
74
|
## Installation
|
|
@@ -107,7 +109,7 @@ name: Publish docs
|
|
|
107
109
|
on:
|
|
108
110
|
push:
|
|
109
111
|
branches: [main]
|
|
110
|
-
paths: ['docs/**', 'mkdocs.yml']
|
|
112
|
+
paths: ['docs/**', 'mkdocs.yml', 'properdocs.yml']
|
|
111
113
|
|
|
112
114
|
# One publish at a time: overlapping runs can race to create the same page.
|
|
113
115
|
concurrency:
|
|
@@ -167,6 +169,7 @@ confluence:
|
|
|
167
169
|
mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
|
|
168
170
|
full_width: true # default: true
|
|
169
171
|
attachment_preview: false # default: false — inline PDF/Office previews
|
|
172
|
+
exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
|
|
170
173
|
children_macro: true # default: true — child page list on section index pages
|
|
171
174
|
changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
|
|
172
175
|
exclude_properties: # optional: front matter keys to hide from Page Properties
|
|
@@ -178,6 +181,8 @@ confluence:
|
|
|
178
181
|
|
|
179
182
|
`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
183
|
|
|
184
|
+
`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.
|
|
185
|
+
|
|
181
186
|
`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
187
|
|
|
183
188
|
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`.
|
|
@@ -24,6 +24,8 @@ A Python CLI tool that compiles MkDocs-flavoured Markdown into **native Confluen
|
|
|
24
24
|
|
|
25
25
|
> **Zensical compatible** — [Zensical](https://zensical.org/) is the modern successor to MkDocs + Material for MkDocs. Since it uses the same `mkdocs.yml` format and Python Markdown extensions, your Zensical project works with mk2conf today with no changes required.
|
|
26
26
|
|
|
27
|
+
> **ProperDocs compatible** — [ProperDocs](https://properdocs.org/) is a fork of MkDocs that reads `properdocs.yml`, which has the same format as `mkdocs.yml`. Without `--config`, mk2conf looks in the current directory for `properdocs.yml` first, then `mkdocs.yml`, the same order ProperDocs uses. All `mkdocs.yml` settings in this README, including the `confluence:` block, work the same in `properdocs.yml`.
|
|
28
|
+
|
|
27
29
|
---
|
|
28
30
|
|
|
29
31
|
## Installation
|
|
@@ -64,7 +66,7 @@ name: Publish docs
|
|
|
64
66
|
on:
|
|
65
67
|
push:
|
|
66
68
|
branches: [main]
|
|
67
|
-
paths: ['docs/**', 'mkdocs.yml']
|
|
69
|
+
paths: ['docs/**', 'mkdocs.yml', 'properdocs.yml']
|
|
68
70
|
|
|
69
71
|
# One publish at a time: overlapping runs can race to create the same page.
|
|
70
72
|
concurrency:
|
|
@@ -124,6 +126,7 @@ confluence:
|
|
|
124
126
|
mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
|
|
125
127
|
full_width: true # default: true
|
|
126
128
|
attachment_preview: false # default: false — inline PDF/Office previews
|
|
129
|
+
exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
|
|
127
130
|
children_macro: true # default: true — child page list on section index pages
|
|
128
131
|
changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
|
|
129
132
|
exclude_properties: # optional: front matter keys to hide from Page Properties
|
|
@@ -135,6 +138,8 @@ confluence:
|
|
|
135
138
|
|
|
136
139
|
`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
140
|
|
|
141
|
+
`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.
|
|
142
|
+
|
|
138
143
|
`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
144
|
|
|
140
145
|
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.
|
|
3
|
+
version = "0.22.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" }
|
{mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0/src/mkdocs2confluence.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs2confluence
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.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
|
|
@@ -67,6 +67,8 @@ A Python CLI tool that compiles MkDocs-flavoured Markdown into **native Confluen
|
|
|
67
67
|
|
|
68
68
|
> **Zensical compatible** — [Zensical](https://zensical.org/) is the modern successor to MkDocs + Material for MkDocs. Since it uses the same `mkdocs.yml` format and Python Markdown extensions, your Zensical project works with mk2conf today with no changes required.
|
|
69
69
|
|
|
70
|
+
> **ProperDocs compatible** — [ProperDocs](https://properdocs.org/) is a fork of MkDocs that reads `properdocs.yml`, which has the same format as `mkdocs.yml`. Without `--config`, mk2conf looks in the current directory for `properdocs.yml` first, then `mkdocs.yml`, the same order ProperDocs uses. All `mkdocs.yml` settings in this README, including the `confluence:` block, work the same in `properdocs.yml`.
|
|
71
|
+
|
|
70
72
|
---
|
|
71
73
|
|
|
72
74
|
## Installation
|
|
@@ -107,7 +109,7 @@ name: Publish docs
|
|
|
107
109
|
on:
|
|
108
110
|
push:
|
|
109
111
|
branches: [main]
|
|
110
|
-
paths: ['docs/**', 'mkdocs.yml']
|
|
112
|
+
paths: ['docs/**', 'mkdocs.yml', 'properdocs.yml']
|
|
111
113
|
|
|
112
114
|
# One publish at a time: overlapping runs can race to create the same page.
|
|
113
115
|
concurrency:
|
|
@@ -167,6 +169,7 @@ confluence:
|
|
|
167
169
|
mermaid_render: kroki # "kroki" (default) | "kroki:https://your-kroki" | "none" — also controls PlantUML rendering
|
|
168
170
|
full_width: true # default: true
|
|
169
171
|
attachment_preview: false # default: false — inline PDF/Office previews
|
|
172
|
+
exclude_attachments: [.yml, .yaml] # default — linked files of these types are never uploaded
|
|
170
173
|
children_macro: true # default: true — child page list on section index pages
|
|
171
174
|
changelog: CHANGELOG.md # optional: publish as a top-level "What's New" page
|
|
172
175
|
exclude_properties: # optional: front matter keys to hide from Page Properties
|
|
@@ -178,6 +181,8 @@ confluence:
|
|
|
178
181
|
|
|
179
182
|
`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
183
|
|
|
184
|
+
`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.
|
|
185
|
+
|
|
181
186
|
`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
187
|
|
|
183
188
|
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`.
|
{mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs2confluence.egg-info/SOURCES.txt
RENAMED
|
@@ -77,8 +77,10 @@ tests/test_changelog_config.py
|
|
|
77
77
|
tests/test_changelog_publish.py
|
|
78
78
|
tests/test_children_macro.py
|
|
79
79
|
tests/test_cli.py
|
|
80
|
+
tests/test_config_discovery.py
|
|
80
81
|
tests/test_editlink.py
|
|
81
82
|
tests/test_emitter.py
|
|
83
|
+
tests/test_exclude_attachments.py
|
|
82
84
|
tests/test_exclude_properties_config.py
|
|
83
85
|
tests/test_extra_css.py
|
|
84
86
|
tests/test_footer.py
|
|
@@ -11,7 +11,7 @@ from pathlib import Path
|
|
|
11
11
|
from mkdocs_to_confluence import __version__
|
|
12
12
|
from mkdocs_to_confluence.compiler.page import compile_page
|
|
13
13
|
from mkdocs_to_confluence.emitter.xhtml import warn_unknown_admonition_kinds
|
|
14
|
-
from mkdocs_to_confluence.loader.config import load_config
|
|
14
|
+
from mkdocs_to_confluence.loader.config import find_config, 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
|
|
17
17
|
from mkdocs_to_confluence.preview.render import inject_livereload, render_index, render_page
|
|
@@ -49,8 +49,8 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
49
49
|
preview.add_argument(
|
|
50
50
|
"--config",
|
|
51
51
|
metavar="PATH",
|
|
52
|
-
default=
|
|
53
|
-
help="Path to
|
|
52
|
+
default=None,
|
|
53
|
+
help="Path to the config file (default: ./properdocs.yml, else ./mkdocs.yml).",
|
|
54
54
|
)
|
|
55
55
|
preview.add_argument(
|
|
56
56
|
"--page",
|
|
@@ -110,14 +110,14 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
110
110
|
" MK2CONF_TOKEN=<token> (alias)\n"
|
|
111
111
|
"\n"
|
|
112
112
|
" The token, email, base_url, space_key/parent_page_id must also be\n"
|
|
113
|
-
" configured in the 'confluence:' block of mkdocs.yml.\n"
|
|
113
|
+
" configured in the 'confluence:' block of mkdocs.yml / properdocs.yml.\n"
|
|
114
114
|
),
|
|
115
115
|
)
|
|
116
116
|
publish.add_argument(
|
|
117
117
|
"--config",
|
|
118
118
|
metavar="PATH",
|
|
119
|
-
default=
|
|
120
|
-
help="Path to
|
|
119
|
+
default=None,
|
|
120
|
+
help="Path to the config file (default: ./properdocs.yml, else ./mkdocs.yml).",
|
|
121
121
|
)
|
|
122
122
|
publish.add_argument(
|
|
123
123
|
"--dry-run",
|
|
@@ -183,8 +183,8 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
183
183
|
pdf.add_argument(
|
|
184
184
|
"--config",
|
|
185
185
|
metavar="PATH",
|
|
186
|
-
default=
|
|
187
|
-
help="Path to
|
|
186
|
+
default=None,
|
|
187
|
+
help="Path to the config file (default: ./properdocs.yml, else ./mkdocs.yml).",
|
|
188
188
|
)
|
|
189
189
|
pdf.add_argument(
|
|
190
190
|
"--section",
|
|
@@ -229,7 +229,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
229
229
|
help="Sync open Confluence comments to GitHub review PRs.",
|
|
230
230
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
231
231
|
epilog=(
|
|
232
|
-
"Requires github_repo and github_token (or GITHUB_TOKEN env var) in mkdocs.yml.\n"
|
|
232
|
+
"Requires github_repo and github_token (or GITHUB_TOKEN env var) in mkdocs.yml / properdocs.yml.\n"
|
|
233
233
|
"\n"
|
|
234
234
|
"Examples:\n"
|
|
235
235
|
" mk2conf sync-comments # sync new comments → PRs\n"
|
|
@@ -240,8 +240,8 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
240
240
|
sc.add_argument(
|
|
241
241
|
"--config",
|
|
242
242
|
metavar="PATH",
|
|
243
|
-
default=
|
|
244
|
-
help="Path to
|
|
243
|
+
default=None,
|
|
244
|
+
help="Path to the config file (default: ./properdocs.yml, else ./mkdocs.yml).",
|
|
245
245
|
)
|
|
246
246
|
sc.add_argument(
|
|
247
247
|
"--check-merges",
|
|
@@ -336,8 +336,15 @@ def _parse_out_path(out_arg: str | None) -> tuple[Path, str]:
|
|
|
336
336
|
return p.parent, p.name
|
|
337
337
|
|
|
338
338
|
|
|
339
|
+
def _config_path(args: argparse.Namespace) -> Path:
|
|
340
|
+
"""Return the --config path, or look up properdocs.yml / mkdocs.yml in the CWD."""
|
|
341
|
+
if args.config:
|
|
342
|
+
return Path(args.config).resolve()
|
|
343
|
+
return find_config(Path.cwd())
|
|
344
|
+
|
|
345
|
+
|
|
339
346
|
def _cmd_preview(args: argparse.Namespace) -> None:
|
|
340
|
-
config_path =
|
|
347
|
+
config_path = _config_path(args)
|
|
341
348
|
config = load_config(config_path)
|
|
342
349
|
warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
|
|
343
350
|
|
|
@@ -492,13 +499,13 @@ def _cmd_preview(args: argparse.Namespace) -> None:
|
|
|
492
499
|
|
|
493
500
|
|
|
494
501
|
def _cmd_publish(args: argparse.Namespace) -> None:
|
|
495
|
-
config_path =
|
|
502
|
+
config_path = _config_path(args)
|
|
496
503
|
config = load_config(config_path)
|
|
497
504
|
warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
|
|
498
505
|
|
|
499
506
|
conf_config = config.confluence
|
|
500
507
|
if conf_config is None:
|
|
501
|
-
print("error: no 'confluence:' section in
|
|
508
|
+
print(f"error: no 'confluence:' section in {config_path.name}", file=sys.stderr)
|
|
502
509
|
sys.exit(1)
|
|
503
510
|
|
|
504
511
|
token = conf_config.token
|
|
@@ -565,7 +572,7 @@ def _cmd_publish(args: argparse.Namespace) -> None:
|
|
|
565
572
|
space_id = client.get_space_id(conf_config.space_key)
|
|
566
573
|
else:
|
|
567
574
|
print(
|
|
568
|
-
"error: cannot determine space — set 'space_key' or 'parent_page_id' in
|
|
575
|
+
f"error: cannot determine space — set 'space_key' or 'parent_page_id' in {config_path.name}",
|
|
569
576
|
file=sys.stderr,
|
|
570
577
|
)
|
|
571
578
|
sys.exit(1)
|
|
@@ -684,7 +691,7 @@ def _cmd_pdf(args: argparse.Namespace) -> None:
|
|
|
684
691
|
from mkdocs_to_confluence.pdf.generator import write_pdf
|
|
685
692
|
from mkdocs_to_confluence.pdf.render import build_pdf_html
|
|
686
693
|
|
|
687
|
-
config_path =
|
|
694
|
+
config_path = _config_path(args)
|
|
688
695
|
config = load_config(config_path)
|
|
689
696
|
warn_unknown_admonition_kinds(config.confluence.admonitions if config.confluence else {})
|
|
690
697
|
|
|
@@ -763,12 +770,12 @@ def _cmd_sync_comments(args: argparse.Namespace) -> None:
|
|
|
763
770
|
from mkdocs_to_confluence.sync.command import check_and_resolve_merges, run_sync_comments
|
|
764
771
|
from mkdocs_to_confluence.sync.github import GitHubReviewClient
|
|
765
772
|
|
|
766
|
-
config_path =
|
|
773
|
+
config_path = _config_path(args)
|
|
767
774
|
config = load_config(config_path)
|
|
768
775
|
|
|
769
776
|
conf = config.confluence
|
|
770
777
|
if conf is None:
|
|
771
|
-
print("error: no 'confluence:' section in
|
|
778
|
+
print(f"error: no 'confluence:' section in {config_path.name}", file=sys.stderr)
|
|
772
779
|
sys.exit(1)
|
|
773
780
|
|
|
774
781
|
if not conf.token:
|
|
@@ -784,7 +791,8 @@ def _cmd_sync_comments(args: argparse.Namespace) -> None:
|
|
|
784
791
|
|
|
785
792
|
if not conf.github_token:
|
|
786
793
|
print(
|
|
787
|
-
"error: GitHub token not set. Set GITHUB_TOKEN env var or 'confluence.github_token'
|
|
794
|
+
"error: GitHub token not set. Set GITHUB_TOKEN env var or 'confluence.github_token' "
|
|
795
|
+
f"in {config_path.name}.",
|
|
788
796
|
file=sys.stderr,
|
|
789
797
|
)
|
|
790
798
|
sys.exit(1)
|
{mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/compiler/page.py
RENAMED
|
@@ -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 = (
|
{mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/ir/treeutil.py
RENAMED
|
@@ -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:
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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):
|
{mkdocs2confluence-0.20.5 → mkdocs2confluence-0.22.0}/src/mkdocs_to_confluence/loader/config.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Load and validate mkdocs.yml into a typed MkDocsConfig."""
|
|
1
|
+
"""Load and validate mkdocs.yml / properdocs.yml into a typed MkDocsConfig."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -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
|
|
@@ -142,20 +149,43 @@ def _default_edit_uri(repo_url: str | None) -> str | None:
|
|
|
142
149
|
return None
|
|
143
150
|
|
|
144
151
|
|
|
152
|
+
# Default config files, in lookup order. ProperDocs (a renamed MkDocs fork)
|
|
153
|
+
# reads properdocs.yml first and falls back to mkdocs.yml; we mirror that.
|
|
154
|
+
CONFIG_FILENAMES: tuple[str, ...] = ("properdocs.yml", "mkdocs.yml")
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def find_config(directory: Path) -> Path:
|
|
158
|
+
"""Return the first of :data:`CONFIG_FILENAMES` that exists in *directory*.
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
FileNotFoundError: If none of them exists.
|
|
162
|
+
"""
|
|
163
|
+
for name in CONFIG_FILENAMES:
|
|
164
|
+
candidate = directory / name
|
|
165
|
+
if candidate.is_file():
|
|
166
|
+
return candidate.resolve()
|
|
167
|
+
raise FileNotFoundError(
|
|
168
|
+
f"no {' or '.join(CONFIG_FILENAMES)} found in {directory.resolve()} "
|
|
169
|
+
"(use --config to name the file)"
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
145
173
|
def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
146
174
|
"""Parse *mkdocs_yml* and return a validated :class:`MkDocsConfig`.
|
|
147
175
|
|
|
148
176
|
Args:
|
|
149
|
-
mkdocs_yml: Absolute (or CWD-relative) path to ``mkdocs.yml
|
|
177
|
+
mkdocs_yml: Absolute (or CWD-relative) path to ``mkdocs.yml`` or
|
|
178
|
+
``properdocs.yml`` (same format; see :func:`find_config`).
|
|
150
179
|
|
|
151
180
|
Raises:
|
|
152
181
|
FileNotFoundError: If *mkdocs_yml* does not exist.
|
|
153
182
|
ConfigError: If required fields are absent or have invalid values.
|
|
154
183
|
"""
|
|
155
184
|
mkdocs_yml = Path(mkdocs_yml).resolve()
|
|
185
|
+
cfg_name = mkdocs_yml.name # named in error messages: mkdocs.yml or properdocs.yml
|
|
156
186
|
|
|
157
187
|
if not mkdocs_yml.exists():
|
|
158
|
-
raise FileNotFoundError(f"
|
|
188
|
+
raise FileNotFoundError(f"config file not found: {mkdocs_yml}")
|
|
159
189
|
|
|
160
190
|
with mkdocs_yml.open(encoding="utf-8") as fh:
|
|
161
191
|
# B506 is suppressed below because _make_env_loader() returns a
|
|
@@ -165,22 +195,22 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
165
195
|
raw: object = yaml.load(fh, Loader=_make_env_loader()) # noqa: S506 # nosec B506
|
|
166
196
|
|
|
167
197
|
if not isinstance(raw, dict):
|
|
168
|
-
raise ConfigError("
|
|
198
|
+
raise ConfigError(f"{cfg_name} must be a YAML mapping at the top level.")
|
|
169
199
|
|
|
170
200
|
# --- site_name ---
|
|
171
201
|
site_name = raw.get("site_name")
|
|
172
202
|
if not isinstance(site_name, str) or not site_name.strip():
|
|
173
|
-
raise ConfigError("
|
|
203
|
+
raise ConfigError(f"{cfg_name}: 'site_name' is required and must be a non-empty string.")
|
|
174
204
|
|
|
175
205
|
# --- nav (optional — some projects use awesome-pages or literate-nav plugins) ---
|
|
176
206
|
nav = raw.get("nav")
|
|
177
207
|
if nav is not None and (not isinstance(nav, list) or len(nav) == 0):
|
|
178
|
-
raise ConfigError("
|
|
208
|
+
raise ConfigError(f"{cfg_name}: 'nav' must be a non-empty list when present.")
|
|
179
209
|
|
|
180
210
|
# --- docs_dir (optional; defaults to 'docs' relative to mkdocs.yml) ---
|
|
181
211
|
raw_docs_dir = raw.get("docs_dir", "docs")
|
|
182
212
|
if not isinstance(raw_docs_dir, str):
|
|
183
|
-
raise ConfigError("
|
|
213
|
+
raise ConfigError(f"{cfg_name}: 'docs_dir' must be a string.")
|
|
184
214
|
docs_dir = (mkdocs_yml.parent / raw_docs_dir).resolve()
|
|
185
215
|
|
|
186
216
|
# --- site_url (optional) ---
|
|
@@ -194,13 +224,13 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
194
224
|
if repo_url is not None:
|
|
195
225
|
if not isinstance(repo_url, str) or not _REPO_URL_RE.match(repo_url):
|
|
196
226
|
raise ConfigError(
|
|
197
|
-
"
|
|
227
|
+
f"{cfg_name}: 'repo_url' must be an http/https URL when provided."
|
|
198
228
|
)
|
|
199
229
|
|
|
200
230
|
# --- edit_uri (optional; sensible defaults for GitHub/GitLab) ---
|
|
201
231
|
_raw_edit_uri = raw.get("edit_uri", _default_edit_uri(repo_url))
|
|
202
232
|
if _raw_edit_uri is not None and not isinstance(_raw_edit_uri, str):
|
|
203
|
-
raise ConfigError("
|
|
233
|
+
raise ConfigError(f"{cfg_name}: 'edit_uri' must be a string when provided.")
|
|
204
234
|
edit_uri: str | None = _raw_edit_uri or None
|
|
205
235
|
|
|
206
236
|
# --- confluence (optional) ---
|
|
@@ -216,17 +246,17 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
216
246
|
raw_conf = extra.get("confluence")
|
|
217
247
|
if raw_conf is not None:
|
|
218
248
|
if not isinstance(raw_conf, dict):
|
|
219
|
-
raise ConfigError("
|
|
249
|
+
raise ConfigError(f"{cfg_name}: 'confluence' must be a mapping when present.")
|
|
220
250
|
|
|
221
251
|
base_url = raw_conf.get("base_url")
|
|
222
252
|
if not isinstance(base_url, str) or not base_url.strip():
|
|
223
|
-
raise ConfigError("
|
|
253
|
+
raise ConfigError(f"{cfg_name}: 'confluence.base_url' is required and must be a non-empty string.")
|
|
224
254
|
|
|
225
255
|
# Security: require HTTPS so credentials are never sent in plaintext.
|
|
226
256
|
parsed_url = urlparse(base_url.strip())
|
|
227
257
|
if parsed_url.scheme != "https":
|
|
228
258
|
raise ConfigError(
|
|
229
|
-
"
|
|
259
|
+
f"{cfg_name}: 'confluence.base_url' must use HTTPS (got "
|
|
230
260
|
f"{parsed_url.scheme!r}). Plain HTTP would transmit credentials in "
|
|
231
261
|
"cleartext."
|
|
232
262
|
)
|
|
@@ -239,7 +269,7 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
239
269
|
_is_atlassian = host == "atlassian.net" or host.endswith(".atlassian.net")
|
|
240
270
|
if not _is_atlassian and not allow_any_host:
|
|
241
271
|
raise ConfigError(
|
|
242
|
-
f"
|
|
272
|
+
f"{cfg_name}: 'confluence.base_url' host {host!r} is not an "
|
|
243
273
|
"Atlassian Cloud domain (*.atlassian.net). If you are using a "
|
|
244
274
|
"self-hosted Confluence instance, add 'allow_any_host: true' under "
|
|
245
275
|
"the 'confluence:' block to acknowledge this."
|
|
@@ -256,13 +286,13 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
256
286
|
|
|
257
287
|
if not space_key and not parent_page_id:
|
|
258
288
|
raise ConfigError(
|
|
259
|
-
"
|
|
289
|
+
f"{cfg_name}: 'confluence.space_key' or 'confluence.parent_page_id' is required. "
|
|
260
290
|
"Provide at least one so the publisher can locate the target space."
|
|
261
291
|
)
|
|
262
292
|
|
|
263
293
|
email = raw_conf.get("email")
|
|
264
294
|
if not isinstance(email, str) or not email.strip():
|
|
265
|
-
raise ConfigError("
|
|
295
|
+
raise ConfigError(f"{cfg_name}: 'confluence.email' is required and must be a non-empty string.")
|
|
266
296
|
|
|
267
297
|
# Token lookup order: YAML value → CONFLUENCE_API_TOKEN env → MK2CONF_TOKEN env
|
|
268
298
|
token: str = raw_conf.get("token") or ""
|
|
@@ -282,7 +312,7 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
282
312
|
candidate.relative_to(docs_dir)
|
|
283
313
|
except ValueError:
|
|
284
314
|
raise ConfigError(
|
|
285
|
-
f"
|
|
315
|
+
f"{cfg_name}: 'confluence.changelog' path {cl_str!r} "
|
|
286
316
|
"escapes docs_dir. The path must be relative to the docs directory."
|
|
287
317
|
) from None
|
|
288
318
|
changelog_file = cl_str
|
|
@@ -296,7 +326,7 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
296
326
|
exclude_properties = tuple(str(k) for k in raw_exclude)
|
|
297
327
|
else:
|
|
298
328
|
raise ConfigError(
|
|
299
|
-
"
|
|
329
|
+
f"{cfg_name}: 'confluence.exclude_properties' must be a list of "
|
|
300
330
|
f"front matter keys, got {type(raw_exclude).__name__}."
|
|
301
331
|
)
|
|
302
332
|
|
|
@@ -304,16 +334,32 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
304
334
|
raw_preview = raw_conf.get("attachment_preview", False)
|
|
305
335
|
if not isinstance(raw_preview, bool):
|
|
306
336
|
raise ConfigError(
|
|
307
|
-
"
|
|
337
|
+
f"{cfg_name}: 'confluence.attachment_preview' must be a boolean, "
|
|
308
338
|
f"got {type(raw_preview).__name__}."
|
|
309
339
|
)
|
|
310
340
|
attachment_preview = raw_preview
|
|
311
341
|
|
|
342
|
+
# exclude_attachments (optional) — extensions of linked local files that
|
|
343
|
+
# are never uploaded. Normalised to lowercase with a leading dot.
|
|
344
|
+
raw_excl_att = raw_conf.get("exclude_attachments", list(DEFAULT_EXCLUDE_ATTACHMENTS))
|
|
345
|
+
if raw_excl_att is None:
|
|
346
|
+
raw_excl_att = []
|
|
347
|
+
if not isinstance(raw_excl_att, list) or not all(
|
|
348
|
+
isinstance(ext, str) and ext.strip().lstrip(".") for ext in raw_excl_att
|
|
349
|
+
):
|
|
350
|
+
raise ConfigError(
|
|
351
|
+
f"{cfg_name}: 'confluence.exclude_attachments' must be a list of "
|
|
352
|
+
"file extensions (e.g. ['.yml', '.yaml'])."
|
|
353
|
+
)
|
|
354
|
+
exclude_attachments = tuple(
|
|
355
|
+
"." + ext.strip().lstrip(".").lower() for ext in raw_excl_att
|
|
356
|
+
)
|
|
357
|
+
|
|
312
358
|
# children_macro (optional) — child page list on section index pages
|
|
313
359
|
raw_children = raw_conf.get("children_macro", True)
|
|
314
360
|
if not isinstance(raw_children, bool):
|
|
315
361
|
raise ConfigError(
|
|
316
|
-
"
|
|
362
|
+
f"{cfg_name}: 'confluence.children_macro' must be a boolean, "
|
|
317
363
|
f"got {type(raw_children).__name__}."
|
|
318
364
|
)
|
|
319
365
|
children_macro = raw_children
|
|
@@ -324,18 +370,18 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
324
370
|
raw_admonitions = raw_conf.get("admonitions", {})
|
|
325
371
|
if not isinstance(raw_admonitions, dict):
|
|
326
372
|
raise ConfigError(
|
|
327
|
-
"
|
|
373
|
+
f"{cfg_name}: 'confluence.admonitions' must be a mapping of "
|
|
328
374
|
f"custom kind to built-in kind, got {type(raw_admonitions).__name__}."
|
|
329
375
|
)
|
|
330
376
|
admonitions: dict[str, str] = {}
|
|
331
377
|
for key, value in raw_admonitions.items():
|
|
332
378
|
if not isinstance(key, str) or not key.strip():
|
|
333
379
|
raise ConfigError(
|
|
334
|
-
"
|
|
380
|
+
f"{cfg_name}: 'confluence.admonitions' keys must be non-empty strings."
|
|
335
381
|
)
|
|
336
382
|
if not isinstance(value, str) or not value.strip():
|
|
337
383
|
raise ConfigError(
|
|
338
|
-
f"
|
|
384
|
+
f"{cfg_name}: 'confluence.admonitions.{key}' must be a non-empty "
|
|
339
385
|
"string naming a built-in admonition kind (e.g. 'tip', 'warning')."
|
|
340
386
|
)
|
|
341
387
|
# Admonition kinds are case-insensitive in Markdown; normalise both sides.
|
|
@@ -358,6 +404,7 @@ def load_config(mkdocs_yml: Path) -> MkDocsConfig:
|
|
|
358
404
|
changelog_file=changelog_file,
|
|
359
405
|
exclude_properties=exclude_properties,
|
|
360
406
|
attachment_preview=attachment_preview,
|
|
407
|
+
exclude_attachments=exclude_attachments,
|
|
361
408
|
children_macro=children_macro,
|
|
362
409
|
admonitions=admonitions,
|
|
363
410
|
)
|