mkdocs2confluence 0.5.25__tar.gz → 0.5.26__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.5.26/PKG-INFO +380 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/pyproject.toml +32 -2
- mkdocs2confluence-0.5.26/src/mkdocs2confluence.egg-info/PKG-INFO +380 -0
- mkdocs2confluence-0.5.25/PKG-INFO +0 -20
- mkdocs2confluence-0.5.25/src/mkdocs2confluence.egg-info/PKG-INFO +0 -20
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/LICENSE +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/README.md +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/setup.cfg +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/SOURCES.txt +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/dependency_links.txt +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/entry_points.txt +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/requires.txt +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/top_level.txt +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/cli.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/emitter/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/emitter/xhtml.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/document.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/nodes.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/treeutil.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/config.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/extra_css.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/nav.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/page.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/parser/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/parser/markdown.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/abbrevs.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/fence.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/frontmatter.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/icons.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/includes.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/linkdefs.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preview/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preview/render.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/client.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/pipeline.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/__init__.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/abbrevs.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/assets.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/editlink.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/images.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/internallinks.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/mermaid.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_abbrevs.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_editlink.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_emitter.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_extra_css.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_frontmatter.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_icons.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_images.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_internallinks.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_ir.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_linkdefs.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_loader.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_mermaid.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_page_loader.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_parser.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_preprocess.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_preview.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_publish_client.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_publish_config.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_publish_pipeline.py +0 -0
- {mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/tests/test_treeutil.py +0 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkdocs2confluence
|
|
3
|
+
Version: 0.5.26
|
|
4
|
+
Summary: Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more
|
|
5
|
+
Author: Anders Hybertz
|
|
6
|
+
License: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/jeckyl2010/mkdocs2confluence
|
|
8
|
+
Project-URL: Repository, https://github.com/jeckyl2010/mkdocs2confluence
|
|
9
|
+
Project-URL: Issues, https://github.com/jeckyl2010/mkdocs2confluence/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/jeckyl2010/mkdocs2confluence/releases
|
|
11
|
+
Keywords: mkdocs,confluence,atlassian,documentation,publishing,material-for-mkdocs,markdown,storage-format
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Documentation
|
|
20
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: PyYAML>=6.0.3
|
|
27
|
+
Requires-Dist: httpx>=0.27
|
|
28
|
+
Requires-Dist: tinycss2>=1.5.1
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy; extra == "dev"
|
|
34
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
35
|
+
Requires-Dist: bandit; extra == "dev"
|
|
36
|
+
Requires-Dist: build; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# mk2conf — MkDocs to Confluence
|
|
40
|
+
|
|
41
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
42
|
+
[](https://www.python.org/downloads/)
|
|
43
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/releases/latest)
|
|
44
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/actions/workflows/ci.yml)
|
|
45
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/actions/workflows/release.yml)
|
|
46
|
+
[](https://codecov.io/gh/jeckyl2010/mkdocs2confluence)
|
|
47
|
+
[](https://github.com/astral-sh/ruff)
|
|
48
|
+
[](https://mypy-lang.org/)
|
|
49
|
+
[](https://github.com/PyCQA/bandit)
|
|
50
|
+
|
|
51
|
+
A Python CLI tool that compiles MkDocs-flavoured Markdown into native Confluence storage XHTML and publishes it to Confluence.
|
|
52
|
+
|
|
53
|
+
It is a **compiler/transpiler**, not an HTML converter — every Markdown construct is mapped to the equivalent native Confluence macro or element, so pages look and behave like hand-authored Confluence content.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```mermaid
|
|
60
|
+
flowchart LR
|
|
61
|
+
subgraph Input
|
|
62
|
+
A[mkdocs.yml\nconf config + nav]
|
|
63
|
+
B[Markdown files\n+ assets]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
subgraph Loader
|
|
67
|
+
C[Config loader\nMkDocsConfig\nConfluenceConfig]
|
|
68
|
+
D[Nav resolver\nNavNode tree]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
subgraph Preprocess
|
|
72
|
+
E[Front matter\nIncludes / snippets\nAbbreviations\nIcon shortcodes\nLink definitions]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
subgraph IR
|
|
76
|
+
F[Markdown → IR\nDocument node tree]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
subgraph Transforms
|
|
80
|
+
G[Mermaid → PNG\nInternal links\nAsset paths\nAbbrev expansion\nEdit link\nCSS styles]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
subgraph Emitter
|
|
84
|
+
H[IR → Confluence\nstorage XHTML]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
subgraph Publisher
|
|
88
|
+
I[Plan\ncreate / update / skip\nper nav node]
|
|
89
|
+
J[Execute\nPages · Folders\nStub pages · Assets]
|
|
90
|
+
K[Confluence Cloud\nREST API v2]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
A --> C
|
|
94
|
+
A --> D
|
|
95
|
+
B --> E
|
|
96
|
+
C --> E
|
|
97
|
+
D --> I
|
|
98
|
+
E --> F
|
|
99
|
+
F --> G
|
|
100
|
+
G --> H
|
|
101
|
+
H --> I
|
|
102
|
+
I --> J
|
|
103
|
+
J --> K
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Each stage is a separate Python module under `src/mkdocs_to_confluence/`. The **plan** phase makes all API read calls (find existing pages); the **execute** phase makes all write calls, ensuring parents always exist before children.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
|
|
112
|
+
Requires Python 3.12+.
|
|
113
|
+
|
|
114
|
+
**From PyPI:**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install mkdocs2confluence
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or with `pipx` for an isolated install:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pipx install mkdocs2confluence
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**From source** (see [Setup.md](Setup.md)):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/jeckyl2010/mkdocs2confluence.git
|
|
130
|
+
cd mkdocs2confluence
|
|
131
|
+
pip install -e ".[dev]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Quick start
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Print Confluence storage XHTML to stdout
|
|
140
|
+
mk2conf preview --config mkdocs.yml --page index.md
|
|
141
|
+
|
|
142
|
+
# Open a browser-friendly HTML preview
|
|
143
|
+
mk2conf preview --config mkdocs.yml --page index.md --html --out /tmp/preview.html
|
|
144
|
+
|
|
145
|
+
# Dry-run: see what would be published without touching Confluence
|
|
146
|
+
mk2conf publish --config mkdocs.yml --dry-run
|
|
147
|
+
|
|
148
|
+
# Publish all nav pages to Confluence
|
|
149
|
+
CONFLUENCE_API_TOKEN=your_token mk2conf publish --config mkdocs.yml
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
|
|
156
|
+
### `mk2conf preview`
|
|
157
|
+
|
|
158
|
+
Compile a single page and inspect the output — no network connection required.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
mk2conf preview [--config PATH] --page PATH [--out FILE] [--html]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
| Flag | Default | Description |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `--config PATH` | `./mkdocs.yml` | Path to your `mkdocs.yml` |
|
|
167
|
+
| `--page PATH` | *(required)* | Relative path to the Markdown file |
|
|
168
|
+
| `--out FILE` | stdout | Write output to a file |
|
|
169
|
+
| `--html` | off | Render macros as styled HTML for local browser review |
|
|
170
|
+
|
|
171
|
+
The `--html` flag renders Confluence macros as visual HTML panels so you can review a page locally without a Confluence instance. It is for review only — the actual storage XHTML is always the `--html`-free output.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### `mk2conf publish`
|
|
176
|
+
|
|
177
|
+
Compile all pages listed in `nav:` and publish them to Confluence Cloud.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
mk2conf publish [--config PATH] [--page PATH] [--section PATH] [--dry-run] [--report FILE]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Flag | Default | Description |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| `--config PATH` | `./mkdocs.yml` | Path to your `mkdocs.yml` |
|
|
186
|
+
| `--page PATH` | *(all nav pages)* | Publish a single page only |
|
|
187
|
+
| `--section PATH` | *(whole nav)* | Publish only a nav subtree (e.g. `Guide` or `Guide/Setup`) |
|
|
188
|
+
| `--dry-run` | off | Print the publish plan without making any API calls |
|
|
189
|
+
| `--report FILE` | *(none)* | Write a JSON publish report to `FILE` |
|
|
190
|
+
|
|
191
|
+
#### Configuration
|
|
192
|
+
|
|
193
|
+
Add a `confluence:` block to your `mkdocs.yml`:
|
|
194
|
+
|
|
195
|
+
```yaml
|
|
196
|
+
confluence:
|
|
197
|
+
base_url: https://yourorg.atlassian.net
|
|
198
|
+
space_key: TECH
|
|
199
|
+
email: user@example.com
|
|
200
|
+
token: !ENV CONFLUENCE_API_TOKEN # never hardcode the token
|
|
201
|
+
parent_page_id: "123456" # optional root page
|
|
202
|
+
mermaid_render: kroki # optional: "kroki" (default), "kroki:https://your-kroki" or "none"
|
|
203
|
+
full_width: true # optional: publish pages in full-width layout (default: true)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The API token is read from (in priority order):
|
|
207
|
+
1. The `token:` field in `mkdocs.yml` (typically via `!ENV CONFLUENCE_API_TOKEN`)
|
|
208
|
+
2. `CONFLUENCE_API_TOKEN` environment variable
|
|
209
|
+
3. `MK2CONF_TOKEN` environment variable
|
|
210
|
+
|
|
211
|
+
#### Publish rules
|
|
212
|
+
|
|
213
|
+
- **Only pages in `nav:` are published** — the nav is the publish gate. Pages not listed in the nav are never touched, keeping drafts and WIP content private.
|
|
214
|
+
- Pages with `ready: false` in their YAML front matter are **skipped**, even if listed in the nav.
|
|
215
|
+
- Section nodes (nav groups without a page) become empty parent pages in Confluence, mirroring the nav hierarchy.
|
|
216
|
+
- All locally linked assets are uploaded as Confluence page attachments automatically.
|
|
217
|
+
|
|
218
|
+
#### Mermaid rendering
|
|
219
|
+
|
|
220
|
+
| `mermaid_render` value | Behaviour |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `kroki` *(default)* | Render via `https://kroki.io`. PNGs are cached in `~/.cache/mk2conf/mermaid/`. |
|
|
223
|
+
| `kroki:https://your-kroki` | Render via a self-hosted Kroki instance. |
|
|
224
|
+
| `none` | Skip rendering — fall back to a `code` macro labelled `mermaid`. |
|
|
225
|
+
|
|
226
|
+
If Kroki is unreachable the run continues, falling back to the `code` macro for affected diagrams.
|
|
227
|
+
|
|
228
|
+
#### Styling from extra.css
|
|
229
|
+
|
|
230
|
+
If your `mkdocs.yml` has an `extra_css:` list, mk2conf reads those files and applies a whitelisted set of CSS properties as inline `style="..."` attributes in the Confluence output.
|
|
231
|
+
|
|
232
|
+
| Selector | Applied to |
|
|
233
|
+
|---|---|
|
|
234
|
+
| `th`, `thead th` | Table header cells |
|
|
235
|
+
| `td` | Table body cells |
|
|
236
|
+
| `h1` – `h6` | Headings |
|
|
237
|
+
| `code` (not `pre code`) | Inline code spans |
|
|
238
|
+
|
|
239
|
+
Supported properties: `background-color`, `color`, `font-weight`, `font-style`, `font-size`, `text-align`, `border`.
|
|
240
|
+
|
|
241
|
+
CSS custom properties (`var(--name)`) are resolved automatically, including chained variables and `var(--name, fallback)` syntax.
|
|
242
|
+
|
|
243
|
+
**Works best with simple, flat CSS.** Complex Material for MkDocs theme overrides — compound selectors (`.md-typeset table:not([class]) thead th`), `color-mix()`, `@media` blocks, `:has()` etc. — are silently skipped. For these, maintain a small separate file:
|
|
244
|
+
|
|
245
|
+
```css
|
|
246
|
+
/* confluence-overrides.css */
|
|
247
|
+
:root { --primary: #d20014; }
|
|
248
|
+
th { background-color: var(--primary); color: white; font-weight: 600; }
|
|
249
|
+
h1, h2, h3 { color: var(--primary); }
|
|
250
|
+
code { background-color: #f5f5f5; }
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
extra_css:
|
|
255
|
+
- stylesheets/extra.css # full Material theme
|
|
256
|
+
- stylesheets/confluence-overrides.css # simple Confluence-targeted styles
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Supported Markdown features
|
|
262
|
+
|
|
263
|
+
### Block elements
|
|
264
|
+
|
|
265
|
+
| Feature | Confluence output |
|
|
266
|
+
|---|---|
|
|
267
|
+
| ATX headings `#` – `######` | `<h1>` – `<h6>` |
|
|
268
|
+
| Paragraphs | `<p>` |
|
|
269
|
+
| Fenced code blocks | `code` macro with language, title, and line numbers |
|
|
270
|
+
| Bullet lists | `<ul>/<li>` |
|
|
271
|
+
| Ordered lists | `<ol>/<li>` |
|
|
272
|
+
| Task lists `- [x]` / `- [ ]` | Native `<ac:task-list>` / `<ac:task>` macros |
|
|
273
|
+
| Tables (GFM pipe syntax) | `<table>` with header and column alignment |
|
|
274
|
+
| Blockquotes | `<blockquote>` |
|
|
275
|
+
| Horizontal rules `---` | `<hr/>` |
|
|
276
|
+
|
|
277
|
+
### Inline elements
|
|
278
|
+
|
|
279
|
+
| Feature | Confluence output |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `**bold**` / `__bold__` | `<strong>` |
|
|
282
|
+
| `*italic*` | `<em>` |
|
|
283
|
+
| `~~strikethrough~~` | `<s>` |
|
|
284
|
+
| `` `inline code` `` | `<code>` |
|
|
285
|
+
| `[text](url)` | `<a href="...">` |
|
|
286
|
+
| `[text](file.pdf)` | `<ac:link><ri:attachment .../>` (uploaded as attachment) |
|
|
287
|
+
| `` | `<ac:image>` with `<ri:attachment>` (local) or `<ri:url>` (remote) |
|
|
288
|
+
| `{ width="400" }` | `<ac:image ac:width="400">` — also supports `height` and `align` |
|
|
289
|
+
| `<br>` / `<br/>` | `<br />` |
|
|
290
|
+
| `<sub>` / `<sup>` / `<u>` / `<small>` | Direct XHTML passthrough |
|
|
291
|
+
| `<mark>text</mark>` | `<span style="background-color: yellow;">` |
|
|
292
|
+
| `<kbd>text</kbd>` | `<code>` |
|
|
293
|
+
| `++ctrl+alt+del++` | `<code>Ctrl</code>+<code>Alt</code>+<code>Del</code>` (pymdownx.keys) |
|
|
294
|
+
| `<s>text</s>` / `<del>text</del>` | `<span style="text-decoration: line-through;">` |
|
|
295
|
+
|
|
296
|
+
### MkDocs / Material extensions
|
|
297
|
+
|
|
298
|
+
| Feature | Confluence output |
|
|
299
|
+
|---|---|
|
|
300
|
+
| `--8<--` file includes | Resolved before parsing |
|
|
301
|
+
| Admonitions `!!! type "title"` | `info` / `tip` / `warning` / `note` macro |
|
|
302
|
+
| Danger admonitions (`danger`, `error`, `bug`) | Red `panel` macro with 🚨 prefix |
|
|
303
|
+
| Collapsible admonitions `??? type` | `expand` macro |
|
|
304
|
+
| Content tabs `=== "Label"` | `expand` macros (one per tab) |
|
|
305
|
+
| Details blocks `??? "title"` | `expand` macro |
|
|
306
|
+
| Footnotes `[^1]` | Superscript anchor links + *Footnotes* section at page bottom |
|
|
307
|
+
| Mermaid diagrams | PNG via Kroki, uploaded as attachment (`<ac:image ac:align="center">`) |
|
|
308
|
+
| Internal links `[text](page.md)` | Native Confluence page link; `#fragment` anchors preserved |
|
|
309
|
+
| `awesome-pages` nav (`.pages` files) | Fully supported |
|
|
310
|
+
| Edit link banner | `info` macro linking back to source in GitHub/GitLab |
|
|
311
|
+
|
|
312
|
+
### YAML front matter → Page Properties
|
|
313
|
+
|
|
314
|
+
A YAML front matter block is converted to a Confluence **Page Properties** macro, making it queryable via the Page Properties Report macro.
|
|
315
|
+
|
|
316
|
+
```yaml
|
|
317
|
+
---
|
|
318
|
+
title: "Architecture Proposal – IAM"
|
|
319
|
+
subtitle: "Hybrid Identity Hub"
|
|
320
|
+
documentId: AP-IAM-2026
|
|
321
|
+
version: "0.1"
|
|
322
|
+
lastUpdated: 2026-01-12
|
|
323
|
+
author: "Anders Hybertz"
|
|
324
|
+
tags: [architecture, iam]
|
|
325
|
+
ready: true
|
|
326
|
+
---
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
| Field | Notes |
|
|
330
|
+
|---|---|
|
|
331
|
+
| `title` | Used as the Confluence page title on publish |
|
|
332
|
+
| `subtitle` | Rendered as italic lead paragraph above the properties table |
|
|
333
|
+
| `tags` | Also applied as Confluence page labels |
|
|
334
|
+
| `ready` | `true` → ✅ Ready · `false` → 📝 Draft (skips publish) |
|
|
335
|
+
| `source` | Stripped (internal tooling field) |
|
|
336
|
+
| *other fields* | Title-cased key, value stringified |
|
|
337
|
+
|
|
338
|
+
If `repo_url` + `edit_uri` are set in `mkdocs.yml`, an **Edit Source** row links to the source file. If `site_url` is set, a **Published Page** row links to the rendered MkDocs site.
|
|
339
|
+
|
|
340
|
+
### Abbreviation expansion
|
|
341
|
+
|
|
342
|
+
MkDocs abbreviation definitions (`*[ABBR]: Full term`) are expanded inline — Confluence has no native `<abbr>` tooltip. The **first occurrence** in body text is expanded as `IAM (Identity and Access Management)`; subsequent occurrences are left as-is. Abbreviations that only appear in headings or code are collected into an auto-appended **Glossary** section.
|
|
343
|
+
|
|
344
|
+
### Graceful degradation
|
|
345
|
+
|
|
346
|
+
Any unrecognised block is preserved as a visible `warning` macro — no content is silently lost.
|
|
347
|
+
|
|
348
|
+
`<div class="grid" markdown>` (Material grid cards) has no Confluence equivalent. The wrapper is stripped; inner admonitions render sequentially.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Known limitations
|
|
353
|
+
|
|
354
|
+
| Feature | Behaviour |
|
|
355
|
+
|---|---|
|
|
356
|
+
| **Admonition styling** | Native macros (`tip`, `info`, `warning`, `note`) use Confluence's fixed theme styling — no custom header/body colours. |
|
|
357
|
+
| **Abbreviation tooltips** | No native tooltip support. First occurrence expanded inline; remainder left as-is. |
|
|
358
|
+
| **Grid cards** | Wrapper stripped; inner admonitions rendered individually. |
|
|
359
|
+
| **Page width** | Confluence defaults to a narrow fixed-width column. mk2conf publishes with `fullWidth: true` by default (configurable). |
|
|
360
|
+
| **Page ordering** | Confluence sorts child pages alphabetically. The v2 REST API has no write endpoint for child ordering; nav order cannot be enforced. |
|
|
361
|
+
| **Code language aliases** | Pygments short aliases (`py`, `js`, `yml`, `ts`, `sh`) are passed through as-is; Confluence requires full language names for syntax highlighting. |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Roadmap
|
|
366
|
+
|
|
367
|
+
- [ ] **Delete orphaned pages** — detect and remove Confluence pages that were previously published but have since been removed from `nav:`.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Development
|
|
372
|
+
|
|
373
|
+
See [Setup.md](Setup.md) for environment setup.
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
pytest # run tests
|
|
377
|
+
ruff check src # lint
|
|
378
|
+
mypy src # type-check
|
|
379
|
+
bandit -r src -ll # security scan
|
|
380
|
+
```
|
|
@@ -1,16 +1,46 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mkdocs2confluence"
|
|
3
|
-
version = "0.5.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.5.26"
|
|
4
|
+
description = "Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more"
|
|
5
|
+
readme = "README.md"
|
|
5
6
|
license = { text = "GPL-3.0-or-later" }
|
|
6
7
|
authors = [{ name = "Anders Hybertz" }]
|
|
7
8
|
requires-python = ">=3.12"
|
|
9
|
+
keywords = [
|
|
10
|
+
"mkdocs",
|
|
11
|
+
"confluence",
|
|
12
|
+
"atlassian",
|
|
13
|
+
"documentation",
|
|
14
|
+
"publishing",
|
|
15
|
+
"material-for-mkdocs",
|
|
16
|
+
"markdown",
|
|
17
|
+
"storage-format",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Environment :: Console",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Documentation",
|
|
28
|
+
"Topic :: Software Development :: Documentation",
|
|
29
|
+
"Topic :: Text Processing :: Markup",
|
|
30
|
+
"Topic :: Utilities",
|
|
31
|
+
]
|
|
8
32
|
dependencies = [
|
|
9
33
|
"PyYAML>=6.0.3",
|
|
10
34
|
"httpx>=0.27",
|
|
11
35
|
"tinycss2>=1.5.1",
|
|
12
36
|
]
|
|
13
37
|
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/jeckyl2010/mkdocs2confluence"
|
|
40
|
+
Repository = "https://github.com/jeckyl2010/mkdocs2confluence"
|
|
41
|
+
Issues = "https://github.com/jeckyl2010/mkdocs2confluence/issues"
|
|
42
|
+
Changelog = "https://github.com/jeckyl2010/mkdocs2confluence/releases"
|
|
43
|
+
|
|
14
44
|
[project.optional-dependencies]
|
|
15
45
|
dev = [
|
|
16
46
|
"pytest",
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkdocs2confluence
|
|
3
|
+
Version: 0.5.26
|
|
4
|
+
Summary: Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more
|
|
5
|
+
Author: Anders Hybertz
|
|
6
|
+
License: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/jeckyl2010/mkdocs2confluence
|
|
8
|
+
Project-URL: Repository, https://github.com/jeckyl2010/mkdocs2confluence
|
|
9
|
+
Project-URL: Issues, https://github.com/jeckyl2010/mkdocs2confluence/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/jeckyl2010/mkdocs2confluence/releases
|
|
11
|
+
Keywords: mkdocs,confluence,atlassian,documentation,publishing,material-for-mkdocs,markdown,storage-format
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Documentation
|
|
20
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: PyYAML>=6.0.3
|
|
27
|
+
Requires-Dist: httpx>=0.27
|
|
28
|
+
Requires-Dist: tinycss2>=1.5.1
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy; extra == "dev"
|
|
34
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
35
|
+
Requires-Dist: bandit; extra == "dev"
|
|
36
|
+
Requires-Dist: build; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# mk2conf — MkDocs to Confluence
|
|
40
|
+
|
|
41
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
42
|
+
[](https://www.python.org/downloads/)
|
|
43
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/releases/latest)
|
|
44
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/actions/workflows/ci.yml)
|
|
45
|
+
[](https://github.com/jeckyl2010/mkdocs2confluence/actions/workflows/release.yml)
|
|
46
|
+
[](https://codecov.io/gh/jeckyl2010/mkdocs2confluence)
|
|
47
|
+
[](https://github.com/astral-sh/ruff)
|
|
48
|
+
[](https://mypy-lang.org/)
|
|
49
|
+
[](https://github.com/PyCQA/bandit)
|
|
50
|
+
|
|
51
|
+
A Python CLI tool that compiles MkDocs-flavoured Markdown into native Confluence storage XHTML and publishes it to Confluence.
|
|
52
|
+
|
|
53
|
+
It is a **compiler/transpiler**, not an HTML converter — every Markdown construct is mapped to the equivalent native Confluence macro or element, so pages look and behave like hand-authored Confluence content.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```mermaid
|
|
60
|
+
flowchart LR
|
|
61
|
+
subgraph Input
|
|
62
|
+
A[mkdocs.yml\nconf config + nav]
|
|
63
|
+
B[Markdown files\n+ assets]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
subgraph Loader
|
|
67
|
+
C[Config loader\nMkDocsConfig\nConfluenceConfig]
|
|
68
|
+
D[Nav resolver\nNavNode tree]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
subgraph Preprocess
|
|
72
|
+
E[Front matter\nIncludes / snippets\nAbbreviations\nIcon shortcodes\nLink definitions]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
subgraph IR
|
|
76
|
+
F[Markdown → IR\nDocument node tree]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
subgraph Transforms
|
|
80
|
+
G[Mermaid → PNG\nInternal links\nAsset paths\nAbbrev expansion\nEdit link\nCSS styles]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
subgraph Emitter
|
|
84
|
+
H[IR → Confluence\nstorage XHTML]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
subgraph Publisher
|
|
88
|
+
I[Plan\ncreate / update / skip\nper nav node]
|
|
89
|
+
J[Execute\nPages · Folders\nStub pages · Assets]
|
|
90
|
+
K[Confluence Cloud\nREST API v2]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
A --> C
|
|
94
|
+
A --> D
|
|
95
|
+
B --> E
|
|
96
|
+
C --> E
|
|
97
|
+
D --> I
|
|
98
|
+
E --> F
|
|
99
|
+
F --> G
|
|
100
|
+
G --> H
|
|
101
|
+
H --> I
|
|
102
|
+
I --> J
|
|
103
|
+
J --> K
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Each stage is a separate Python module under `src/mkdocs_to_confluence/`. The **plan** phase makes all API read calls (find existing pages); the **execute** phase makes all write calls, ensuring parents always exist before children.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
|
|
112
|
+
Requires Python 3.12+.
|
|
113
|
+
|
|
114
|
+
**From PyPI:**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install mkdocs2confluence
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or with `pipx` for an isolated install:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pipx install mkdocs2confluence
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**From source** (see [Setup.md](Setup.md)):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/jeckyl2010/mkdocs2confluence.git
|
|
130
|
+
cd mkdocs2confluence
|
|
131
|
+
pip install -e ".[dev]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Quick start
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Print Confluence storage XHTML to stdout
|
|
140
|
+
mk2conf preview --config mkdocs.yml --page index.md
|
|
141
|
+
|
|
142
|
+
# Open a browser-friendly HTML preview
|
|
143
|
+
mk2conf preview --config mkdocs.yml --page index.md --html --out /tmp/preview.html
|
|
144
|
+
|
|
145
|
+
# Dry-run: see what would be published without touching Confluence
|
|
146
|
+
mk2conf publish --config mkdocs.yml --dry-run
|
|
147
|
+
|
|
148
|
+
# Publish all nav pages to Confluence
|
|
149
|
+
CONFLUENCE_API_TOKEN=your_token mk2conf publish --config mkdocs.yml
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
|
|
156
|
+
### `mk2conf preview`
|
|
157
|
+
|
|
158
|
+
Compile a single page and inspect the output — no network connection required.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
mk2conf preview [--config PATH] --page PATH [--out FILE] [--html]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
| Flag | Default | Description |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `--config PATH` | `./mkdocs.yml` | Path to your `mkdocs.yml` |
|
|
167
|
+
| `--page PATH` | *(required)* | Relative path to the Markdown file |
|
|
168
|
+
| `--out FILE` | stdout | Write output to a file |
|
|
169
|
+
| `--html` | off | Render macros as styled HTML for local browser review |
|
|
170
|
+
|
|
171
|
+
The `--html` flag renders Confluence macros as visual HTML panels so you can review a page locally without a Confluence instance. It is for review only — the actual storage XHTML is always the `--html`-free output.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### `mk2conf publish`
|
|
176
|
+
|
|
177
|
+
Compile all pages listed in `nav:` and publish them to Confluence Cloud.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
mk2conf publish [--config PATH] [--page PATH] [--section PATH] [--dry-run] [--report FILE]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Flag | Default | Description |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| `--config PATH` | `./mkdocs.yml` | Path to your `mkdocs.yml` |
|
|
186
|
+
| `--page PATH` | *(all nav pages)* | Publish a single page only |
|
|
187
|
+
| `--section PATH` | *(whole nav)* | Publish only a nav subtree (e.g. `Guide` or `Guide/Setup`) |
|
|
188
|
+
| `--dry-run` | off | Print the publish plan without making any API calls |
|
|
189
|
+
| `--report FILE` | *(none)* | Write a JSON publish report to `FILE` |
|
|
190
|
+
|
|
191
|
+
#### Configuration
|
|
192
|
+
|
|
193
|
+
Add a `confluence:` block to your `mkdocs.yml`:
|
|
194
|
+
|
|
195
|
+
```yaml
|
|
196
|
+
confluence:
|
|
197
|
+
base_url: https://yourorg.atlassian.net
|
|
198
|
+
space_key: TECH
|
|
199
|
+
email: user@example.com
|
|
200
|
+
token: !ENV CONFLUENCE_API_TOKEN # never hardcode the token
|
|
201
|
+
parent_page_id: "123456" # optional root page
|
|
202
|
+
mermaid_render: kroki # optional: "kroki" (default), "kroki:https://your-kroki" or "none"
|
|
203
|
+
full_width: true # optional: publish pages in full-width layout (default: true)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The API token is read from (in priority order):
|
|
207
|
+
1. The `token:` field in `mkdocs.yml` (typically via `!ENV CONFLUENCE_API_TOKEN`)
|
|
208
|
+
2. `CONFLUENCE_API_TOKEN` environment variable
|
|
209
|
+
3. `MK2CONF_TOKEN` environment variable
|
|
210
|
+
|
|
211
|
+
#### Publish rules
|
|
212
|
+
|
|
213
|
+
- **Only pages in `nav:` are published** — the nav is the publish gate. Pages not listed in the nav are never touched, keeping drafts and WIP content private.
|
|
214
|
+
- Pages with `ready: false` in their YAML front matter are **skipped**, even if listed in the nav.
|
|
215
|
+
- Section nodes (nav groups without a page) become empty parent pages in Confluence, mirroring the nav hierarchy.
|
|
216
|
+
- All locally linked assets are uploaded as Confluence page attachments automatically.
|
|
217
|
+
|
|
218
|
+
#### Mermaid rendering
|
|
219
|
+
|
|
220
|
+
| `mermaid_render` value | Behaviour |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `kroki` *(default)* | Render via `https://kroki.io`. PNGs are cached in `~/.cache/mk2conf/mermaid/`. |
|
|
223
|
+
| `kroki:https://your-kroki` | Render via a self-hosted Kroki instance. |
|
|
224
|
+
| `none` | Skip rendering — fall back to a `code` macro labelled `mermaid`. |
|
|
225
|
+
|
|
226
|
+
If Kroki is unreachable the run continues, falling back to the `code` macro for affected diagrams.
|
|
227
|
+
|
|
228
|
+
#### Styling from extra.css
|
|
229
|
+
|
|
230
|
+
If your `mkdocs.yml` has an `extra_css:` list, mk2conf reads those files and applies a whitelisted set of CSS properties as inline `style="..."` attributes in the Confluence output.
|
|
231
|
+
|
|
232
|
+
| Selector | Applied to |
|
|
233
|
+
|---|---|
|
|
234
|
+
| `th`, `thead th` | Table header cells |
|
|
235
|
+
| `td` | Table body cells |
|
|
236
|
+
| `h1` – `h6` | Headings |
|
|
237
|
+
| `code` (not `pre code`) | Inline code spans |
|
|
238
|
+
|
|
239
|
+
Supported properties: `background-color`, `color`, `font-weight`, `font-style`, `font-size`, `text-align`, `border`.
|
|
240
|
+
|
|
241
|
+
CSS custom properties (`var(--name)`) are resolved automatically, including chained variables and `var(--name, fallback)` syntax.
|
|
242
|
+
|
|
243
|
+
**Works best with simple, flat CSS.** Complex Material for MkDocs theme overrides — compound selectors (`.md-typeset table:not([class]) thead th`), `color-mix()`, `@media` blocks, `:has()` etc. — are silently skipped. For these, maintain a small separate file:
|
|
244
|
+
|
|
245
|
+
```css
|
|
246
|
+
/* confluence-overrides.css */
|
|
247
|
+
:root { --primary: #d20014; }
|
|
248
|
+
th { background-color: var(--primary); color: white; font-weight: 600; }
|
|
249
|
+
h1, h2, h3 { color: var(--primary); }
|
|
250
|
+
code { background-color: #f5f5f5; }
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
extra_css:
|
|
255
|
+
- stylesheets/extra.css # full Material theme
|
|
256
|
+
- stylesheets/confluence-overrides.css # simple Confluence-targeted styles
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Supported Markdown features
|
|
262
|
+
|
|
263
|
+
### Block elements
|
|
264
|
+
|
|
265
|
+
| Feature | Confluence output |
|
|
266
|
+
|---|---|
|
|
267
|
+
| ATX headings `#` – `######` | `<h1>` – `<h6>` |
|
|
268
|
+
| Paragraphs | `<p>` |
|
|
269
|
+
| Fenced code blocks | `code` macro with language, title, and line numbers |
|
|
270
|
+
| Bullet lists | `<ul>/<li>` |
|
|
271
|
+
| Ordered lists | `<ol>/<li>` |
|
|
272
|
+
| Task lists `- [x]` / `- [ ]` | Native `<ac:task-list>` / `<ac:task>` macros |
|
|
273
|
+
| Tables (GFM pipe syntax) | `<table>` with header and column alignment |
|
|
274
|
+
| Blockquotes | `<blockquote>` |
|
|
275
|
+
| Horizontal rules `---` | `<hr/>` |
|
|
276
|
+
|
|
277
|
+
### Inline elements
|
|
278
|
+
|
|
279
|
+
| Feature | Confluence output |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `**bold**` / `__bold__` | `<strong>` |
|
|
282
|
+
| `*italic*` | `<em>` |
|
|
283
|
+
| `~~strikethrough~~` | `<s>` |
|
|
284
|
+
| `` `inline code` `` | `<code>` |
|
|
285
|
+
| `[text](url)` | `<a href="...">` |
|
|
286
|
+
| `[text](file.pdf)` | `<ac:link><ri:attachment .../>` (uploaded as attachment) |
|
|
287
|
+
| `` | `<ac:image>` with `<ri:attachment>` (local) or `<ri:url>` (remote) |
|
|
288
|
+
| `{ width="400" }` | `<ac:image ac:width="400">` — also supports `height` and `align` |
|
|
289
|
+
| `<br>` / `<br/>` | `<br />` |
|
|
290
|
+
| `<sub>` / `<sup>` / `<u>` / `<small>` | Direct XHTML passthrough |
|
|
291
|
+
| `<mark>text</mark>` | `<span style="background-color: yellow;">` |
|
|
292
|
+
| `<kbd>text</kbd>` | `<code>` |
|
|
293
|
+
| `++ctrl+alt+del++` | `<code>Ctrl</code>+<code>Alt</code>+<code>Del</code>` (pymdownx.keys) |
|
|
294
|
+
| `<s>text</s>` / `<del>text</del>` | `<span style="text-decoration: line-through;">` |
|
|
295
|
+
|
|
296
|
+
### MkDocs / Material extensions
|
|
297
|
+
|
|
298
|
+
| Feature | Confluence output |
|
|
299
|
+
|---|---|
|
|
300
|
+
| `--8<--` file includes | Resolved before parsing |
|
|
301
|
+
| Admonitions `!!! type "title"` | `info` / `tip` / `warning` / `note` macro |
|
|
302
|
+
| Danger admonitions (`danger`, `error`, `bug`) | Red `panel` macro with 🚨 prefix |
|
|
303
|
+
| Collapsible admonitions `??? type` | `expand` macro |
|
|
304
|
+
| Content tabs `=== "Label"` | `expand` macros (one per tab) |
|
|
305
|
+
| Details blocks `??? "title"` | `expand` macro |
|
|
306
|
+
| Footnotes `[^1]` | Superscript anchor links + *Footnotes* section at page bottom |
|
|
307
|
+
| Mermaid diagrams | PNG via Kroki, uploaded as attachment (`<ac:image ac:align="center">`) |
|
|
308
|
+
| Internal links `[text](page.md)` | Native Confluence page link; `#fragment` anchors preserved |
|
|
309
|
+
| `awesome-pages` nav (`.pages` files) | Fully supported |
|
|
310
|
+
| Edit link banner | `info` macro linking back to source in GitHub/GitLab |
|
|
311
|
+
|
|
312
|
+
### YAML front matter → Page Properties
|
|
313
|
+
|
|
314
|
+
A YAML front matter block is converted to a Confluence **Page Properties** macro, making it queryable via the Page Properties Report macro.
|
|
315
|
+
|
|
316
|
+
```yaml
|
|
317
|
+
---
|
|
318
|
+
title: "Architecture Proposal – IAM"
|
|
319
|
+
subtitle: "Hybrid Identity Hub"
|
|
320
|
+
documentId: AP-IAM-2026
|
|
321
|
+
version: "0.1"
|
|
322
|
+
lastUpdated: 2026-01-12
|
|
323
|
+
author: "Anders Hybertz"
|
|
324
|
+
tags: [architecture, iam]
|
|
325
|
+
ready: true
|
|
326
|
+
---
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
| Field | Notes |
|
|
330
|
+
|---|---|
|
|
331
|
+
| `title` | Used as the Confluence page title on publish |
|
|
332
|
+
| `subtitle` | Rendered as italic lead paragraph above the properties table |
|
|
333
|
+
| `tags` | Also applied as Confluence page labels |
|
|
334
|
+
| `ready` | `true` → ✅ Ready · `false` → 📝 Draft (skips publish) |
|
|
335
|
+
| `source` | Stripped (internal tooling field) |
|
|
336
|
+
| *other fields* | Title-cased key, value stringified |
|
|
337
|
+
|
|
338
|
+
If `repo_url` + `edit_uri` are set in `mkdocs.yml`, an **Edit Source** row links to the source file. If `site_url` is set, a **Published Page** row links to the rendered MkDocs site.
|
|
339
|
+
|
|
340
|
+
### Abbreviation expansion
|
|
341
|
+
|
|
342
|
+
MkDocs abbreviation definitions (`*[ABBR]: Full term`) are expanded inline — Confluence has no native `<abbr>` tooltip. The **first occurrence** in body text is expanded as `IAM (Identity and Access Management)`; subsequent occurrences are left as-is. Abbreviations that only appear in headings or code are collected into an auto-appended **Glossary** section.
|
|
343
|
+
|
|
344
|
+
### Graceful degradation
|
|
345
|
+
|
|
346
|
+
Any unrecognised block is preserved as a visible `warning` macro — no content is silently lost.
|
|
347
|
+
|
|
348
|
+
`<div class="grid" markdown>` (Material grid cards) has no Confluence equivalent. The wrapper is stripped; inner admonitions render sequentially.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Known limitations
|
|
353
|
+
|
|
354
|
+
| Feature | Behaviour |
|
|
355
|
+
|---|---|
|
|
356
|
+
| **Admonition styling** | Native macros (`tip`, `info`, `warning`, `note`) use Confluence's fixed theme styling — no custom header/body colours. |
|
|
357
|
+
| **Abbreviation tooltips** | No native tooltip support. First occurrence expanded inline; remainder left as-is. |
|
|
358
|
+
| **Grid cards** | Wrapper stripped; inner admonitions rendered individually. |
|
|
359
|
+
| **Page width** | Confluence defaults to a narrow fixed-width column. mk2conf publishes with `fullWidth: true` by default (configurable). |
|
|
360
|
+
| **Page ordering** | Confluence sorts child pages alphabetically. The v2 REST API has no write endpoint for child ordering; nav order cannot be enforced. |
|
|
361
|
+
| **Code language aliases** | Pygments short aliases (`py`, `js`, `yml`, `ts`, `sh`) are passed through as-is; Confluence requires full language names for syntax highlighting. |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Roadmap
|
|
366
|
+
|
|
367
|
+
- [ ] **Delete orphaned pages** — detect and remove Confluence pages that were previously published but have since been removed from `nav:`.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Development
|
|
372
|
+
|
|
373
|
+
See [Setup.md](Setup.md) for environment setup.
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
pytest # run tests
|
|
377
|
+
ruff check src # lint
|
|
378
|
+
mypy src # type-check
|
|
379
|
+
bandit -r src -ll # security scan
|
|
380
|
+
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mkdocs2confluence
|
|
3
|
-
Version: 0.5.25
|
|
4
|
-
Summary: Compile MkDocs markdown to Confluence storage format
|
|
5
|
-
Author: Anders Hybertz
|
|
6
|
-
License: GPL-3.0-or-later
|
|
7
|
-
Requires-Python: >=3.12
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: PyYAML>=6.0.3
|
|
10
|
-
Requires-Dist: httpx>=0.27
|
|
11
|
-
Requires-Dist: tinycss2>=1.5.1
|
|
12
|
-
Provides-Extra: dev
|
|
13
|
-
Requires-Dist: pytest; extra == "dev"
|
|
14
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
15
|
-
Requires-Dist: ruff; extra == "dev"
|
|
16
|
-
Requires-Dist: mypy; extra == "dev"
|
|
17
|
-
Requires-Dist: types-PyYAML; extra == "dev"
|
|
18
|
-
Requires-Dist: bandit; extra == "dev"
|
|
19
|
-
Requires-Dist: build; extra == "dev"
|
|
20
|
-
Dynamic: license-file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mkdocs2confluence
|
|
3
|
-
Version: 0.5.25
|
|
4
|
-
Summary: Compile MkDocs markdown to Confluence storage format
|
|
5
|
-
Author: Anders Hybertz
|
|
6
|
-
License: GPL-3.0-or-later
|
|
7
|
-
Requires-Python: >=3.12
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: PyYAML>=6.0.3
|
|
10
|
-
Requires-Dist: httpx>=0.27
|
|
11
|
-
Requires-Dist: tinycss2>=1.5.1
|
|
12
|
-
Provides-Extra: dev
|
|
13
|
-
Requires-Dist: pytest; extra == "dev"
|
|
14
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
15
|
-
Requires-Dist: ruff; extra == "dev"
|
|
16
|
-
Requires-Dist: mypy; extra == "dev"
|
|
17
|
-
Requires-Dist: types-PyYAML; extra == "dev"
|
|
18
|
-
Requires-Dist: bandit; extra == "dev"
|
|
19
|
-
Requires-Dist: build; extra == "dev"
|
|
20
|
-
Dynamic: license-file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/requires.txt
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs2confluence.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/emitter/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/emitter/xhtml.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/document.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/ir/treeutil.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/config.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/extra_css.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/nav.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/loader/page.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/parser/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/parser/markdown.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/abbrevs.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/fence.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preprocess/icons.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preview/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/preview/render.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/__init__.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/client.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/publisher/pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/abbrevs.py
RENAMED
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/assets.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/images.py
RENAMED
|
File without changes
|
|
File without changes
|
{mkdocs2confluence-0.5.25 → mkdocs2confluence-0.5.26}/src/mkdocs_to_confluence/transforms/mermaid.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|