markdown-to-confluence 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl
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.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/METADATA +133 -43
- markdown_to_confluence-0.4.2.dist-info/RECORD +27 -0
- md2conf/__init__.py +1 -1
- md2conf/__main__.py +57 -18
- md2conf/api.py +242 -125
- md2conf/application.py +40 -48
- md2conf/collection.py +17 -11
- md2conf/converter.py +540 -107
- md2conf/drawio.py +222 -0
- md2conf/extra.py +13 -0
- md2conf/local.py +5 -12
- md2conf/matcher.py +64 -7
- md2conf/mermaid.py +2 -7
- md2conf/metadata.py +2 -0
- md2conf/processor.py +48 -57
- md2conf/properties.py +45 -12
- md2conf/scanner.py +17 -9
- md2conf/xml.py +70 -0
- markdown_to_confluence-0.4.0.dist-info/RECORD +0 -25
- {markdown_to_confluence-0.4.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/WHEEL +0 -0
- {markdown_to_confluence-0.4.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/entry_points.txt +0 -0
- {markdown_to_confluence-0.4.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {markdown_to_confluence-0.4.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/top_level.txt +0 -0
- {markdown_to_confluence-0.4.0.dist-info → markdown_to_confluence-0.4.2.dist-info}/zip-safe +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.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
markdown_to_confluence-0.4.2.dist-info/licenses/LICENSE,sha256=Pv43so2bPfmKhmsrmXFyAvS7M30-1i1tzjz6-dfhyOo,1077
|
|
2
|
+
md2conf/__init__.py,sha256=XAJAgUDrYS3PdOzoo2BQ-rM3PbQWOrOW2kPt5iJ8xY0,402
|
|
3
|
+
md2conf/__main__.py,sha256=qyboDihyVTm0EZa_c3AFWF1AojhL8-bww_kISAa5nHQ,10130
|
|
4
|
+
md2conf/api.py,sha256=DbG1udDb9ti4OjqgSW3DSuHwxKNFPVDTkhjnaB1GNMI,37193
|
|
5
|
+
md2conf/application.py,sha256=X_V4KdFACHwl5Nt4BIHQyhtecOqNOzknrPyPTW0d4Z0,8185
|
|
6
|
+
md2conf/collection.py,sha256=EobgMRJgkYloWlY03NZJ52MRC_SGLpTVCHkltDbQyt0,837
|
|
7
|
+
md2conf/converter.py,sha256=Eg6emS77GQAkhbXutaRjHxcBFgmXp_4z_zOAmBfqxUY,54360
|
|
8
|
+
md2conf/drawio.py,sha256=G_pD2nafl7dXuFK_4MBiEUl0ZZGNuagnHw6GFOrev94,6717
|
|
9
|
+
md2conf/emoji.py,sha256=UzDrxqFo59wHmbbJmMNdn0rYFDXbZE4qirOM-_egzXc,2603
|
|
10
|
+
md2conf/entities.dtd,sha256=M6NzqL5N7dPs_eUA_6sDsiSLzDaAacrx9LdttiufvYU,30215
|
|
11
|
+
md2conf/extra.py,sha256=VuMxuOnnC2Qwy6y52ukIxsaYhrZArRqMmRHRE4QZl8g,687
|
|
12
|
+
md2conf/local.py,sha256=Ph-cGc_JQ1SkvuZ_Jxn37dlpaKZYKLVPBnsk5CGSVnk,3548
|
|
13
|
+
md2conf/matcher.py,sha256=m5rZjYZSjhKfdeKS8JdPq7cG861Mc6rVZBkrIOZTHGE,6916
|
|
14
|
+
md2conf/mermaid.py,sha256=f0x7ISj-41ZMh4zTAFPhIWwr94SDcsVZUc1NWqmH_G4,2508
|
|
15
|
+
md2conf/metadata.py,sha256=LzZM-oPNnzCULmLhF516tPlV5zZBknccwMHt8Nan-xg,1007
|
|
16
|
+
md2conf/processor.py,sha256=59XDWKgTvJwEZ1y52VfRkM67K2-Ivh7kGD6Eg2tfG9c,9713
|
|
17
|
+
md2conf/properties.py,sha256=RC1jY_TKVbOv2bJxXn27Fj4fNWzyoNUQt6ltgUyVQAQ,3987
|
|
18
|
+
md2conf/puppeteer-config.json,sha256=-dMTAN_7kNTGbDlfXzApl0KJpAWna9YKZdwMKbpOb60,159
|
|
19
|
+
md2conf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
md2conf/scanner.py,sha256=Cyvjab8tBvKgubttQvNagS8nailuTvFBqUGoiX5MNp8,5351
|
|
21
|
+
md2conf/xml.py,sha256=HoKJfF1yRZ3Gk8jTS-kRpOqVs0nQJZyr56l0Fo3y9fs,2193
|
|
22
|
+
markdown_to_confluence-0.4.2.dist-info/METADATA,sha256=ggIrg30RRTvk3ax2LKC_wKjMhOEhrXOYVrSwvb2dDbw,29495
|
|
23
|
+
markdown_to_confluence-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
markdown_to_confluence-0.4.2.dist-info/entry_points.txt,sha256=F1zxa1wtEObtbHS-qp46330WVFLHdMnV2wQ-ZorRmX0,50
|
|
25
|
+
markdown_to_confluence-0.4.2.dist-info/top_level.txt,sha256=_FJfl_kHrHNidyjUOuS01ngu_jDsfc-ZjSocNRJnTzU,8
|
|
26
|
+
markdown_to_confluence-0.4.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
27
|
+
markdown_to_confluence-0.4.2.dist-info/RECORD,,
|
md2conf/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ Parses Markdown files, converts Markdown content into the Confluence Storage For
|
|
|
5
5
|
Confluence API endpoints to upload images and content.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "0.4.
|
|
8
|
+
__version__ = "0.4.2"
|
|
9
9
|
__author__ = "Levente Hunyadi"
|
|
10
10
|
__copyright__ = "Copyright 2022-2025, Levente Hunyadi"
|
|
11
11
|
__license__ = "MIT"
|
md2conf/__main__.py
CHANGED
|
@@ -15,7 +15,7 @@ import os.path
|
|
|
15
15
|
import sys
|
|
16
16
|
import typing
|
|
17
17
|
from pathlib import Path
|
|
18
|
-
from typing import Any, Literal, Optional, Sequence, Union
|
|
18
|
+
from typing import Any, Iterable, Literal, Optional, Sequence, Union
|
|
19
19
|
|
|
20
20
|
import requests
|
|
21
21
|
|
|
@@ -26,11 +26,7 @@ from .converter import ConfluenceDocumentOptions, ConfluencePageID
|
|
|
26
26
|
from .extra import override
|
|
27
27
|
from .local import LocalConverter
|
|
28
28
|
from .metadata import ConfluenceSiteMetadata
|
|
29
|
-
from .properties import
|
|
30
|
-
ArgumentError,
|
|
31
|
-
ConfluenceConnectionProperties,
|
|
32
|
-
ConfluenceSiteProperties,
|
|
33
|
-
)
|
|
29
|
+
from .properties import ArgumentError, ConfluenceConnectionProperties, ConfluenceSiteProperties
|
|
34
30
|
|
|
35
31
|
|
|
36
32
|
class Arguments(argparse.Namespace):
|
|
@@ -47,6 +43,7 @@ class Arguments(argparse.Namespace):
|
|
|
47
43
|
root_page: Optional[str]
|
|
48
44
|
keep_hierarchy: bool
|
|
49
45
|
generated_by: Optional[str]
|
|
46
|
+
render_drawio: bool
|
|
50
47
|
render_mermaid: bool
|
|
51
48
|
diagram_output_format: Literal["png", "svg"]
|
|
52
49
|
local: bool
|
|
@@ -71,21 +68,37 @@ class KwargsAppendAction(argparse.Action):
|
|
|
71
68
|
raise argparse.ArgumentError(
|
|
72
69
|
self,
|
|
73
70
|
f'Could not parse argument "{values}". It should follow the format: k1=v1 k2=v2 ...',
|
|
74
|
-
)
|
|
71
|
+
) from None
|
|
75
72
|
setattr(namespace, self.dest, d)
|
|
76
73
|
|
|
77
74
|
|
|
75
|
+
class PositionalOnlyHelpFormatter(argparse.HelpFormatter):
|
|
76
|
+
def _format_usage(
|
|
77
|
+
self,
|
|
78
|
+
usage: Optional[str],
|
|
79
|
+
actions: Iterable[argparse.Action],
|
|
80
|
+
groups: Iterable[argparse._MutuallyExclusiveGroup],
|
|
81
|
+
prefix: Optional[str],
|
|
82
|
+
) -> str:
|
|
83
|
+
# filter only positional arguments
|
|
84
|
+
positional_actions = [a for a in actions if not a.option_strings]
|
|
85
|
+
|
|
86
|
+
# format usage string with only positional arguments
|
|
87
|
+
usage_str = super()._format_usage(usage, positional_actions, groups, prefix).rstrip()
|
|
88
|
+
|
|
89
|
+
# insert [OPTIONS] as a placeholder for all options (detailed below)
|
|
90
|
+
usage_str += " [OPTIONS]\n"
|
|
91
|
+
|
|
92
|
+
return usage_str
|
|
93
|
+
|
|
94
|
+
|
|
78
95
|
def main() -> None:
|
|
79
|
-
parser = argparse.ArgumentParser()
|
|
96
|
+
parser = argparse.ArgumentParser(formatter_class=PositionalOnlyHelpFormatter)
|
|
80
97
|
parser.prog = os.path.basename(os.path.dirname(__file__))
|
|
81
98
|
parser.add_argument("--version", action="version", version=__version__)
|
|
82
|
-
parser.add_argument(
|
|
83
|
-
"mdpath", help="Path to Markdown file or directory to convert and publish."
|
|
84
|
-
)
|
|
99
|
+
parser.add_argument("mdpath", help="Path to Markdown file or directory to convert and publish.")
|
|
85
100
|
parser.add_argument("-d", "--domain", help="Confluence organization domain.")
|
|
86
|
-
parser.add_argument(
|
|
87
|
-
"-p", "--path", help="Base path for Confluence (default: '/wiki/')."
|
|
88
|
-
)
|
|
101
|
+
parser.add_argument("-p", "--path", help="Base path for Confluence (default: '/wiki/').")
|
|
89
102
|
parser.add_argument(
|
|
90
103
|
"--api-url",
|
|
91
104
|
dest="api_url",
|
|
@@ -131,6 +144,12 @@ def main() -> None:
|
|
|
131
144
|
default=False,
|
|
132
145
|
help="Maintain source directory structure when exporting to Confluence.",
|
|
133
146
|
)
|
|
147
|
+
parser.add_argument(
|
|
148
|
+
"--flatten-hierarchy",
|
|
149
|
+
dest="keep_hierarchy",
|
|
150
|
+
action="store_false",
|
|
151
|
+
help="Flatten directories with no index.md or README.md when exporting to Confluence.",
|
|
152
|
+
)
|
|
134
153
|
parser.add_argument(
|
|
135
154
|
"--generated-by",
|
|
136
155
|
default="This page has been generated with a tool.",
|
|
@@ -143,25 +162,38 @@ def main() -> None:
|
|
|
143
162
|
const=None,
|
|
144
163
|
help="Do not add 'generated by a tool' prompt to pages.",
|
|
145
164
|
)
|
|
165
|
+
parser.add_argument(
|
|
166
|
+
"--render-drawio",
|
|
167
|
+
dest="render_drawio",
|
|
168
|
+
action="store_true",
|
|
169
|
+
default=True,
|
|
170
|
+
help="Render draw.io diagrams as image files and add as attachments. (Installed utility required.)",
|
|
171
|
+
)
|
|
172
|
+
parser.add_argument(
|
|
173
|
+
"--no-render-drawio",
|
|
174
|
+
dest="render_drawio",
|
|
175
|
+
action="store_false",
|
|
176
|
+
help="Inline draw.io diagram in Confluence page. (Marketplace app required.)",
|
|
177
|
+
)
|
|
146
178
|
parser.add_argument(
|
|
147
179
|
"--render-mermaid",
|
|
148
180
|
dest="render_mermaid",
|
|
149
181
|
action="store_true",
|
|
150
182
|
default=True,
|
|
151
|
-
help="Render Mermaid diagrams as image files and add as attachments.",
|
|
183
|
+
help="Render Mermaid diagrams as image files and add as attachments. (Installed utility required.)",
|
|
152
184
|
)
|
|
153
185
|
parser.add_argument(
|
|
154
186
|
"--no-render-mermaid",
|
|
155
187
|
dest="render_mermaid",
|
|
156
188
|
action="store_false",
|
|
157
|
-
help="Inline Mermaid diagram in Confluence page.",
|
|
189
|
+
help="Inline Mermaid diagram in Confluence page. (Marketplace app required.)",
|
|
158
190
|
)
|
|
159
191
|
parser.add_argument(
|
|
160
192
|
"--render-mermaid-format",
|
|
161
193
|
dest="diagram_output_format",
|
|
162
194
|
choices=["png", "svg"],
|
|
163
195
|
default="png",
|
|
164
|
-
help="Format for rendering Mermaid diagrams (default: 'png').",
|
|
196
|
+
help="Format for rendering Mermaid and draw.io diagrams (default: 'png').",
|
|
165
197
|
)
|
|
166
198
|
parser.add_argument(
|
|
167
199
|
"--heading-anchors",
|
|
@@ -169,6 +201,12 @@ def main() -> None:
|
|
|
169
201
|
default=False,
|
|
170
202
|
help="Place an anchor at each section heading with GitHub-style same-page identifiers.",
|
|
171
203
|
)
|
|
204
|
+
parser.add_argument(
|
|
205
|
+
"--no-heading-anchors",
|
|
206
|
+
action="store_false",
|
|
207
|
+
dest="heading_anchors",
|
|
208
|
+
help="Don't place an anchor at each section heading.",
|
|
209
|
+
)
|
|
172
210
|
parser.add_argument(
|
|
173
211
|
"--ignore-invalid-url",
|
|
174
212
|
action="store_true",
|
|
@@ -183,7 +221,7 @@ def main() -> None:
|
|
|
183
221
|
)
|
|
184
222
|
parser.add_argument(
|
|
185
223
|
"--headers",
|
|
186
|
-
nargs="
|
|
224
|
+
nargs="+",
|
|
187
225
|
required=False,
|
|
188
226
|
action=KwargsAppendAction,
|
|
189
227
|
metavar="KEY=VALUE",
|
|
@@ -212,6 +250,7 @@ def main() -> None:
|
|
|
212
250
|
generated_by=args.generated_by,
|
|
213
251
|
root_page_id=ConfluencePageID(args.root_page) if args.root_page else None,
|
|
214
252
|
keep_hierarchy=args.keep_hierarchy,
|
|
253
|
+
render_drawio=args.render_drawio,
|
|
215
254
|
render_mermaid=args.render_mermaid,
|
|
216
255
|
diagram_output_format=args.diagram_output_format,
|
|
217
256
|
webui_links=args.webui_links,
|