markdown-to-confluence 0.4.4__tar.gz → 0.4.5__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.
Files changed (101) hide show
  1. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/LICENSE +1 -1
  2. {markdown_to_confluence-0.4.4/markdown_to_confluence.egg-info → markdown_to_confluence-0.4.5}/PKG-INFO +51 -23
  3. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/README.md +46 -20
  4. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5/markdown_to_confluence.egg-info}/PKG-INFO +51 -23
  5. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/SOURCES.txt +7 -0
  6. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/requires.txt +5 -2
  7. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/__init__.py +1 -1
  8. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/__main__.py +19 -4
  9. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/api.py +6 -0
  10. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/application.py +14 -8
  11. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/converter.py +522 -272
  12. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/csf.py +66 -0
  13. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/domain.py +2 -0
  14. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/drawio.py +18 -14
  15. markdown_to_confluence-0.4.5/md2conf/latex.py +245 -0
  16. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/local.py +2 -2
  17. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/markdown.py +3 -1
  18. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/mermaid.py +21 -27
  19. markdown_to_confluence-0.4.5/md2conf/text.py +54 -0
  20. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/xml.py +37 -0
  21. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/pyproject.toml +5 -2
  22. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/emoji.py +4 -1
  23. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/anchors.md +10 -0
  24. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/basic.md +4 -2
  25. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/code.md +6 -0
  26. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/images.md +7 -3
  27. markdown_to_confluence-0.4.5/tests/source/toc.md +11 -0
  28. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/anchors.xml +5 -0
  29. markdown_to_confluence-0.4.5/tests/target/basic.xml +70 -0
  30. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/code.xml +8 -5
  31. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/collapsed.xml +0 -1
  32. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/fenced.xml +21 -13
  33. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/footnote.xml +1 -1
  34. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/images/images.xml +2 -4
  35. markdown_to_confluence-0.4.5/tests/target/images.xml +31 -0
  36. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/status.xml +0 -1
  37. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/table.xml +3 -3
  38. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/tags.xml +1 -1
  39. markdown_to_confluence-0.4.5/tests/target/toc.xml +15 -0
  40. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_conversion.py +35 -2
  41. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_drawio.py +4 -1
  42. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_matcher.py +2 -1
  43. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_mermaid.py +3 -1
  44. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_processor.py +2 -13
  45. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_scanner.py +2 -1
  46. markdown_to_confluence-0.4.5/tests/test_text.py +66 -0
  47. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/test_unit.py +19 -10
  48. markdown_to_confluence-0.4.5/tests/test_xml.py +115 -0
  49. markdown_to_confluence-0.4.5/tests/utility.py +41 -0
  50. markdown_to_confluence-0.4.4/tests/target/basic.xml +0 -59
  51. markdown_to_confluence-0.4.4/tests/target/images.xml +0 -39
  52. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/MANIFEST.in +0 -0
  53. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
  54. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
  55. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/top_level.txt +0 -0
  56. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/markdown_to_confluence.egg-info/zip-safe +0 -0
  57. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/collection.py +0 -0
  58. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/entities.dtd +0 -0
  59. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/extra.py +0 -0
  60. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/matcher.py +0 -0
  61. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/metadata.py +0 -0
  62. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/processor.py +0 -0
  63. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/properties.py +0 -0
  64. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/puppeteer-config.json +0 -0
  65. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/py.typed +0 -0
  66. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/scanner.py +0 -0
  67. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/toc.py +0 -0
  68. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/md2conf/uri.py +0 -0
  69. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/setup.cfg +0 -0
  70. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/setup.py +0 -0
  71. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/__init__.py +0 -0
  72. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/admonition.md +0 -0
  73. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/alert.md +0 -0
  74. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/collapsed.md +0 -0
  75. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/fenced.md +0 -0
  76. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/figure/diagram.drawio +0 -0
  77. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/figure/diagram.drawio.png +0 -0
  78. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/figure/diagram.drawio.svg +0 -0
  79. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/figure/raster.png +0 -0
  80. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/figure/vector.svg +0 -0
  81. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/footnote.md +0 -0
  82. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/ignore.md +0 -0
  83. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/images/images.md +0 -0
  84. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/macro.md +0 -0
  85. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/math.md +0 -0
  86. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/mermaid.md +0 -0
  87. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/missing.md +0 -0
  88. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/sections.md +0 -0
  89. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/status.md +0 -0
  90. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/table.md +0 -0
  91. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/tags.md +0 -0
  92. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/tasklist.md +0 -0
  93. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/source/title.md +0 -0
  94. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/admonition.xml +0 -0
  95. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/alert.xml +0 -0
  96. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/macro.xml +0 -0
  97. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/math.xml +0 -0
  98. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/mermaid.xml +0 -0
  99. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/missing.xml +0 -0
  100. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/sections.xml +0 -0
  101. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.5}/tests/target/tasklist.xml +0 -0
@@ -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
@@ -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.5
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,13 @@ 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: json_strong_typing>=0.4
27
27
  Requires-Dist: lxml>=6.0
28
28
  Requires-Dist: markdown>=3.8
29
29
  Requires-Dist: pymdown-extensions>=10.16
30
30
  Requires-Dist: PyYAML>=6.0
31
31
  Requires-Dist: requests>=2.32
32
- Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
32
+ Requires-Dist: typing-extensions>=4.14; python_version < "3.12"
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
35
35
  Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
@@ -38,6 +38,8 @@ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
38
38
  Requires-Dist: types-requests>=2.32; extra == "dev"
39
39
  Requires-Dist: mypy>=1.16; extra == "dev"
40
40
  Requires-Dist: ruff>=0.12; extra == "dev"
41
+ Provides-Extra: formulas
42
+ Requires-Dist: matplotlib>=3.9; extra == "formulas"
41
43
  Dynamic: license-file
42
44
 
43
45
  # Publish Markdown files to Confluence wiki
@@ -57,7 +59,7 @@ This Python package
57
59
  * Sections and subsections
58
60
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
61
  * 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>`)
62
+ * Subscript and superscript
61
63
  * Math formulas with LaTeX notation
62
64
  * Emoji
63
65
  * Ordered and unordered lists
@@ -71,7 +73,7 @@ This Python package
71
73
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
74
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
75
  * draw\.io diagrams
74
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
76
+ * [Mermaid diagrams](https://mermaid.live/)
75
77
  * Confluence status labels and date widget
76
78
 
77
79
  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 +96,12 @@ pip install markdown-to-confluence
94
96
  npm install -g @mermaid-js/mermaid-cli
95
97
  ```
96
98
 
99
+ **Optional.** Converting formulas and equations to PNG or SVG images requires [Matplotlib](https://matplotlib.org/):
100
+
101
+ ```sh
102
+ pip install matplotlib
103
+ ```
104
+
97
105
  ### Marketplace apps
98
106
 
99
107
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -252,6 +260,12 @@ Root page
252
260
  └── Ethical considerations
253
261
  ```
254
262
 
263
+ ### Subscript and superscript
264
+
265
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
266
+
267
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
268
+
255
269
  ### Emoji
256
270
 
257
271
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -278,6 +292,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
278
292
  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
293
  ```
280
294
 
295
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
296
+
281
297
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
282
298
 
283
299
  | Color name | CSS attribute value |
@@ -357,6 +373,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
357
373
 
358
374
  | Markdown code | Confluence equivalent |
359
375
  | :----------------------------------------- | :------------------------------------------------------ |
376
+ | `[[_TOC_]]` | table of contents (based on headings) |
377
+ | `[[_LISTING_]]` | child pages (of current page) |
360
378
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
379
  | `![My label][STATUS-PURPLE]` | purple status label |
362
380
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -405,13 +423,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
405
423
 
406
424
  ### Page title
407
425
 
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:
426
+ *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
427
 
410
428
  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
429
  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`).
430
+ 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
431
 
414
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
432
+ 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
433
 
416
434
  ### Labels
417
435
 
@@ -446,16 +464,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
446
464
 
447
465
  ### draw\.io diagrams
448
466
 
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.
467
+ 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
468
 
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.
469
+ 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
470
 
453
471
  ### Mermaid diagrams
454
472
 
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:
473
+ 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:
474
+
475
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
476
+ * a fenced code block with the language specifier `mermaid`.
456
477
 
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.
478
+ *md2conf* offers two options to publish the diagram:
479
+
480
+ 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.
481
+ 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
482
 
460
483
  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
484
 
@@ -465,6 +488,10 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
465
488
 
466
489
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
467
490
 
491
+ ### Links to attachments
492
+
493
+ 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.
494
+
468
495
  ### Implicit URLs
469
496
 
470
497
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
@@ -491,10 +518,7 @@ Use the `--help` switch to get a full list of supported command-line options:
491
518
 
492
519
  ```console
493
520
  $ 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
521
+ usage: md2conf mdpath [OPTIONS]
498
522
 
499
523
  positional arguments:
500
524
  mdpath Path to Markdown file or directory to convert and publish.
@@ -518,17 +542,21 @@ options:
518
542
  --generated-by GENERATED_BY
519
543
  Add prompt to pages (default: 'This page has been generated with a tool.').
520
544
  --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}
545
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
546
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
547
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
548
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
549
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
550
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
551
+ --diagram-output-format {png,svg}
526
552
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
553
+ --render-mermaid-format FORMAT
554
+ Format for rendering Mermaid diagrams (default: 'png').
527
555
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
528
556
  --no-heading-anchors Don't place an anchor at each section heading.
529
557
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
530
558
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
531
- --headers [KEY=VALUE ...]
559
+ --headers KEY=VALUE [KEY=VALUE ...]
532
560
  Apply custom headers to all Confluence API requests.
533
561
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
534
562
  ```
@@ -15,7 +15,7 @@ This Python package
15
15
  * Sections and subsections
16
16
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
17
17
  * Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
18
- * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
18
+ * Subscript and superscript
19
19
  * Math formulas with LaTeX notation
20
20
  * Emoji
21
21
  * Ordered and unordered lists
@@ -29,7 +29,7 @@ This Python package
29
29
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
30
30
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
31
31
  * draw\.io diagrams
32
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
32
+ * [Mermaid diagrams](https://mermaid.live/)
33
33
  * Confluence status labels and date widget
34
34
 
35
35
  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.
@@ -52,6 +52,12 @@ pip install markdown-to-confluence
52
52
  npm install -g @mermaid-js/mermaid-cli
53
53
  ```
54
54
 
55
+ **Optional.** Converting formulas and equations to PNG or SVG images requires [Matplotlib](https://matplotlib.org/):
56
+
57
+ ```sh
58
+ pip install matplotlib
59
+ ```
60
+
55
61
  ### Marketplace apps
56
62
 
57
63
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -210,6 +216,12 @@ Root page
210
216
  └── Ethical considerations
211
217
  ```
212
218
 
219
+ ### Subscript and superscript
220
+
221
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
222
+
223
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
224
+
213
225
  ### Emoji
214
226
 
215
227
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -236,6 +248,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
236
248
  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>.
237
249
  ```
238
250
 
251
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
252
+
239
253
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
240
254
 
241
255
  | Color name | CSS attribute value |
@@ -315,6 +329,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
315
329
 
316
330
  | Markdown code | Confluence equivalent |
317
331
  | :----------------------------------------- | :------------------------------------------------------ |
332
+ | `[[_TOC_]]` | table of contents (based on headings) |
333
+ | `[[_LISTING_]]` | child pages (of current page) |
318
334
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
319
335
  | `![My label][STATUS-PURPLE]` | purple status label |
320
336
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -363,13 +379,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
363
379
 
364
380
  ### Page title
365
381
 
366
- *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:
382
+ *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:
367
383
 
368
384
  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.
369
385
  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.
370
- 3. The file name (without the extension `.md`).
386
+ 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.
371
387
 
372
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
388
+ 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.
373
389
 
374
390
  ### Labels
375
391
 
@@ -404,16 +420,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
404
420
 
405
421
  ### draw\.io diagrams
406
422
 
407
- 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.
423
+ 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.
408
424
 
409
- 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.
425
+ 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.
410
426
 
411
427
  ### Mermaid diagrams
412
428
 
413
- 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:
429
+ 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:
430
+
431
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
432
+ * a fenced code block with the language specifier `mermaid`.
414
433
 
415
- 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.
416
- 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.
434
+ *md2conf* offers two options to publish the diagram:
435
+
436
+ 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.
437
+ 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.
417
438
 
418
439
  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:
419
440
 
@@ -423,6 +444,10 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
423
444
 
424
445
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
425
446
 
447
+ ### Links to attachments
448
+
449
+ 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.
450
+
426
451
  ### Implicit URLs
427
452
 
428
453
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
@@ -449,10 +474,7 @@ Use the `--help` switch to get a full list of supported command-line options:
449
474
 
450
475
  ```console
451
476
  $ python3 -m md2conf --help
452
- 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]
453
- [--generated-by GENERATED_BY] [--no-generated-by] [--render-drawio] [--no-render-drawio] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
454
- [--no-heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
455
- mdpath
477
+ usage: md2conf mdpath [OPTIONS]
456
478
 
457
479
  positional arguments:
458
480
  mdpath Path to Markdown file or directory to convert and publish.
@@ -476,17 +498,21 @@ options:
476
498
  --generated-by GENERATED_BY
477
499
  Add prompt to pages (default: 'This page has been generated with a tool.').
478
500
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
479
- --render-drawio Render draw.io diagrams as image files and add as attachments. (Converter required.)
480
- --no-render-drawio Inline draw.io diagram in Confluence page. (Marketplace app required.)
481
- --render-mermaid Render Mermaid diagrams as image files and add as attachments. (Converter required.)
482
- --no-render-mermaid Inline Mermaid diagram in Confluence page. (Marketplace app required.)
483
- --render-mermaid-format {png,svg}
501
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
502
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
503
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
504
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
505
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
506
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
507
+ --diagram-output-format {png,svg}
484
508
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
509
+ --render-mermaid-format FORMAT
510
+ Format for rendering Mermaid diagrams (default: 'png').
485
511
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
486
512
  --no-heading-anchors Don't place an anchor at each section heading.
487
513
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
488
514
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
489
- --headers [KEY=VALUE ...]
515
+ --headers KEY=VALUE [KEY=VALUE ...]
490
516
  Apply custom headers to all Confluence API requests.
491
517
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
492
518
  ```
@@ -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.5
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,13 @@ 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: json_strong_typing>=0.4
27
27
  Requires-Dist: lxml>=6.0
28
28
  Requires-Dist: markdown>=3.8
29
29
  Requires-Dist: pymdown-extensions>=10.16
30
30
  Requires-Dist: PyYAML>=6.0
31
31
  Requires-Dist: requests>=2.32
32
- Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
32
+ Requires-Dist: typing-extensions>=4.14; python_version < "3.12"
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
35
35
  Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
@@ -38,6 +38,8 @@ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
38
38
  Requires-Dist: types-requests>=2.32; extra == "dev"
39
39
  Requires-Dist: mypy>=1.16; extra == "dev"
40
40
  Requires-Dist: ruff>=0.12; extra == "dev"
41
+ Provides-Extra: formulas
42
+ Requires-Dist: matplotlib>=3.9; extra == "formulas"
41
43
  Dynamic: license-file
42
44
 
43
45
  # Publish Markdown files to Confluence wiki
@@ -57,7 +59,7 @@ This Python package
57
59
  * Sections and subsections
58
60
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
61
  * 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>`)
62
+ * Subscript and superscript
61
63
  * Math formulas with LaTeX notation
62
64
  * Emoji
63
65
  * Ordered and unordered lists
@@ -71,7 +73,7 @@ This Python package
71
73
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
74
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
75
  * draw\.io diagrams
74
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
76
+ * [Mermaid diagrams](https://mermaid.live/)
75
77
  * Confluence status labels and date widget
76
78
 
77
79
  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 +96,12 @@ pip install markdown-to-confluence
94
96
  npm install -g @mermaid-js/mermaid-cli
95
97
  ```
96
98
 
99
+ **Optional.** Converting formulas and equations to PNG or SVG images requires [Matplotlib](https://matplotlib.org/):
100
+
101
+ ```sh
102
+ pip install matplotlib
103
+ ```
104
+
97
105
  ### Marketplace apps
98
106
 
99
107
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -252,6 +260,12 @@ Root page
252
260
  └── Ethical considerations
253
261
  ```
254
262
 
263
+ ### Subscript and superscript
264
+
265
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
266
+
267
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
268
+
255
269
  ### Emoji
256
270
 
257
271
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -278,6 +292,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
278
292
  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
293
  ```
280
294
 
295
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
296
+
281
297
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
282
298
 
283
299
  | Color name | CSS attribute value |
@@ -357,6 +373,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
357
373
 
358
374
  | Markdown code | Confluence equivalent |
359
375
  | :----------------------------------------- | :------------------------------------------------------ |
376
+ | `[[_TOC_]]` | table of contents (based on headings) |
377
+ | `[[_LISTING_]]` | child pages (of current page) |
360
378
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
379
  | `![My label][STATUS-PURPLE]` | purple status label |
362
380
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -405,13 +423,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
405
423
 
406
424
  ### Page title
407
425
 
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:
426
+ *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
427
 
410
428
  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
429
  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`).
430
+ 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
431
 
414
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
432
+ 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
433
 
416
434
  ### Labels
417
435
 
@@ -446,16 +464,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
446
464
 
447
465
  ### draw\.io diagrams
448
466
 
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.
467
+ 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
468
 
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.
469
+ 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
470
 
453
471
  ### Mermaid diagrams
454
472
 
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:
473
+ 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:
474
+
475
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
476
+ * a fenced code block with the language specifier `mermaid`.
456
477
 
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.
478
+ *md2conf* offers two options to publish the diagram:
479
+
480
+ 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.
481
+ 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
482
 
460
483
  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
484
 
@@ -465,6 +488,10 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
465
488
 
466
489
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
467
490
 
491
+ ### Links to attachments
492
+
493
+ 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.
494
+
468
495
  ### Implicit URLs
469
496
 
470
497
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
@@ -491,10 +518,7 @@ Use the `--help` switch to get a full list of supported command-line options:
491
518
 
492
519
  ```console
493
520
  $ 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
521
+ usage: md2conf mdpath [OPTIONS]
498
522
 
499
523
  positional arguments:
500
524
  mdpath Path to Markdown file or directory to convert and publish.
@@ -518,17 +542,21 @@ options:
518
542
  --generated-by GENERATED_BY
519
543
  Add prompt to pages (default: 'This page has been generated with a tool.').
520
544
  --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}
545
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
546
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
547
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
548
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
549
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
550
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
551
+ --diagram-output-format {png,svg}
526
552
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
553
+ --render-mermaid-format FORMAT
554
+ Format for rendering Mermaid diagrams (default: 'png').
527
555
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
528
556
  --no-heading-anchors Don't place an anchor at each section heading.
529
557
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
530
558
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
531
- --headers [KEY=VALUE ...]
559
+ --headers KEY=VALUE [KEY=VALUE ...]
532
560
  Apply custom headers to all Confluence API requests.
533
561
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
534
562
  ```
@@ -21,6 +21,7 @@ md2conf/domain.py
21
21
  md2conf/drawio.py
22
22
  md2conf/entities.dtd
23
23
  md2conf/extra.py
24
+ md2conf/latex.py
24
25
  md2conf/local.py
25
26
  md2conf/markdown.py
26
27
  md2conf/matcher.py
@@ -31,6 +32,7 @@ md2conf/properties.py
31
32
  md2conf/puppeteer-config.json
32
33
  md2conf/py.typed
33
34
  md2conf/scanner.py
35
+ md2conf/text.py
34
36
  md2conf/toc.py
35
37
  md2conf/uri.py
36
38
  md2conf/xml.py
@@ -42,7 +44,10 @@ tests/test_matcher.py
42
44
  tests/test_mermaid.py
43
45
  tests/test_processor.py
44
46
  tests/test_scanner.py
47
+ tests/test_text.py
45
48
  tests/test_unit.py
49
+ tests/test_xml.py
50
+ tests/utility.py
46
51
  tests/source/admonition.md
47
52
  tests/source/alert.md
48
53
  tests/source/anchors.md
@@ -63,6 +68,7 @@ tests/source/table.md
63
68
  tests/source/tags.md
64
69
  tests/source/tasklist.md
65
70
  tests/source/title.md
71
+ tests/source/toc.md
66
72
  tests/source/figure/diagram.drawio
67
73
  tests/source/figure/diagram.drawio.png
68
74
  tests/source/figure/diagram.drawio.svg
@@ -87,4 +93,5 @@ tests/target/status.xml
87
93
  tests/target/table.xml
88
94
  tests/target/tags.xml
89
95
  tests/target/tasklist.xml
96
+ tests/target/toc.xml
90
97
  tests/target/images/images.xml
@@ -1,4 +1,4 @@
1
- json_strong_typing>=0.3.9
1
+ json_strong_typing>=0.4
2
2
  lxml>=6.0
3
3
  markdown>=3.8
4
4
  pymdown-extensions>=10.16
@@ -6,7 +6,7 @@ PyYAML>=6.0
6
6
  requests>=2.32
7
7
 
8
8
  [:python_version < "3.12"]
9
- typing_extensions>=4.14
9
+ typing-extensions>=4.14
10
10
 
11
11
  [dev]
12
12
  types-lxml>=2025.3.30
@@ -18,3 +18,6 @@ ruff>=0.12
18
18
 
19
19
  [dev:python_version >= "3.10"]
20
20
  markdown_doc>=0.1.4
21
+
22
+ [formulas]
23
+ matplotlib>=3.9
@@ -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.5"
9
9
  __author__ = "Levente Hunyadi"
10
10
  __copyright__ = "Copyright 2022-2025, Levente Hunyadi"
11
11
  __license__ = "MIT"