markdown-to-confluence 0.4.4__py3-none-any.whl → 0.4.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Publish Markdown files to Confluence wiki
5
5
  Author-email: Levente Hunyadi <hunyadi@gmail.com>
6
6
  Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
@@ -23,13 +23,15 @@ Classifier: Typing :: Typed
23
23
  Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
- Requires-Dist: json_strong_typing>=0.3.9
26
+ Requires-Dist: certifi>=2025.8.3; python_version < "3.10"
27
+ Requires-Dist: json_strong_typing>=0.4
27
28
  Requires-Dist: lxml>=6.0
28
29
  Requires-Dist: markdown>=3.8
29
30
  Requires-Dist: pymdown-extensions>=10.16
30
31
  Requires-Dist: PyYAML>=6.0
31
32
  Requires-Dist: requests>=2.32
32
- Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
33
+ Requires-Dist: truststore>=0.10; python_version >= "3.10"
34
+ Requires-Dist: typing-extensions>=4.14; python_version < "3.12"
33
35
  Provides-Extra: dev
34
36
  Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
35
37
  Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
@@ -38,6 +40,8 @@ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
38
40
  Requires-Dist: types-requests>=2.32; extra == "dev"
39
41
  Requires-Dist: mypy>=1.16; extra == "dev"
40
42
  Requires-Dist: ruff>=0.12; extra == "dev"
43
+ Provides-Extra: formulas
44
+ Requires-Dist: matplotlib>=3.9; extra == "formulas"
41
45
  Dynamic: license-file
42
46
 
43
47
  # Publish Markdown files to Confluence wiki
@@ -57,7 +61,7 @@ This Python package
57
61
  * Sections and subsections
58
62
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
63
  * Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
60
- * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
64
+ * Subscript and superscript
61
65
  * Math formulas with LaTeX notation
62
66
  * Emoji
63
67
  * Ordered and unordered lists
@@ -71,7 +75,7 @@ This Python package
71
75
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
76
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
77
  * draw\.io diagrams
74
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
78
+ * [Mermaid diagrams](https://mermaid.live/)
75
79
  * Confluence status labels and date widget
76
80
 
77
81
  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.
@@ -94,6 +98,12 @@ pip install markdown-to-confluence
94
98
  npm install -g @mermaid-js/mermaid-cli
95
99
  ```
96
100
 
101
+ **Optional.** Converting formulas and equations to PNG or SVG images requires [Matplotlib](https://matplotlib.org/):
102
+
103
+ ```sh
104
+ pip install matplotlib
105
+ ```
106
+
97
107
  ### Marketplace apps
98
108
 
99
109
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -135,7 +145,7 @@ export CONFLUENCE_SPACE_KEY='SPACE'
135
145
 
136
146
  On Windows, these can be set via system properties.
137
147
 
138
- If you use Atlassian scoped API tokens, you should set API URL, substituting `CLOUD_ID` with your own Cloud ID:
148
+ If you use Atlassian scoped API tokens, you may want to set API URL directly, substituting `CLOUD_ID` with your own Cloud ID:
139
149
 
140
150
  ```sh
141
151
  export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
@@ -143,20 +153,27 @@ export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
143
153
 
144
154
  In this case, *md2conf* can automatically determine `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`.
145
155
 
156
+ If you can't find your `CLOUD_ID` but assign both `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`, *md2conf* makes a best-effort attempt to determine `CONFLUENCE_API_URL`.
157
+
146
158
  ### Permissions
147
159
 
148
160
  The tool requires appropriate permissions in Confluence in order to invoke endpoints.
149
161
 
150
- Required scopes for scoped API tokens are as follows:
162
+ We recommend the following scopes for scoped API tokens:
151
163
 
164
+ * `read:attachment:confluence`
165
+ * `read:content:confluence`
166
+ * `read:content-details:confluence`
167
+ * `read:label:confluence`
152
168
  * `read:page:confluence`
153
- * `write:page:confluence`
154
169
  * `read:space:confluence`
155
- * `write:space:confluence`
156
- * `read:attachment:confluence`
157
170
  * `write:attachment:confluence`
158
- * `read:label:confluence`
171
+ * `write:content:confluence`
159
172
  * `write:label:confluence`
173
+ * `write:page:confluence`
174
+ * `delete:attachment:confluence`
175
+ * `delete:content:confluence`
176
+ * `delete:page:confluence`
160
177
 
161
178
  If a Confluence username is set, the tool uses HTTP *Basic* authentication to pass the username and the API key to Confluence REST API endpoints. If no username is provided, the tool authenticates with HTTP *Bearer*, and passes the API key as the bearer token.
162
179
 
@@ -252,6 +269,12 @@ Root page
252
269
  └── Ethical considerations
253
270
  ```
254
271
 
272
+ ### Subscript and superscript
273
+
274
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
275
+
276
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
277
+
255
278
  ### Emoji
256
279
 
257
280
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -278,6 +301,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
278
301
  Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <span style="background-color: rgb(211,241,167);">lime</span> and <span style="background-color: rgb(254,222,200);">yellow</span>.
279
302
  ```
280
303
 
304
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
305
+
281
306
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
282
307
 
283
308
  | Color name | CSS attribute value |
@@ -315,6 +340,21 @@ The following table shows standard highlight colors (CSS `background-color`) tha
315
340
 
316
341
  If your Markdown lists or tables don't appear in Confluence as expected, verify that the list or table is delimited by a blank line both before and after, as per strict Markdown syntax. While some previewers accept a more lenient syntax (e.g. an itemized list immediately following a paragraph), *md2conf* uses [Python-Markdown](https://python-markdown.github.io/) internally to convert Markdown into XHTML, which expects the Markdown document to adhere to the stricter syntax.
317
342
 
343
+ Likewise, if you have a nested list, make sure that nested items are indented by exactly ***four*** spaces as compared to the parent node:
344
+
345
+ ```markdown
346
+ 1. List item 1
347
+ * Nested item 1
348
+ 1. Item 1
349
+ 2. Item 2
350
+ * Nested item 2
351
+ - Item 3
352
+ - Item 4
353
+ 2. List item 2
354
+ 1. Nested item 3
355
+ 2. Nested item 4
356
+ ```
357
+
318
358
  ### Publishing images
319
359
 
320
360
  Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
@@ -332,7 +372,7 @@ Inline formulas can be enclosed with `$` signs, or delimited with `\(` and `\)`,
332
372
 
333
373
  Block formulas can be enclosed with `$$`, or wrapped in code blocks specifying the language `math`:
334
374
 
335
- ```md
375
+ ```markdown
336
376
  $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
337
377
  ```
338
378
 
@@ -357,6 +397,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
357
397
 
358
398
  | Markdown code | Confluence equivalent |
359
399
  | :----------------------------------------- | :------------------------------------------------------ |
400
+ | `[[_TOC_]]` | table of contents (based on headings) |
401
+ | `[[_LISTING_]]` | child pages (of current page) |
360
402
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
403
  | `![My label][STATUS-PURPLE]` | purple status label |
362
404
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -367,7 +409,7 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
367
409
 
368
410
  Use the pseudo-language `csf` in a Markdown code block to pass content directly to Confluence. The content must be a single XML node that conforms to Confluence Storage Format (typically an `ac:structured-macro`) but is otherwise not validated. The following example shows how to create a panel similar to an *info panel* but with custom background color and emoji. Notice that `ac:rich-text-body` uses XHTML, not Markdown.
369
411
 
370
- ````md
412
+ ````markdown
371
413
  ```csf
372
414
  <ac:structured-macro ac:name="panel" ac:schema-version="1">
373
415
  <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
@@ -405,13 +447,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
405
447
 
406
448
  ### Page title
407
449
 
408
- *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:
450
+ *md2conf* makes a best-effort attempt at setting the Confluence wiki page title when it publishes a Markdown document the first time. The following act as sources for deriving a page title:
409
451
 
410
452
  1. The `title` attribute set in the [front-matter](https://daily-dev-tips.com/posts/what-exactly-is-frontmatter/). Front-matter is a block delimited by `---` at the beginning of a Markdown document. Both JSON and YAML syntax are supported.
411
453
  2. The text of the topmost unique Markdown heading (`#`). For example, if a document has a single first-level heading (e.g. `# My document`), its text is used. However, if there are multiple first-level headings, this step is skipped.
412
- 3. The file name (without the extension `.md`).
454
+ 3. The file name (without the extension `.md`) and a digest. The digest is included to ensure the title is unique across the Confluence space.
413
455
 
414
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
456
+ If the `title` attribute (in the front-matter) or the topmost unique heading (in the document body) changes, the Confluence page title is updated. A warning is raised if the new title conflicts with the title of another page, and thus cannot be updated.
415
457
 
416
458
  ### Labels
417
459
 
@@ -446,16 +488,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
446
488
 
447
489
  ### draw\.io diagrams
448
490
 
449
- 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.
491
+ 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. Files that match `*.drawio` or `*.drawio.xml` 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.
450
492
 
451
- 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.
493
+ 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. Files that match `*.drawio` or `*.drawio.xml` 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.
452
494
 
453
495
  ### Mermaid diagrams
454
496
 
455
- 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:
497
+ You can add [Mermaid diagrams](https://mermaid.js.org/) to your Markdown documents to create visual representations of systems, processes, and relationships. There are two ways to include a Mermaid diagram:
498
+
499
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
500
+ * a fenced code block with the language specifier `mermaid`.
501
+
502
+ *md2conf* offers two options to publish the diagram:
456
503
 
457
- 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.
458
- 2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://stratus-addons.atlassian.net/wiki/spaces/MDFC/overview), which is processed by Confluence. You need a [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence) to turn macro definitions into images when a Confluence page is visited.
504
+ 1. Pre-render into an image (command-line option `--render-mermaid`). The source file or 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.
505
+ 2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://stratus-addons.atlassian.net/wiki/spaces/MDFC/overview), which is processed by Confluence. You need a separate [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence) to turn macro definitions into images when a Confluence page is visited.
459
506
 
460
507
  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:
461
508
 
@@ -465,11 +512,15 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
465
512
 
466
513
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
467
514
 
515
+ ### Links to attachments
516
+
517
+ If *md2conf* encounters a Markdown link that points to a file in the directory hierarchy being synchronized, it automatically uploads the file as an attachment to the Confluence page. Activating the link in Confluence downloads the file. Typical examples include PDFs (`*.pdf`), word processor documents (`*.docx`), spreadsheets (`*.xlsx`), plain text files (`*.txt`) or logs (`*.log`). The MIME type is set based on the file type.
518
+
468
519
  ### Implicit URLs
469
520
 
470
521
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
471
522
 
472
- ```md
523
+ ```markdown
473
524
  [CUSTOM-URL]: https://example.com/path/to/resource
474
525
  ```
475
526
 
@@ -491,10 +542,7 @@ Use the `--help` switch to get a full list of supported command-line options:
491
542
 
492
543
  ```console
493
544
  $ python3 -m md2conf --help
494
- 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]
495
- [--generated-by GENERATED_BY] [--no-generated-by] [--render-drawio] [--no-render-drawio] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
496
- [--no-heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
497
- mdpath
545
+ usage: md2conf mdpath [OPTIONS]
498
546
 
499
547
  positional arguments:
500
548
  mdpath Path to Markdown file or directory to convert and publish.
@@ -507,7 +555,7 @@ options:
507
555
  --api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
508
556
  -u, --username USERNAME
509
557
  Confluence user name.
510
- -a, --apikey, --api-key API_KEY
558
+ -a, --api-key API_KEY
511
559
  Confluence API key. Refer to documentation how to obtain one.
512
560
  -s, --space SPACE Confluence space key for pages to be published. If omitted, will default to user space.
513
561
  -l, --loglevel {debug,info,warning,error,critical}
@@ -518,17 +566,19 @@ options:
518
566
  --generated-by GENERATED_BY
519
567
  Add prompt to pages (default: 'This page has been generated with a tool.').
520
568
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
521
- --render-drawio Render draw.io diagrams as image files and add as attachments. (Converter required.)
522
- --no-render-drawio Inline draw.io diagram in Confluence page. (Marketplace app required.)
523
- --render-mermaid Render Mermaid diagrams as image files and add as attachments. (Converter required.)
524
- --no-render-mermaid Inline Mermaid diagram in Confluence page. (Marketplace app required.)
525
- --render-mermaid-format {png,svg}
569
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
570
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
571
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
572
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
573
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
574
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
575
+ --diagram-output-format {png,svg}
526
576
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
527
577
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
528
578
  --no-heading-anchors Don't place an anchor at each section heading.
529
579
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
530
580
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
531
- --headers [KEY=VALUE ...]
581
+ --headers KEY=VALUE [KEY=VALUE ...]
532
582
  Apply custom headers to all Confluence API requests.
533
583
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
534
584
  ```
@@ -0,0 +1,34 @@
1
+ markdown_to_confluence-0.4.6.dist-info/licenses/LICENSE,sha256=56L-Y0dyZwyVlINRJRz3PNw-ka-oLVaAq-7d8zo6qlc,1077
2
+ md2conf/__init__.py,sha256=-uM9--fczADkWeiQ7PSL-iFlkeCxy7lnd2KhxG3yFso,402
3
+ md2conf/__main__.py,sha256=LiJ06zVr3wroMSLgkMf65ehraqJZgktvuN66dkBJaOI,10929
4
+ md2conf/api.py,sha256=RcltUP8KhrhrUuVg7SqBqp-AvGZymjMXtUxpzRPGGGc,40847
5
+ md2conf/collection.py,sha256=EobgMRJgkYloWlY03NZJ52MRC_SGLpTVCHkltDbQyt0,837
6
+ md2conf/converter.py,sha256=olL2FSop5TFxMfVXU4zWk1Lj_fwGN0c73F2ZYv8PU6s,63250
7
+ md2conf/csf.py,sha256=VlB0rYRZ8u-bNDdzEvNy2XrJSxaL-MW_hVRHxcoBluU,6409
8
+ md2conf/domain.py,sha256=NpeGl-I9_rgKYCKKZT1Ygg3nl5U0-jJHYYrzDVpMSGQ,1965
9
+ md2conf/drawio.py,sha256=3RJFFzlp5a7SNVNCnwO_HCDfMy0DqYQeXfHWRPInOVE,8527
10
+ md2conf/emoticon.py,sha256=P2L5oQvnRXeVifJQ3sJ2Ck-6ptbxumq2vsT-rM0W0Ms,484
11
+ md2conf/entities.dtd,sha256=M6NzqL5N7dPs_eUA_6sDsiSLzDaAacrx9LdttiufvYU,30215
12
+ md2conf/environment.py,sha256=RC1jY_TKVbOv2bJxXn27Fj4fNWzyoNUQt6ltgUyVQAQ,3987
13
+ md2conf/extra.py,sha256=VuMxuOnnC2Qwy6y52ukIxsaYhrZArRqMmRHRE4QZl8g,687
14
+ md2conf/latex.py,sha256=yAClNclguPv-xWBMVWbqvYWLbyUHBVufc2aUzwyKHew,7586
15
+ md2conf/local.py,sha256=mvp2kA_eo6JUQ_rlM7zDdEFgBPVxMr3VKP_X1nsLjHE,3747
16
+ md2conf/markdown.py,sha256=czabU17tUfhSX1JQGiI_TrMrTmtoVThOwFu_To_Oi_w,3176
17
+ md2conf/matcher.py,sha256=m5rZjYZSjhKfdeKS8JdPq7cG861Mc6rVZBkrIOZTHGE,6916
18
+ md2conf/mermaid.py,sha256=hGrITJVvhHprjQVoezQ1nQeo6a_lqNihF8L-oJ4t5rc,2633
19
+ md2conf/metadata.py,sha256=LzZM-oPNnzCULmLhF516tPlV5zZBknccwMHt8Nan-xg,1007
20
+ md2conf/processor.py,sha256=62Yr33uNVEb11Q7SQ8m1KJHMoJozBPSzeUJQ0fwHig0,9733
21
+ md2conf/publisher.py,sha256=uSyYb9SOQzMkSGKKQqsoOL5S2CfkVIEbXaCx6CY0Suw,8696
22
+ md2conf/puppeteer-config.json,sha256=-dMTAN_7kNTGbDlfXzApl0KJpAWna9YKZdwMKbpOb60,159
23
+ md2conf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ md2conf/scanner.py,sha256=APtENrcEgbslVfjjUnUyB81QpOmPoJgwfww0G7onNOY,6578
25
+ md2conf/text.py,sha256=fHOrUaPXAjE4iRhHqFq-CiI-knpo4wvyHCWp0crewqA,1736
26
+ md2conf/toc.py,sha256=hpqqDbFgNJg5-ul8qWjOglI3Am0sbwR-TLwGN5G9Qo0,2447
27
+ md2conf/uri.py,sha256=KbLBdRFtZTQTZd8b4j0LtE8Pb68Ly0WkemF4iW-EAB4,1158
28
+ md2conf/xml.py,sha256=Ybf3Ctt6EurVvel0eb1KezF33_e_cDpMwlUqHi4kNLE,5411
29
+ markdown_to_confluence-0.4.6.dist-info/METADATA,sha256=zgUR1Bz7EnzbcAkZVPVKqL123Y0L4NeWzbhxyq5yVH4,34414
30
+ markdown_to_confluence-0.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ markdown_to_confluence-0.4.6.dist-info/entry_points.txt,sha256=F1zxa1wtEObtbHS-qp46330WVFLHdMnV2wQ-ZorRmX0,50
32
+ markdown_to_confluence-0.4.6.dist-info/top_level.txt,sha256=_FJfl_kHrHNidyjUOuS01ngu_jDsfc-ZjSocNRJnTzU,8
33
+ markdown_to_confluence-0.4.6.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
34
+ markdown_to_confluence-0.4.6.dist-info/RECORD,,
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022-2024 Levente Hunyadi
3
+ Copyright (c) 2022-2025 Levente Hunyadi
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.4"
8
+ __version__ = "0.4.6"
9
9
  __author__ = "Levente Hunyadi"
10
10
  __copyright__ = "Copyright 2022-2025, Levente Hunyadi"
11
11
  __license__ = "MIT"
md2conf/__main__.py CHANGED
@@ -14,14 +14,15 @@ import logging
14
14
  import os.path
15
15
  import sys
16
16
  import typing
17
+ from io import StringIO
17
18
  from pathlib import Path
18
19
  from typing import Any, Iterable, Literal, Optional, Sequence, Union
19
20
 
20
21
  from . import __version__
21
22
  from .domain import ConfluenceDocumentOptions, ConfluencePageID
23
+ from .environment import ArgumentError, ConfluenceConnectionProperties, ConfluenceSiteProperties
22
24
  from .extra import override
23
25
  from .metadata import ConfluenceSiteMetadata
24
- from .properties import ArgumentError, ConfluenceConnectionProperties, ConfluenceSiteProperties
25
26
 
26
27
 
27
28
  class Arguments(argparse.Namespace):
@@ -40,6 +41,7 @@ class Arguments(argparse.Namespace):
40
41
  generated_by: Optional[str]
41
42
  render_drawio: bool
42
43
  render_mermaid: bool
44
+ render_latex: bool
43
45
  diagram_output_format: Literal["png", "svg"]
44
46
  local: bool
45
47
  headers: dict[str, str]
@@ -67,30 +69,6 @@ class KwargsAppendAction(argparse.Action):
67
69
  setattr(namespace, self.dest, d)
68
70
 
69
71
 
70
- def unsupported(prefer: str) -> type[argparse.Action]:
71
- class UnsupportedAction(argparse.Action):
72
- """Display an error for unsupported command-line options."""
73
-
74
- @override
75
- def __call__(
76
- self,
77
- parser: argparse.ArgumentParser,
78
- namespace: argparse.Namespace,
79
- values: Union[None, str, Sequence[Any]],
80
- option_string: Optional[str] = None,
81
- ) -> None:
82
- raise argparse.ArgumentError(
83
- self,
84
- f"this command-line option is no longer supported, use `--{prefer}`",
85
- )
86
-
87
- @override
88
- def __repr__(self) -> str:
89
- return f"{unsupported.__name__}({repr(prefer)})"
90
-
91
- return UnsupportedAction
92
-
93
-
94
72
  class PositionalOnlyHelpFormatter(argparse.HelpFormatter):
95
73
  def _format_usage(
96
74
  self,
@@ -111,7 +89,7 @@ class PositionalOnlyHelpFormatter(argparse.HelpFormatter):
111
89
  return usage_str
112
90
 
113
91
 
114
- def main() -> None:
92
+ def get_parser() -> argparse.ArgumentParser:
115
93
  parser = argparse.ArgumentParser(formatter_class=PositionalOnlyHelpFormatter)
116
94
  parser.prog = os.path.basename(os.path.dirname(__file__))
117
95
  parser.add_argument("--version", action="version", version=__version__)
@@ -126,7 +104,6 @@ def main() -> None:
126
104
  parser.add_argument("-u", "--username", help="Confluence user name.")
127
105
  parser.add_argument(
128
106
  "-a",
129
- "--apikey",
130
107
  "--api-key",
131
108
  dest="api_key",
132
109
  help="Confluence API key. Refer to documentation how to obtain one.",
@@ -186,26 +163,39 @@ def main() -> None:
186
163
  dest="render_drawio",
187
164
  action="store_true",
188
165
  default=True,
189
- help="Render draw.io diagrams as image files and add as attachments. (Installed utility required.)",
166
+ help="Render draw.io diagrams as image files. (Installed utility required to covert.)",
190
167
  )
191
168
  parser.add_argument(
192
169
  "--no-render-drawio",
193
170
  dest="render_drawio",
194
171
  action="store_false",
195
- help="Inline draw.io diagram in Confluence page. (Marketplace app required.)",
172
+ help="Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)",
196
173
  )
197
174
  parser.add_argument(
198
175
  "--render-mermaid",
199
176
  dest="render_mermaid",
200
177
  action="store_true",
201
178
  default=True,
202
- help="Render Mermaid diagrams as image files and add as attachments. (Installed utility required.)",
179
+ help="Render Mermaid diagrams as image files. (Installed utility required to convert.)",
203
180
  )
204
181
  parser.add_argument(
205
182
  "--no-render-mermaid",
206
183
  dest="render_mermaid",
207
184
  action="store_false",
208
- help="Inline Mermaid diagram in Confluence page. (Marketplace app required.)",
185
+ help="Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)",
186
+ )
187
+ parser.add_argument(
188
+ "--render-latex",
189
+ dest="render_latex",
190
+ action="store_true",
191
+ default=True,
192
+ help="Render LaTeX formulas as image files. (Matplotlib required to convert.)",
193
+ )
194
+ parser.add_argument(
195
+ "--no-render-latex",
196
+ dest="render_latex",
197
+ action="store_false",
198
+ help="Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)",
209
199
  )
210
200
  parser.add_argument(
211
201
  "--diagram-output-format",
@@ -214,12 +204,6 @@ def main() -> None:
214
204
  default="png",
215
205
  help="Format for rendering Mermaid and draw.io diagrams (default: 'png').",
216
206
  )
217
- parser.add_argument(
218
- "--render-mermaid-format",
219
- action=unsupported("diagram-output-format"),
220
- metavar="FORMAT",
221
- help="Format for rendering Mermaid diagrams (default: 'png').",
222
- )
223
207
  parser.add_argument(
224
208
  "--heading-anchors",
225
209
  action="store_true",
@@ -258,7 +242,18 @@ def main() -> None:
258
242
  default=False,
259
243
  help="Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)",
260
244
  )
245
+ return parser
246
+
247
+
248
+ def get_help() -> str:
249
+ parser = get_parser()
250
+ with StringIO() as buf:
251
+ parser.print_help(file=buf)
252
+ return buf.getvalue()
261
253
 
254
+
255
+ def main() -> None:
256
+ parser = get_parser()
262
257
  args = Arguments()
263
258
  parser.parse_args(namespace=args)
264
259
 
@@ -277,6 +272,7 @@ def main() -> None:
277
272
  keep_hierarchy=args.keep_hierarchy,
278
273
  render_drawio=args.render_drawio,
279
274
  render_mermaid=args.render_mermaid,
275
+ render_latex=args.render_latex,
280
276
  diagram_output_format=args.diagram_output_format,
281
277
  webui_links=args.webui_links,
282
278
  )
@@ -301,7 +297,7 @@ def main() -> None:
301
297
  from requests import HTTPError, JSONDecodeError
302
298
 
303
299
  from .api import ConfluenceAPI
304
- from .application import Application
300
+ from .publisher import Publisher
305
301
 
306
302
  try:
307
303
  properties = ConfluenceConnectionProperties(
@@ -317,7 +313,7 @@ def main() -> None:
317
313
  parser.error(str(e))
318
314
  try:
319
315
  with ConfluenceAPI(properties) as api:
320
- Application(
316
+ Publisher(
321
317
  api,
322
318
  options,
323
319
  ).process(args.mdpath)