markdown-to-confluence 0.4.0__tar.gz → 0.4.2__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.
- markdown_to_confluence-0.4.2/MANIFEST.in +8 -0
- {markdown_to_confluence-0.4.0/markdown_to_confluence.egg-info → markdown_to_confluence-0.4.2}/PKG-INFO +133 -43
- markdown_to_confluence-0.4.0/PKG-INFO → markdown_to_confluence-0.4.2/README.md +116 -68
- markdown_to_confluence-0.4.0/README.md → markdown_to_confluence-0.4.2/markdown_to_confluence.egg-info/PKG-INFO +158 -32
- markdown_to_confluence-0.4.2/markdown_to_confluence.egg-info/SOURCES.txt +77 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/markdown_to_confluence.egg-info/requires.txt +12 -5
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/__init__.py +1 -1
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/__main__.py +57 -18
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/api.py +242 -125
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/application.py +40 -48
- markdown_to_confluence-0.4.2/md2conf/collection.py +37 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/converter.py +540 -107
- markdown_to_confluence-0.4.2/md2conf/drawio.py +222 -0
- markdown_to_confluence-0.4.2/md2conf/extra.py +27 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/local.py +5 -12
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/matcher.py +64 -7
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/mermaid.py +2 -7
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/metadata.py +2 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/processor.py +48 -57
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/properties.py +45 -12
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/scanner.py +17 -9
- markdown_to_confluence-0.4.2/md2conf/xml.py +70 -0
- markdown_to_confluence-0.4.2/pyproject.toml +76 -0
- markdown_to_confluence-0.4.2/setup.cfg +4 -0
- markdown_to_confluence-0.4.2/tests/__init__.py +0 -0
- markdown_to_confluence-0.4.2/tests/source/admonition.md +20 -0
- markdown_to_confluence-0.4.2/tests/source/alert.md +56 -0
- markdown_to_confluence-0.4.2/tests/source/anchors.md +13 -0
- markdown_to_confluence-0.4.2/tests/source/basic.md +65 -0
- markdown_to_confluence-0.4.2/tests/source/code.md +38 -0
- markdown_to_confluence-0.4.2/tests/source/collapsed.md +24 -0
- markdown_to_confluence-0.4.2/tests/source/fenced.md +25 -0
- markdown_to_confluence-0.4.2/tests/source/figure/diagram.drawio +19 -0
- markdown_to_confluence-0.4.2/tests/source/figure/diagram.drawio.png +0 -0
- markdown_to_confluence-0.4.2/tests/source/figure/diagram.drawio.svg +4 -0
- markdown_to_confluence-0.4.2/tests/source/figure/raster.png +0 -0
- markdown_to_confluence-0.4.2/tests/source/figure/vector.svg +4 -0
- markdown_to_confluence-0.4.2/tests/source/footnote.md +8 -0
- markdown_to_confluence-0.4.2/tests/source/ignore.md +3 -0
- markdown_to_confluence-0.4.2/tests/source/images/images.md +5 -0
- markdown_to_confluence-0.4.2/tests/source/images.md +15 -0
- markdown_to_confluence-0.4.2/tests/source/math.md +15 -0
- markdown_to_confluence-0.4.2/tests/source/mermaid.md +135 -0
- markdown_to_confluence-0.4.2/tests/source/missing.md +7 -0
- markdown_to_confluence-0.4.2/tests/source/sections.md +18 -0
- markdown_to_confluence-0.4.2/tests/source/tags.md +21 -0
- markdown_to_confluence-0.4.2/tests/source/title.md +19 -0
- markdown_to_confluence-0.4.2/tests/target/admonition.xml +37 -0
- markdown_to_confluence-0.4.2/tests/target/alert.xml +67 -0
- markdown_to_confluence-0.4.2/tests/target/anchors.xml +11 -0
- markdown_to_confluence-0.4.2/tests/target/basic.xml +59 -0
- markdown_to_confluence-0.4.2/tests/target/code.xml +39 -0
- markdown_to_confluence-0.4.2/tests/target/collapsed.xml +25 -0
- markdown_to_confluence-0.4.2/tests/target/fenced.xml +32 -0
- markdown_to_confluence-0.4.2/tests/target/footnote.xml +18 -0
- markdown_to_confluence-0.4.2/tests/target/images/images.xml +12 -0
- markdown_to_confluence-0.4.2/tests/target/images.xml +39 -0
- markdown_to_confluence-0.4.2/tests/target/math.xml +17 -0
- markdown_to_confluence-0.4.2/tests/target/mermaid.xml +113 -0
- markdown_to_confluence-0.4.2/tests/target/missing.xml +13 -0
- markdown_to_confluence-0.4.2/tests/target/sections.xml +11 -0
- markdown_to_confluence-0.4.2/tests/target/tags.xml +31 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/tests/test_conversion.py +29 -14
- markdown_to_confluence-0.4.2/tests/test_drawio.py +53 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/tests/test_matcher.py +28 -14
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/tests/test_processor.py +2 -6
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/tests/test_scanner.py +1 -3
- markdown_to_confluence-0.4.2/tests/test_unit.py +42 -0
- markdown_to_confluence-0.4.0/markdown_to_confluence.egg-info/SOURCES.txt +0 -35
- markdown_to_confluence-0.4.0/md2conf/collection.py +0 -31
- markdown_to_confluence-0.4.0/md2conf/extra.py +0 -14
- markdown_to_confluence-0.4.0/pyproject.toml +0 -3
- markdown_to_confluence-0.4.0/setup.cfg +0 -64
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/LICENSE +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/markdown_to_confluence.egg-info/top_level.txt +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/markdown_to_confluence.egg-info/zip-safe +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/emoji.py +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/entities.dtd +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/puppeteer-config.json +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/md2conf/py.typed +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/setup.py +0 -0
- {markdown_to_confluence-0.4.0 → markdown_to_confluence-0.4.2}/tests/test_mermaid.py +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Publish Markdown files to Confluence wiki
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
6
|
+
Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/hunyadi/md2conf
|
|
9
|
+
Project-URL: Source, https://github.com/hunyadi/md2conf
|
|
10
|
+
Keywords: markdown,converter,confluence
|
|
9
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
12
|
Classifier: Environment :: Console
|
|
11
13
|
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
14
|
Classifier: Operating System :: OS Independent
|
|
14
15
|
Classifier: Programming Language :: Python :: 3
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -17,21 +18,26 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
22
|
Classifier: Typing :: Typed
|
|
21
23
|
Requires-Python: >=3.9
|
|
22
24
|
Description-Content-Type: text/markdown
|
|
23
25
|
License-File: LICENSE
|
|
24
26
|
Requires-Dist: json_strong_typing>=0.3.9
|
|
25
|
-
Requires-Dist: lxml>=
|
|
26
|
-
Requires-Dist: types-lxml>=2025.3.30
|
|
27
|
+
Requires-Dist: lxml>=6.0
|
|
27
28
|
Requires-Dist: markdown>=3.8
|
|
28
|
-
Requires-Dist: types-markdown>=3.8
|
|
29
29
|
Requires-Dist: pymdown-extensions>=10.16
|
|
30
30
|
Requires-Dist: PyYAML>=6.0
|
|
31
|
-
Requires-Dist: types-PyYAML>=6.0
|
|
32
31
|
Requires-Dist: requests>=2.32
|
|
33
|
-
Requires-Dist: types-requests>=2.32
|
|
34
32
|
Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
|
|
35
|
+
Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
|
|
36
|
+
Requires-Dist: types-markdown>=3.8; extra == "dev"
|
|
37
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
38
|
+
Requires-Dist: types-requests>=2.32; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=1.16; extra == "dev"
|
|
40
|
+
Requires-Dist: ruff>=0.12; extra == "dev"
|
|
35
41
|
Dynamic: license-file
|
|
36
42
|
|
|
37
43
|
# Publish Markdown files to Confluence wiki
|
|
@@ -52,16 +58,19 @@ This Python package
|
|
|
52
58
|
* Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
|
|
53
59
|
* Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
|
|
54
60
|
* Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
|
|
61
|
+
* Math formulas with LaTeX notation [^math]
|
|
55
62
|
* Emoji
|
|
56
63
|
* Ordered and unordered lists
|
|
57
64
|
* Block quotes
|
|
58
65
|
* Code blocks (e.g. Python, JSON, XML)
|
|
59
66
|
* Images (uploaded as Confluence page attachments or hosted externally)
|
|
60
67
|
* Tables
|
|
68
|
+
* Footnotes
|
|
61
69
|
* [Table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents)
|
|
62
70
|
* [Admonitions](https://python-markdown.github.io/extensions/admonition/) and alert boxes in [GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) and [GitLab](https://docs.gitlab.com/ee/development/documentation/styleguide/#alert-boxes)
|
|
63
71
|
* [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
|
|
64
|
-
*
|
|
72
|
+
* draw\.io diagrams [^drawio]
|
|
73
|
+
* [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images) [^mermaid]
|
|
65
74
|
|
|
66
75
|
Whenever possible, the implementation uses [Confluence REST API v2](https://developer.atlassian.com/cloud/confluence/rest/v2/) to fetch space properties, and get, create or update page content.
|
|
67
76
|
|
|
@@ -73,12 +82,26 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
|
|
|
73
82
|
pip install markdown-to-confluence
|
|
74
83
|
```
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
### Command-line utilities
|
|
86
|
+
|
|
87
|
+
**Optional.** Converting `*.drawio` diagrams into PNG or SVG images requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
|
|
88
|
+
|
|
89
|
+
**Optional.** Converting code blocks of Mermaid diagrams into PNG or SVG images requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
|
|
77
90
|
|
|
78
91
|
```sh
|
|
79
92
|
npm install -g @mermaid-js/mermaid-cli
|
|
80
93
|
```
|
|
81
94
|
|
|
95
|
+
### Marketplace apps
|
|
96
|
+
|
|
97
|
+
As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
|
|
98
|
+
|
|
99
|
+
**Optional.** Editable draw\.io diagrams require [draw.io Diagrams marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts). (Refer to `--no-render-drawio`.)
|
|
100
|
+
|
|
101
|
+
**Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering requires a marketplace app. (Refer to `--no-render-mermaid`.)
|
|
102
|
+
|
|
103
|
+
**Optional.** Displaying formulas and equations requires [LaTeX Math marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations).
|
|
104
|
+
|
|
82
105
|
## Getting started
|
|
83
106
|
|
|
84
107
|
In order to get started, you will need
|
|
@@ -146,7 +169,7 @@ If you lack appropriate permissions, you will get an *Unauthorized* response fro
|
|
|
146
169
|
Each Markdown file is associated with a Confluence wiki page with a Markdown comment:
|
|
147
170
|
|
|
148
171
|
```markdown
|
|
149
|
-
<!-- confluence-page-id:
|
|
172
|
+
<!-- confluence-page-id: 20250001023 -->
|
|
150
173
|
```
|
|
151
174
|
|
|
152
175
|
The above tells the tool to synchronize the Markdown file with the given Confluence page ID. This implies that the Confluence wiki page must exist such that it has an ID. The comment can be placed anywhere in the source file.
|
|
@@ -187,24 +210,28 @@ First, *md2conf* builds an index of pages in the directory hierarchy. The index
|
|
|
187
210
|
|
|
188
211
|
If a Markdown file doesn't yet pair up with a Confluence page, *md2conf* creates a new page and assigns a parent. Parent-child relationships are reflected in the navigation panel in Confluence. You can set a root page ID with the command-line option `-r`, which constitutes the topmost parent. (This could correspond to the landing page of your Confluence space. The Confluence page ID is always revealed when you edit a page.) Whenever a directory contains the file `index.md` or `README.md`, this page becomes the future parent page, and all Markdown files in this directory (and possibly nested directories) become its child pages (unless they already have a page ID). However, if an `index.md` or `README.md` file is subsequently found in one of the nested directories, it becomes the parent page of that directory, and any of its subdirectories.
|
|
189
212
|
|
|
213
|
+
The top-level directory to be synchronized must always have an `index.md` or `README.md`, which maps to the root of the corresponding sub-tree in Confluence (specified with `-r`).
|
|
214
|
+
|
|
190
215
|
The concepts above are illustrated in the following sections.
|
|
191
216
|
|
|
192
217
|
#### File-system directory hierarchy
|
|
193
218
|
|
|
194
|
-
The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name.
|
|
219
|
+
The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name. `docs` is the top-level directory to be synchronized.
|
|
195
220
|
|
|
196
221
|
```
|
|
197
|
-
|
|
222
|
+
docs
|
|
223
|
+
├── index.md: Root page
|
|
198
224
|
├── computer-science
|
|
199
225
|
│ ├── index.md: Introduction to computer science
|
|
200
226
|
│ ├── algebra.md: Linear algebra
|
|
201
227
|
│ └── algorithms.md: Theory of algorithms
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
228
|
+
├── machine-learning
|
|
229
|
+
│ ├── README.md: AI and ML
|
|
230
|
+
│ ├── awareness.md: Consciousness and intelligence
|
|
231
|
+
│ └── statistics
|
|
232
|
+
│ ├── index.md: Introduction to statistics
|
|
233
|
+
│ └── median.md: Mean vs. median
|
|
234
|
+
└── ethics.md: Ethical considerations
|
|
208
235
|
```
|
|
209
236
|
|
|
210
237
|
#### Page hierarchy in Confluence
|
|
@@ -212,14 +239,15 @@ The title of each Markdown file (either the text of the topmost unique heading (
|
|
|
212
239
|
Observe how `index.md` and `README.md` files have assumed parent (or ancestor) role for any Markdown files in the same directory (or below).
|
|
213
240
|
|
|
214
241
|
```
|
|
215
|
-
|
|
242
|
+
Root page
|
|
216
243
|
├── Introduction to computer science
|
|
217
244
|
│ ├── Linear algebra
|
|
218
245
|
│ └── Theory of algorithms
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
├── AI and ML
|
|
247
|
+
│ ├── Consciousness and intelligence
|
|
248
|
+
│ └── Introduction to statistics
|
|
249
|
+
│ └── Mean vs. median
|
|
250
|
+
└── Ethical considerations
|
|
223
251
|
```
|
|
224
252
|
|
|
225
253
|
### Emoji
|
|
@@ -293,6 +321,25 @@ Unfortunately, Confluence struggles with SVG images, e.g. they may only show in
|
|
|
293
321
|
|
|
294
322
|
External images referenced with an absolute URL retain the original URL.
|
|
295
323
|
|
|
324
|
+
### LaTeX math formulas
|
|
325
|
+
|
|
326
|
+
Inline formulas can be enclosed with `$` signs, or delimited with `\(` and `\)`, i.e.
|
|
327
|
+
|
|
328
|
+
* the code `$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$` is shown as $\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$,
|
|
329
|
+
* and `\(\lim _{x\rightarrow \infty }\frac{1}{x}=0\)` is shown as $\lim _{x\rightarrow \infty }\frac{1}{x}=0$.
|
|
330
|
+
|
|
331
|
+
Block formulas can be enclosed with `$$`, or wrapped in code blocks specifying the language `math`:
|
|
332
|
+
|
|
333
|
+
```md
|
|
334
|
+
$$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
is shown as
|
|
338
|
+
|
|
339
|
+
$$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
|
|
340
|
+
|
|
341
|
+
Displaying math formulas in Confluence requires the extension [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
|
|
342
|
+
|
|
296
343
|
### Ignoring files
|
|
297
344
|
|
|
298
345
|
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax (and constraints) of [fnmatch](https://docs.python.org/3/library/fnmatch.html#fnmatch.fnmatch). Specifically, `?` matches any single character, and `*` matches zero or more characters. For example, use `up-*.md` to exclude Markdown files that start with `up-`. Lines that start with `#` are treated as comments.
|
|
@@ -301,6 +348,20 @@ Files that don't have the extension `*.md` are skipped automatically. Hidden dir
|
|
|
301
348
|
|
|
302
349
|
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
303
350
|
|
|
351
|
+
If you add the `synchronized` attribute to JSON or YAML front-matter with the value `false`, the document content (including attachments) and metadata (e.g. tags) will not be synchronized with Confluence:
|
|
352
|
+
|
|
353
|
+
```yaml
|
|
354
|
+
---
|
|
355
|
+
title: "Collaborating with other teams"
|
|
356
|
+
page_id: "19830101"
|
|
357
|
+
synchronized: false
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
This Markdown document is neither parsed, nor synchronized with Confluence.
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
This is useful if you have a page in a hierarchy that participates in parent-child relationships but whose content is edited directly in Confluence. Specifically, these documents can be referenced with relative links from other Markdown documents in the file system tree.
|
|
364
|
+
|
|
304
365
|
### Page title
|
|
305
366
|
|
|
306
367
|
*md2conf* makes a best-effort attempt at setting the Confluence wiki page title when it publishes a Markdown document the first time. The following are probed in this order:
|
|
@@ -326,12 +387,34 @@ Any previously assigned labels are discarded. As per Confluence terminology, new
|
|
|
326
387
|
|
|
327
388
|
If a document has no `tags` attribute, existing Confluence labels are left intact.
|
|
328
389
|
|
|
329
|
-
###
|
|
390
|
+
### Content properties
|
|
391
|
+
|
|
392
|
+
The front-matter attribute `properties` in a Markdown document allows setting Confluence content properties on a page. Confluence content properties are a way to store structured metadata in the form of key-value pairs directly on Confluence content. The values in content properties are represented as JSON objects.
|
|
393
|
+
|
|
394
|
+
Some content properties have special meaning to Confluence. For example, the following properties cause Confluence to display a wiki page with content confined to a fixed width in regular view mode, and taking the full page width in draft mode:
|
|
395
|
+
|
|
396
|
+
```yaml
|
|
397
|
+
---
|
|
398
|
+
properties:
|
|
399
|
+
content-appearance-published: fixed-width
|
|
400
|
+
content-appearance-draft: full-width
|
|
401
|
+
---
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The attribute `properties` is parsed as a dictionary with keys of type string and values of type JSON. *md2conf* passes JSON values to Confluence REST API unchanged.
|
|
405
|
+
|
|
406
|
+
### draw\.io diagrams
|
|
407
|
+
|
|
408
|
+
With the command-line option `--no-render-drawio` (default), editable diagram data is extracted from images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`), and uploaded to Confluence as attachments. `*.drawio` and `*.drawio.xml` files are uploaded as-is. You need a [marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts) to view and edit these diagrams on a Confluence page.
|
|
409
|
+
|
|
410
|
+
With the command-line option `--render-drawio`, images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`) are uploaded unchanged, and shown on the Confluence page as images. These diagrams are not editable in Confluence. When both an SVG and a PNG image is available, PNG is preferred. `*.drawio` and `*.drawio.xml` files are converted into PNG or SVG images by invoking draw\.io as a command-line utility, and the generated images are uploaded to Confluence as attachments, and shown as images.
|
|
411
|
+
|
|
412
|
+
### Mermaid diagrams
|
|
330
413
|
|
|
331
414
|
You can include [Mermaid diagrams](https://mermaid.js.org/) in your Markdown documents to create visual representations of systems, processes, and relationships. When a Markdown document contains a code block with the language specifier `mermaid`, *md2conf* offers two options to publish the diagram:
|
|
332
415
|
|
|
333
|
-
1. Pre-render into an image. The code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
|
|
334
|
-
2.
|
|
416
|
+
1. Pre-render into an image (command-line option `--render-mermaid`). The code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
|
|
417
|
+
2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://atlasauthority.atlassian.net/wiki/spaces/MARKDOWNCLOUD/pages/2946826241/Diagram+Macro), which is processed by Confluence. You need a [marketplace app](https://marketplace.atlassian.com/apps/1211438/markdown-html-plantuml-latex-diagrams-open-api-mermaid) to turn macro definitions into images when a Confluence page is visited.
|
|
335
418
|
|
|
336
419
|
If you are running into issues with the pre-rendering approach (e.g. misaligned labels in the generated image), verify if `mermaid-cli` can process the Mermaid source:
|
|
337
420
|
|
|
@@ -357,8 +440,9 @@ Use the `--help` switch to get a full list of supported command-line options:
|
|
|
357
440
|
|
|
358
441
|
```console
|
|
359
442
|
$ python3 -m md2conf --help
|
|
360
|
-
usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [--api-url API_URL] [-u USERNAME] [-a API_KEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--
|
|
361
|
-
[--no-generated-by] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
|
|
443
|
+
usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [--api-url API_URL] [-u USERNAME] [-a API_KEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--flatten-hierarchy]
|
|
444
|
+
[--generated-by GENERATED_BY] [--no-generated-by] [--render-drawio] [--no-render-drawio] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
|
|
445
|
+
[--no-heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
|
|
362
446
|
mdpath
|
|
363
447
|
|
|
364
448
|
positional arguments:
|
|
@@ -367,28 +451,30 @@ positional arguments:
|
|
|
367
451
|
options:
|
|
368
452
|
-h, --help show this help message and exit
|
|
369
453
|
--version show program's version number and exit
|
|
370
|
-
-d
|
|
371
|
-
|
|
372
|
-
-p PATH, --path PATH Base path for Confluence (default: '/wiki/').
|
|
454
|
+
-d, --domain DOMAIN Confluence organization domain.
|
|
455
|
+
-p, --path PATH Base path for Confluence (default: '/wiki/').
|
|
373
456
|
--api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
|
|
374
|
-
-u
|
|
457
|
+
-u, --username USERNAME
|
|
375
458
|
Confluence user name.
|
|
376
|
-
-a
|
|
459
|
+
-a, --apikey, --api-key API_KEY
|
|
377
460
|
Confluence API key. Refer to documentation how to obtain one.
|
|
378
|
-
-s
|
|
379
|
-
|
|
380
|
-
-l {debug,info,warning,error,critical}, --loglevel {debug,info,warning,error,critical}
|
|
461
|
+
-s, --space SPACE Confluence space key for pages to be published. If omitted, will default to user space.
|
|
462
|
+
-l, --loglevel {debug,info,warning,error,critical}
|
|
381
463
|
Use this option to set the log verbosity.
|
|
382
464
|
-r ROOT_PAGE Root Confluence page to create new pages. If omitted, will raise exception when creating new pages.
|
|
383
465
|
--keep-hierarchy Maintain source directory structure when exporting to Confluence.
|
|
466
|
+
--flatten-hierarchy Flatten directories with no index.md or README.md when exporting to Confluence.
|
|
384
467
|
--generated-by GENERATED_BY
|
|
385
468
|
Add prompt to pages (default: 'This page has been generated with a tool.').
|
|
386
469
|
--no-generated-by Do not add 'generated by a tool' prompt to pages.
|
|
387
|
-
--render-
|
|
388
|
-
--no-render-
|
|
470
|
+
--render-drawio Render draw.io diagrams as image files and add as attachments. (Converter required.)
|
|
471
|
+
--no-render-drawio Inline draw.io diagram in Confluence page. (Marketplace app required.)
|
|
472
|
+
--render-mermaid Render Mermaid diagrams as image files and add as attachments. (Converter required.)
|
|
473
|
+
--no-render-mermaid Inline Mermaid diagram in Confluence page. (Marketplace app required.)
|
|
389
474
|
--render-mermaid-format {png,svg}
|
|
390
|
-
Format for rendering Mermaid diagrams (default: 'png').
|
|
475
|
+
Format for rendering Mermaid and draw.io diagrams (default: 'png').
|
|
391
476
|
--heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
|
|
477
|
+
--no-heading-anchors Don't place an anchor at each section heading.
|
|
392
478
|
--ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
|
|
393
479
|
--local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
|
|
394
480
|
--headers [KEY=VALUE ...]
|
|
@@ -437,3 +523,7 @@ FROM leventehunyadi/md2conf:latest
|
|
|
437
523
|
|
|
438
524
|
CMD ["-d", "example.atlassian.net", "-u", "levente.hunyadi@instructure.com", "-a", "0123456789abcdef", "-s", "SPACE", "./"]
|
|
439
525
|
```
|
|
526
|
+
|
|
527
|
+
[^math]: Requires installing Confluence plugin [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
|
|
528
|
+
[^drawio]: Converting draw\.io diagrams to images before uploading to Confluence requires an installation of [draw.io](https://www.drawio.com/). Editable draw\.io diagrams require separate marketplace app.
|
|
529
|
+
[^mermaid]: Converting Mermaid diagrams to images before uploading to Confluence requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Displaying Mermaid diagrams on the fly requires separate marketplace app.
|
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.4.0
|
|
4
|
-
Summary: Publish Markdown files to Confluence wiki
|
|
5
|
-
Home-page: https://github.com/hunyadi/md2conf
|
|
6
|
-
Author: Levente Hunyadi
|
|
7
|
-
Author-email: hunyadi@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
-
Classifier: Environment :: Console
|
|
11
|
-
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Operating System :: OS Independent
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
-
Classifier: Typing :: Typed
|
|
21
|
-
Requires-Python: >=3.9
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
24
|
-
Requires-Dist: json_strong_typing>=0.3.9
|
|
25
|
-
Requires-Dist: lxml>=5.4
|
|
26
|
-
Requires-Dist: types-lxml>=2025.3.30
|
|
27
|
-
Requires-Dist: markdown>=3.8
|
|
28
|
-
Requires-Dist: types-markdown>=3.8
|
|
29
|
-
Requires-Dist: pymdown-extensions>=10.16
|
|
30
|
-
Requires-Dist: PyYAML>=6.0
|
|
31
|
-
Requires-Dist: types-PyYAML>=6.0
|
|
32
|
-
Requires-Dist: requests>=2.32
|
|
33
|
-
Requires-Dist: types-requests>=2.32
|
|
34
|
-
Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
|
|
35
|
-
Dynamic: license-file
|
|
36
|
-
|
|
37
1
|
# Publish Markdown files to Confluence wiki
|
|
38
2
|
|
|
39
3
|
Contributors to software projects typically write documentation in Markdown format and host Markdown files in collaborative version control systems (VCS) such as GitHub or GitLab to track changes and facilitate the review process. However, not everyone at a company has access to VCS, and documents are often circulated in Confluence wiki instead.
|
|
@@ -52,16 +16,19 @@ This Python package
|
|
|
52
16
|
* Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
|
|
53
17
|
* Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
|
|
54
18
|
* Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
|
|
19
|
+
* Math formulas with LaTeX notation [^math]
|
|
55
20
|
* Emoji
|
|
56
21
|
* Ordered and unordered lists
|
|
57
22
|
* Block quotes
|
|
58
23
|
* Code blocks (e.g. Python, JSON, XML)
|
|
59
24
|
* Images (uploaded as Confluence page attachments or hosted externally)
|
|
60
25
|
* Tables
|
|
26
|
+
* Footnotes
|
|
61
27
|
* [Table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents)
|
|
62
28
|
* [Admonitions](https://python-markdown.github.io/extensions/admonition/) and alert boxes in [GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) and [GitLab](https://docs.gitlab.com/ee/development/documentation/styleguide/#alert-boxes)
|
|
63
29
|
* [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
|
|
64
|
-
*
|
|
30
|
+
* draw\.io diagrams [^drawio]
|
|
31
|
+
* [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images) [^mermaid]
|
|
65
32
|
|
|
66
33
|
Whenever possible, the implementation uses [Confluence REST API v2](https://developer.atlassian.com/cloud/confluence/rest/v2/) to fetch space properties, and get, create or update page content.
|
|
67
34
|
|
|
@@ -73,12 +40,26 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
|
|
|
73
40
|
pip install markdown-to-confluence
|
|
74
41
|
```
|
|
75
42
|
|
|
76
|
-
|
|
43
|
+
### Command-line utilities
|
|
44
|
+
|
|
45
|
+
**Optional.** Converting `*.drawio` diagrams into PNG or SVG images requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
|
|
46
|
+
|
|
47
|
+
**Optional.** Converting code blocks of Mermaid diagrams into PNG or SVG images requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
|
|
77
48
|
|
|
78
49
|
```sh
|
|
79
50
|
npm install -g @mermaid-js/mermaid-cli
|
|
80
51
|
```
|
|
81
52
|
|
|
53
|
+
### Marketplace apps
|
|
54
|
+
|
|
55
|
+
As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
|
|
56
|
+
|
|
57
|
+
**Optional.** Editable draw\.io diagrams require [draw.io Diagrams marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts). (Refer to `--no-render-drawio`.)
|
|
58
|
+
|
|
59
|
+
**Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering requires a marketplace app. (Refer to `--no-render-mermaid`.)
|
|
60
|
+
|
|
61
|
+
**Optional.** Displaying formulas and equations requires [LaTeX Math marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations).
|
|
62
|
+
|
|
82
63
|
## Getting started
|
|
83
64
|
|
|
84
65
|
In order to get started, you will need
|
|
@@ -146,7 +127,7 @@ If you lack appropriate permissions, you will get an *Unauthorized* response fro
|
|
|
146
127
|
Each Markdown file is associated with a Confluence wiki page with a Markdown comment:
|
|
147
128
|
|
|
148
129
|
```markdown
|
|
149
|
-
<!-- confluence-page-id:
|
|
130
|
+
<!-- confluence-page-id: 20250001023 -->
|
|
150
131
|
```
|
|
151
132
|
|
|
152
133
|
The above tells the tool to synchronize the Markdown file with the given Confluence page ID. This implies that the Confluence wiki page must exist such that it has an ID. The comment can be placed anywhere in the source file.
|
|
@@ -187,24 +168,28 @@ First, *md2conf* builds an index of pages in the directory hierarchy. The index
|
|
|
187
168
|
|
|
188
169
|
If a Markdown file doesn't yet pair up with a Confluence page, *md2conf* creates a new page and assigns a parent. Parent-child relationships are reflected in the navigation panel in Confluence. You can set a root page ID with the command-line option `-r`, which constitutes the topmost parent. (This could correspond to the landing page of your Confluence space. The Confluence page ID is always revealed when you edit a page.) Whenever a directory contains the file `index.md` or `README.md`, this page becomes the future parent page, and all Markdown files in this directory (and possibly nested directories) become its child pages (unless they already have a page ID). However, if an `index.md` or `README.md` file is subsequently found in one of the nested directories, it becomes the parent page of that directory, and any of its subdirectories.
|
|
189
170
|
|
|
171
|
+
The top-level directory to be synchronized must always have an `index.md` or `README.md`, which maps to the root of the corresponding sub-tree in Confluence (specified with `-r`).
|
|
172
|
+
|
|
190
173
|
The concepts above are illustrated in the following sections.
|
|
191
174
|
|
|
192
175
|
#### File-system directory hierarchy
|
|
193
176
|
|
|
194
|
-
The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name.
|
|
177
|
+
The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name. `docs` is the top-level directory to be synchronized.
|
|
195
178
|
|
|
196
179
|
```
|
|
197
|
-
|
|
180
|
+
docs
|
|
181
|
+
├── index.md: Root page
|
|
198
182
|
├── computer-science
|
|
199
183
|
│ ├── index.md: Introduction to computer science
|
|
200
184
|
│ ├── algebra.md: Linear algebra
|
|
201
185
|
│ └── algorithms.md: Theory of algorithms
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
186
|
+
├── machine-learning
|
|
187
|
+
│ ├── README.md: AI and ML
|
|
188
|
+
│ ├── awareness.md: Consciousness and intelligence
|
|
189
|
+
│ └── statistics
|
|
190
|
+
│ ├── index.md: Introduction to statistics
|
|
191
|
+
│ └── median.md: Mean vs. median
|
|
192
|
+
└── ethics.md: Ethical considerations
|
|
208
193
|
```
|
|
209
194
|
|
|
210
195
|
#### Page hierarchy in Confluence
|
|
@@ -212,14 +197,15 @@ The title of each Markdown file (either the text of the topmost unique heading (
|
|
|
212
197
|
Observe how `index.md` and `README.md` files have assumed parent (or ancestor) role for any Markdown files in the same directory (or below).
|
|
213
198
|
|
|
214
199
|
```
|
|
215
|
-
|
|
200
|
+
Root page
|
|
216
201
|
├── Introduction to computer science
|
|
217
202
|
│ ├── Linear algebra
|
|
218
203
|
│ └── Theory of algorithms
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
204
|
+
├── AI and ML
|
|
205
|
+
│ ├── Consciousness and intelligence
|
|
206
|
+
│ └── Introduction to statistics
|
|
207
|
+
│ └── Mean vs. median
|
|
208
|
+
└── Ethical considerations
|
|
223
209
|
```
|
|
224
210
|
|
|
225
211
|
### Emoji
|
|
@@ -293,6 +279,25 @@ Unfortunately, Confluence struggles with SVG images, e.g. they may only show in
|
|
|
293
279
|
|
|
294
280
|
External images referenced with an absolute URL retain the original URL.
|
|
295
281
|
|
|
282
|
+
### LaTeX math formulas
|
|
283
|
+
|
|
284
|
+
Inline formulas can be enclosed with `$` signs, or delimited with `\(` and `\)`, i.e.
|
|
285
|
+
|
|
286
|
+
* the code `$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$` is shown as $\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$,
|
|
287
|
+
* and `\(\lim _{x\rightarrow \infty }\frac{1}{x}=0\)` is shown as $\lim _{x\rightarrow \infty }\frac{1}{x}=0$.
|
|
288
|
+
|
|
289
|
+
Block formulas can be enclosed with `$$`, or wrapped in code blocks specifying the language `math`:
|
|
290
|
+
|
|
291
|
+
```md
|
|
292
|
+
$$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
is shown as
|
|
296
|
+
|
|
297
|
+
$$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
|
|
298
|
+
|
|
299
|
+
Displaying math formulas in Confluence requires the extension [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
|
|
300
|
+
|
|
296
301
|
### Ignoring files
|
|
297
302
|
|
|
298
303
|
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax (and constraints) of [fnmatch](https://docs.python.org/3/library/fnmatch.html#fnmatch.fnmatch). Specifically, `?` matches any single character, and `*` matches zero or more characters. For example, use `up-*.md` to exclude Markdown files that start with `up-`. Lines that start with `#` are treated as comments.
|
|
@@ -301,6 +306,20 @@ Files that don't have the extension `*.md` are skipped automatically. Hidden dir
|
|
|
301
306
|
|
|
302
307
|
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
303
308
|
|
|
309
|
+
If you add the `synchronized` attribute to JSON or YAML front-matter with the value `false`, the document content (including attachments) and metadata (e.g. tags) will not be synchronized with Confluence:
|
|
310
|
+
|
|
311
|
+
```yaml
|
|
312
|
+
---
|
|
313
|
+
title: "Collaborating with other teams"
|
|
314
|
+
page_id: "19830101"
|
|
315
|
+
synchronized: false
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
This Markdown document is neither parsed, nor synchronized with Confluence.
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
This is useful if you have a page in a hierarchy that participates in parent-child relationships but whose content is edited directly in Confluence. Specifically, these documents can be referenced with relative links from other Markdown documents in the file system tree.
|
|
322
|
+
|
|
304
323
|
### Page title
|
|
305
324
|
|
|
306
325
|
*md2conf* makes a best-effort attempt at setting the Confluence wiki page title when it publishes a Markdown document the first time. The following are probed in this order:
|
|
@@ -326,12 +345,34 @@ Any previously assigned labels are discarded. As per Confluence terminology, new
|
|
|
326
345
|
|
|
327
346
|
If a document has no `tags` attribute, existing Confluence labels are left intact.
|
|
328
347
|
|
|
329
|
-
###
|
|
348
|
+
### Content properties
|
|
349
|
+
|
|
350
|
+
The front-matter attribute `properties` in a Markdown document allows setting Confluence content properties on a page. Confluence content properties are a way to store structured metadata in the form of key-value pairs directly on Confluence content. The values in content properties are represented as JSON objects.
|
|
351
|
+
|
|
352
|
+
Some content properties have special meaning to Confluence. For example, the following properties cause Confluence to display a wiki page with content confined to a fixed width in regular view mode, and taking the full page width in draft mode:
|
|
353
|
+
|
|
354
|
+
```yaml
|
|
355
|
+
---
|
|
356
|
+
properties:
|
|
357
|
+
content-appearance-published: fixed-width
|
|
358
|
+
content-appearance-draft: full-width
|
|
359
|
+
---
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
The attribute `properties` is parsed as a dictionary with keys of type string and values of type JSON. *md2conf* passes JSON values to Confluence REST API unchanged.
|
|
363
|
+
|
|
364
|
+
### draw\.io diagrams
|
|
365
|
+
|
|
366
|
+
With the command-line option `--no-render-drawio` (default), editable diagram data is extracted from images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`), and uploaded to Confluence as attachments. `*.drawio` and `*.drawio.xml` files are uploaded as-is. You need a [marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts) to view and edit these diagrams on a Confluence page.
|
|
367
|
+
|
|
368
|
+
With the command-line option `--render-drawio`, images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`) are uploaded unchanged, and shown on the Confluence page as images. These diagrams are not editable in Confluence. When both an SVG and a PNG image is available, PNG is preferred. `*.drawio` and `*.drawio.xml` files are converted into PNG or SVG images by invoking draw\.io as a command-line utility, and the generated images are uploaded to Confluence as attachments, and shown as images.
|
|
369
|
+
|
|
370
|
+
### Mermaid diagrams
|
|
330
371
|
|
|
331
372
|
You can include [Mermaid diagrams](https://mermaid.js.org/) in your Markdown documents to create visual representations of systems, processes, and relationships. When a Markdown document contains a code block with the language specifier `mermaid`, *md2conf* offers two options to publish the diagram:
|
|
332
373
|
|
|
333
|
-
1. Pre-render into an image. The code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
|
|
334
|
-
2.
|
|
374
|
+
1. Pre-render into an image (command-line option `--render-mermaid`). The code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
|
|
375
|
+
2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://atlasauthority.atlassian.net/wiki/spaces/MARKDOWNCLOUD/pages/2946826241/Diagram+Macro), which is processed by Confluence. You need a [marketplace app](https://marketplace.atlassian.com/apps/1211438/markdown-html-plantuml-latex-diagrams-open-api-mermaid) to turn macro definitions into images when a Confluence page is visited.
|
|
335
376
|
|
|
336
377
|
If you are running into issues with the pre-rendering approach (e.g. misaligned labels in the generated image), verify if `mermaid-cli` can process the Mermaid source:
|
|
337
378
|
|
|
@@ -357,8 +398,9 @@ Use the `--help` switch to get a full list of supported command-line options:
|
|
|
357
398
|
|
|
358
399
|
```console
|
|
359
400
|
$ python3 -m md2conf --help
|
|
360
|
-
usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [--api-url API_URL] [-u USERNAME] [-a API_KEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--
|
|
361
|
-
[--no-generated-by] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
|
|
401
|
+
usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [--api-url API_URL] [-u USERNAME] [-a API_KEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--flatten-hierarchy]
|
|
402
|
+
[--generated-by GENERATED_BY] [--no-generated-by] [--render-drawio] [--no-render-drawio] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
|
|
403
|
+
[--no-heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
|
|
362
404
|
mdpath
|
|
363
405
|
|
|
364
406
|
positional arguments:
|
|
@@ -367,28 +409,30 @@ positional arguments:
|
|
|
367
409
|
options:
|
|
368
410
|
-h, --help show this help message and exit
|
|
369
411
|
--version show program's version number and exit
|
|
370
|
-
-d
|
|
371
|
-
|
|
372
|
-
-p PATH, --path PATH Base path for Confluence (default: '/wiki/').
|
|
412
|
+
-d, --domain DOMAIN Confluence organization domain.
|
|
413
|
+
-p, --path PATH Base path for Confluence (default: '/wiki/').
|
|
373
414
|
--api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
|
|
374
|
-
-u
|
|
415
|
+
-u, --username USERNAME
|
|
375
416
|
Confluence user name.
|
|
376
|
-
-a
|
|
417
|
+
-a, --apikey, --api-key API_KEY
|
|
377
418
|
Confluence API key. Refer to documentation how to obtain one.
|
|
378
|
-
-s
|
|
379
|
-
|
|
380
|
-
-l {debug,info,warning,error,critical}, --loglevel {debug,info,warning,error,critical}
|
|
419
|
+
-s, --space SPACE Confluence space key for pages to be published. If omitted, will default to user space.
|
|
420
|
+
-l, --loglevel {debug,info,warning,error,critical}
|
|
381
421
|
Use this option to set the log verbosity.
|
|
382
422
|
-r ROOT_PAGE Root Confluence page to create new pages. If omitted, will raise exception when creating new pages.
|
|
383
423
|
--keep-hierarchy Maintain source directory structure when exporting to Confluence.
|
|
424
|
+
--flatten-hierarchy Flatten directories with no index.md or README.md when exporting to Confluence.
|
|
384
425
|
--generated-by GENERATED_BY
|
|
385
426
|
Add prompt to pages (default: 'This page has been generated with a tool.').
|
|
386
427
|
--no-generated-by Do not add 'generated by a tool' prompt to pages.
|
|
387
|
-
--render-
|
|
388
|
-
--no-render-
|
|
428
|
+
--render-drawio Render draw.io diagrams as image files and add as attachments. (Converter required.)
|
|
429
|
+
--no-render-drawio Inline draw.io diagram in Confluence page. (Marketplace app required.)
|
|
430
|
+
--render-mermaid Render Mermaid diagrams as image files and add as attachments. (Converter required.)
|
|
431
|
+
--no-render-mermaid Inline Mermaid diagram in Confluence page. (Marketplace app required.)
|
|
389
432
|
--render-mermaid-format {png,svg}
|
|
390
|
-
Format for rendering Mermaid diagrams (default: 'png').
|
|
433
|
+
Format for rendering Mermaid and draw.io diagrams (default: 'png').
|
|
391
434
|
--heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
|
|
435
|
+
--no-heading-anchors Don't place an anchor at each section heading.
|
|
392
436
|
--ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
|
|
393
437
|
--local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
|
|
394
438
|
--headers [KEY=VALUE ...]
|
|
@@ -437,3 +481,7 @@ FROM leventehunyadi/md2conf:latest
|
|
|
437
481
|
|
|
438
482
|
CMD ["-d", "example.atlassian.net", "-u", "levente.hunyadi@instructure.com", "-a", "0123456789abcdef", "-s", "SPACE", "./"]
|
|
439
483
|
```
|
|
484
|
+
|
|
485
|
+
[^math]: Requires installing Confluence plugin [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
|
|
486
|
+
[^drawio]: Converting draw\.io diagrams to images before uploading to Confluence requires an installation of [draw.io](https://www.drawio.com/). Editable draw\.io diagrams require separate marketplace app.
|
|
487
|
+
[^mermaid]: Converting Mermaid diagrams to images before uploading to Confluence requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Displaying Mermaid diagrams on the fly requires separate marketplace app.
|