markdown-to-confluence 0.4.3__tar.gz → 0.4.4__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 (94) hide show
  1. {markdown_to_confluence-0.4.3/markdown_to_confluence.egg-info → markdown_to_confluence-0.4.4}/PKG-INFO +55 -4
  2. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/README.md +54 -3
  3. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4/markdown_to_confluence.egg-info}/PKG-INFO +55 -4
  4. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/SOURCES.txt +10 -1
  5. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/__init__.py +1 -1
  6. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/api.py +3 -1
  7. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/application.py +4 -2
  8. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/converter.py +411 -405
  9. markdown_to_confluence-0.4.4/md2conf/csf.py +151 -0
  10. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/local.py +1 -1
  11. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/markdown.py +17 -11
  12. markdown_to_confluence-0.4.4/md2conf/toc.py +89 -0
  13. markdown_to_confluence-0.4.4/md2conf/uri.py +46 -0
  14. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/xml.py +47 -14
  15. markdown_to_confluence-0.4.4/tests/source/macro.md +15 -0
  16. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/mermaid.md +0 -3
  17. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/sections.md +23 -4
  18. markdown_to_confluence-0.4.4/tests/source/status.md +14 -0
  19. markdown_to_confluence-0.4.4/tests/source/tasklist.md +6 -0
  20. markdown_to_confluence-0.4.4/tests/target/macro.xml +15 -0
  21. markdown_to_confluence-0.4.4/tests/target/mermaid.xml +54 -0
  22. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/sections.xml +12 -4
  23. markdown_to_confluence-0.4.4/tests/target/status.xml +32 -0
  24. markdown_to_confluence-0.4.4/tests/target/tasklist.xml +20 -0
  25. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_conversion.py +33 -10
  26. markdown_to_confluence-0.4.4/tests/test_unit.py +121 -0
  27. markdown_to_confluence-0.4.3/tests/target/mermaid.xml +0 -113
  28. markdown_to_confluence-0.4.3/tests/test_unit.py +0 -49
  29. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/LICENSE +0 -0
  30. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/MANIFEST.in +0 -0
  31. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
  32. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
  33. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/requires.txt +0 -0
  34. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/top_level.txt +0 -0
  35. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/zip-safe +0 -0
  36. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/__main__.py +0 -0
  37. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/collection.py +0 -0
  38. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/domain.py +0 -0
  39. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/drawio.py +0 -0
  40. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/entities.dtd +0 -0
  41. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/extra.py +0 -0
  42. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/matcher.py +0 -0
  43. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/mermaid.py +0 -0
  44. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/metadata.py +0 -0
  45. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/processor.py +0 -0
  46. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/properties.py +0 -0
  47. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/puppeteer-config.json +0 -0
  48. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/py.typed +0 -0
  49. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/md2conf/scanner.py +0 -0
  50. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/pyproject.toml +0 -0
  51. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/setup.cfg +0 -0
  52. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/setup.py +0 -0
  53. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/__init__.py +0 -0
  54. {markdown_to_confluence-0.4.3/md2conf → markdown_to_confluence-0.4.4/tests}/emoji.py +0 -0
  55. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/admonition.md +0 -0
  56. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/alert.md +0 -0
  57. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/anchors.md +0 -0
  58. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/basic.md +0 -0
  59. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/code.md +0 -0
  60. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/collapsed.md +0 -0
  61. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/fenced.md +0 -0
  62. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio +0 -0
  63. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio.png +0 -0
  64. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio.svg +0 -0
  65. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/figure/raster.png +0 -0
  66. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/figure/vector.svg +0 -0
  67. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/footnote.md +0 -0
  68. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/ignore.md +0 -0
  69. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/images/images.md +0 -0
  70. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/images.md +0 -0
  71. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/math.md +0 -0
  72. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/missing.md +0 -0
  73. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/table.md +0 -0
  74. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/tags.md +0 -0
  75. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/source/title.md +0 -0
  76. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/admonition.xml +0 -0
  77. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/alert.xml +0 -0
  78. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/anchors.xml +0 -0
  79. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/basic.xml +0 -0
  80. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/code.xml +0 -0
  81. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/collapsed.xml +0 -0
  82. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/fenced.xml +0 -0
  83. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/footnote.xml +0 -0
  84. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/images/images.xml +0 -0
  85. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/images.xml +0 -0
  86. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/math.xml +0 -0
  87. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/missing.xml +0 -0
  88. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/table.xml +0 -0
  89. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/target/tags.xml +0 -0
  90. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_drawio.py +0 -0
  91. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_matcher.py +0 -0
  92. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_mermaid.py +0 -0
  93. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_processor.py +0 -0
  94. {markdown_to_confluence-0.4.3 → markdown_to_confluence-0.4.4}/tests/test_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.4.3
3
+ Version: 0.4.4
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>
@@ -69,8 +69,10 @@ This Python package
69
69
  * [Table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents)
70
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)
71
71
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
72
73
  * draw\.io diagrams
73
74
  * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
75
+ * Confluence status labels and date widget
74
76
 
75
77
  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.
76
78
 
@@ -98,7 +100,7 @@ As authors of *md2conf*, we don't endorse or support any particular Confluence m
98
100
 
99
101
  **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
102
 
101
- **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a marketplace app. (Refer to `--no-render-mermaid`.)
103
+ **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence). (Refer to `--no-render-mermaid`.)
102
104
 
103
105
  **Optional.** Displaying formulas and equations in Confluence requires [marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations), refer to [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
104
106
 
@@ -279,7 +281,7 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
279
281
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
280
282
 
281
283
  | Color name | CSS attribute value |
282
- | ------------- | ------------------- |
284
+ | :------------ | :------------------ |
283
285
  | bold blue | rgb(7,71,166) |
284
286
  | blue | rgb(76,154,255) |
285
287
  | subtle blue | rgb(179,212,255) |
@@ -340,6 +342,45 @@ $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
340
342
 
341
343
  Displaying math formulas in Confluence requires the extension [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
342
344
 
345
+ ### HTML in Markdown
346
+
347
+ *md2conf* relays HTML elements nested in Markdown content to Confluence (such as `e<sup>x</sup>` for superscript). However, Confluence uses an extension of XHTML, i.e. the content must qualify as valid XML too. In particular, unterminated tags (e.g. `<br>` or `<img ...>`) or inconsistent nesting (e.g. `<b><i></b></i>`) are not permitted, and will raise an XML parsing error. When an HTML element has no content such as `<br>` or `<img>`, use a self-closing tag:
348
+
349
+ ```html
350
+ <br/>
351
+ <img src="image.png" width="24" height="24" />
352
+ ```
353
+
354
+ ### Confluence widgets
355
+
356
+ *md2conf* supports some Confluence widgets. If the appropriate code is found when a Markdown document is processed, it is automatically replaced with Confluence Storage Format XML that produces the corresponding widget.
357
+
358
+ | Markdown code | Confluence equivalent |
359
+ | :----------------------------------------- | :------------------------------------------------------ |
360
+ | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
+ | `![My label][STATUS-PURPLE]` | purple status label |
362
+ | `![My label][STATUS-BLUE]` | blue status label |
363
+ | `![My label][STATUS-RED]` | red status label |
364
+ | `![My label][STATUS-YELLOW]` | yellow status label |
365
+ | `![My label][STATUS-GREEN]` | green status label |
366
+ | `<input type="date" value="YYYY-MM-DD" />` | date widget (with year, month and day set as specified) |
367
+
368
+ 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
+
370
+ ````md
371
+ ```csf
372
+ <ac:structured-macro ac:name="panel" ac:schema-version="1">
373
+ <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
374
+ <ac:parameter ac:name="panelIconId">1f642</ac:parameter>
375
+ <ac:parameter ac:name="panelIconText">&#128578;</ac:parameter>
376
+ <ac:parameter ac:name="bgColor">#FFF0B3</ac:parameter>
377
+ <ac:rich-text-body>
378
+ <p>A <em>custom colored panel</em> with a 🙂 emoji</p>
379
+ </ac:rich-text-body>
380
+ </ac:structured-macro>
381
+ ```
382
+ ````
383
+
343
384
  ### Ignoring files
344
385
 
345
386
  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.
@@ -414,7 +455,7 @@ With the command-line option `--render-drawio`, images with embedded draw\.io di
414
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:
415
456
 
416
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.
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.
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.
418
459
 
419
460
  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:
420
461
 
@@ -424,6 +465,16 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
424
465
 
425
466
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
426
467
 
468
+ ### Implicit URLs
469
+
470
+ *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
471
+
472
+ ```md
473
+ [CUSTOM-URL]: https://example.com/path/to/resource
474
+ ```
475
+
476
+ Specifically, image references for status labels (e.g. `![My label][STATUS-RED]`) are automatically resolved into internally defined URLs via this mechanism.
477
+
427
478
  ### Local output
428
479
 
429
480
  *md2conf* supports local output, in which the tool doesn't communicate with the Confluence REST API. Instead, it reads a single Markdown file or a directory of Markdown files, and writes Confluence Storage Format (`*.csf`) output for each document. (Confluence Storage Format is a derivative of XHTML with Confluence-specific tags for complex elements such as images with captions, code blocks, info panels, collapsed sections, etc.) You can push the generated output to Confluence by invoking the API (e.g. with `curl`).
@@ -27,8 +27,10 @@ This Python package
27
27
  * [Table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents)
28
28
  * [Admonitions](https://python-markdown.github.io/extensions/admonition/) and alert boxes in [GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) and [GitLab](https://docs.gitlab.com/ee/development/documentation/styleguide/#alert-boxes)
29
29
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
30
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
30
31
  * draw\.io diagrams
31
32
  * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
33
+ * Confluence status labels and date widget
32
34
 
33
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.
34
36
 
@@ -56,7 +58,7 @@ As authors of *md2conf*, we don't endorse or support any particular Confluence m
56
58
 
57
59
  **Optional.** Editable draw\.io diagrams require [draw.io Diagrams marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts). (Refer to `--no-render-drawio`.)
58
60
 
59
- **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a marketplace app. (Refer to `--no-render-mermaid`.)
61
+ **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence). (Refer to `--no-render-mermaid`.)
60
62
 
61
63
  **Optional.** Displaying formulas and equations in Confluence requires [marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations), refer to [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
62
64
 
@@ -237,7 +239,7 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
237
239
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
238
240
 
239
241
  | Color name | CSS attribute value |
240
- | ------------- | ------------------- |
242
+ | :------------ | :------------------ |
241
243
  | bold blue | rgb(7,71,166) |
242
244
  | blue | rgb(76,154,255) |
243
245
  | subtle blue | rgb(179,212,255) |
@@ -298,6 +300,45 @@ $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
298
300
 
299
301
  Displaying math formulas in Confluence requires the extension [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
300
302
 
303
+ ### HTML in Markdown
304
+
305
+ *md2conf* relays HTML elements nested in Markdown content to Confluence (such as `e<sup>x</sup>` for superscript). However, Confluence uses an extension of XHTML, i.e. the content must qualify as valid XML too. In particular, unterminated tags (e.g. `<br>` or `<img ...>`) or inconsistent nesting (e.g. `<b><i></b></i>`) are not permitted, and will raise an XML parsing error. When an HTML element has no content such as `<br>` or `<img>`, use a self-closing tag:
306
+
307
+ ```html
308
+ <br/>
309
+ <img src="image.png" width="24" height="24" />
310
+ ```
311
+
312
+ ### Confluence widgets
313
+
314
+ *md2conf* supports some Confluence widgets. If the appropriate code is found when a Markdown document is processed, it is automatically replaced with Confluence Storage Format XML that produces the corresponding widget.
315
+
316
+ | Markdown code | Confluence equivalent |
317
+ | :----------------------------------------- | :------------------------------------------------------ |
318
+ | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
319
+ | `![My label][STATUS-PURPLE]` | purple status label |
320
+ | `![My label][STATUS-BLUE]` | blue status label |
321
+ | `![My label][STATUS-RED]` | red status label |
322
+ | `![My label][STATUS-YELLOW]` | yellow status label |
323
+ | `![My label][STATUS-GREEN]` | green status label |
324
+ | `<input type="date" value="YYYY-MM-DD" />` | date widget (with year, month and day set as specified) |
325
+
326
+ 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.
327
+
328
+ ````md
329
+ ```csf
330
+ <ac:structured-macro ac:name="panel" ac:schema-version="1">
331
+ <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
332
+ <ac:parameter ac:name="panelIconId">1f642</ac:parameter>
333
+ <ac:parameter ac:name="panelIconText">&#128578;</ac:parameter>
334
+ <ac:parameter ac:name="bgColor">#FFF0B3</ac:parameter>
335
+ <ac:rich-text-body>
336
+ <p>A <em>custom colored panel</em> with a 🙂 emoji</p>
337
+ </ac:rich-text-body>
338
+ </ac:structured-macro>
339
+ ```
340
+ ````
341
+
301
342
  ### Ignoring files
302
343
 
303
344
  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.
@@ -372,7 +413,7 @@ With the command-line option `--render-drawio`, images with embedded draw\.io di
372
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:
373
414
 
374
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.
375
- 2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://atlasauthority.atlassian.net/wiki/spaces/MARKDOWNCLOUD/pages/2946826241/Diagram+Macro), which is processed by Confluence. You need a [marketplace app](https://marketplace.atlassian.com/apps/1211438/markdown-html-plantuml-latex-diagrams-open-api-mermaid) to turn macro definitions into images when a Confluence page is visited.
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.
376
417
 
377
418
  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:
378
419
 
@@ -382,6 +423,16 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
382
423
 
383
424
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
384
425
 
426
+ ### Implicit URLs
427
+
428
+ *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
429
+
430
+ ```md
431
+ [CUSTOM-URL]: https://example.com/path/to/resource
432
+ ```
433
+
434
+ Specifically, image references for status labels (e.g. `![My label][STATUS-RED]`) are automatically resolved into internally defined URLs via this mechanism.
435
+
385
436
  ### Local output
386
437
 
387
438
  *md2conf* supports local output, in which the tool doesn't communicate with the Confluence REST API. Instead, it reads a single Markdown file or a directory of Markdown files, and writes Confluence Storage Format (`*.csf`) output for each document. (Confluence Storage Format is a derivative of XHTML with Confluence-specific tags for complex elements such as images with captions, code blocks, info panels, collapsed sections, etc.) You can push the generated output to Confluence by invoking the API (e.g. with `curl`).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.4.3
3
+ Version: 0.4.4
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>
@@ -69,8 +69,10 @@ This Python package
69
69
  * [Table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents)
70
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)
71
71
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
72
73
  * draw\.io diagrams
73
74
  * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
75
+ * Confluence status labels and date widget
74
76
 
75
77
  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.
76
78
 
@@ -98,7 +100,7 @@ As authors of *md2conf*, we don't endorse or support any particular Confluence m
98
100
 
99
101
  **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
102
 
101
- **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a marketplace app. (Refer to `--no-render-mermaid`.)
103
+ **Optional.** Displaying Mermaid diagrams in Confluence without pre-rendering in the synchronization phase requires a [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence). (Refer to `--no-render-mermaid`.)
102
104
 
103
105
  **Optional.** Displaying formulas and equations in Confluence requires [marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations), refer to [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
104
106
 
@@ -279,7 +281,7 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
279
281
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
280
282
 
281
283
  | Color name | CSS attribute value |
282
- | ------------- | ------------------- |
284
+ | :------------ | :------------------ |
283
285
  | bold blue | rgb(7,71,166) |
284
286
  | blue | rgb(76,154,255) |
285
287
  | subtle blue | rgb(179,212,255) |
@@ -340,6 +342,45 @@ $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
340
342
 
341
343
  Displaying math formulas in Confluence requires the extension [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
342
344
 
345
+ ### HTML in Markdown
346
+
347
+ *md2conf* relays HTML elements nested in Markdown content to Confluence (such as `e<sup>x</sup>` for superscript). However, Confluence uses an extension of XHTML, i.e. the content must qualify as valid XML too. In particular, unterminated tags (e.g. `<br>` or `<img ...>`) or inconsistent nesting (e.g. `<b><i></b></i>`) are not permitted, and will raise an XML parsing error. When an HTML element has no content such as `<br>` or `<img>`, use a self-closing tag:
348
+
349
+ ```html
350
+ <br/>
351
+ <img src="image.png" width="24" height="24" />
352
+ ```
353
+
354
+ ### Confluence widgets
355
+
356
+ *md2conf* supports some Confluence widgets. If the appropriate code is found when a Markdown document is processed, it is automatically replaced with Confluence Storage Format XML that produces the corresponding widget.
357
+
358
+ | Markdown code | Confluence equivalent |
359
+ | :----------------------------------------- | :------------------------------------------------------ |
360
+ | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
+ | `![My label][STATUS-PURPLE]` | purple status label |
362
+ | `![My label][STATUS-BLUE]` | blue status label |
363
+ | `![My label][STATUS-RED]` | red status label |
364
+ | `![My label][STATUS-YELLOW]` | yellow status label |
365
+ | `![My label][STATUS-GREEN]` | green status label |
366
+ | `<input type="date" value="YYYY-MM-DD" />` | date widget (with year, month and day set as specified) |
367
+
368
+ 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
+
370
+ ````md
371
+ ```csf
372
+ <ac:structured-macro ac:name="panel" ac:schema-version="1">
373
+ <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
374
+ <ac:parameter ac:name="panelIconId">1f642</ac:parameter>
375
+ <ac:parameter ac:name="panelIconText">&#128578;</ac:parameter>
376
+ <ac:parameter ac:name="bgColor">#FFF0B3</ac:parameter>
377
+ <ac:rich-text-body>
378
+ <p>A <em>custom colored panel</em> with a 🙂 emoji</p>
379
+ </ac:rich-text-body>
380
+ </ac:structured-macro>
381
+ ```
382
+ ````
383
+
343
384
  ### Ignoring files
344
385
 
345
386
  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.
@@ -414,7 +455,7 @@ With the command-line option `--render-drawio`, images with embedded draw\.io di
414
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:
415
456
 
416
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.
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.
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.
418
459
 
419
460
  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:
420
461
 
@@ -424,6 +465,16 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
424
465
 
425
466
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
426
467
 
468
+ ### Implicit URLs
469
+
470
+ *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
471
+
472
+ ```md
473
+ [CUSTOM-URL]: https://example.com/path/to/resource
474
+ ```
475
+
476
+ Specifically, image references for status labels (e.g. `![My label][STATUS-RED]`) are automatically resolved into internally defined URLs via this mechanism.
477
+
427
478
  ### Local output
428
479
 
429
480
  *md2conf* supports local output, in which the tool doesn't communicate with the Confluence REST API. Instead, it reads a single Markdown file or a directory of Markdown files, and writes Confluence Storage Format (`*.csf`) output for each document. (Confluence Storage Format is a derivative of XHTML with Confluence-specific tags for complex elements such as images with captions, code blocks, info panels, collapsed sections, etc.) You can push the generated output to Confluence by invoking the API (e.g. with `curl`).
@@ -16,9 +16,9 @@ md2conf/api.py
16
16
  md2conf/application.py
17
17
  md2conf/collection.py
18
18
  md2conf/converter.py
19
+ md2conf/csf.py
19
20
  md2conf/domain.py
20
21
  md2conf/drawio.py
21
- md2conf/emoji.py
22
22
  md2conf/entities.dtd
23
23
  md2conf/extra.py
24
24
  md2conf/local.py
@@ -31,8 +31,11 @@ md2conf/properties.py
31
31
  md2conf/puppeteer-config.json
32
32
  md2conf/py.typed
33
33
  md2conf/scanner.py
34
+ md2conf/toc.py
35
+ md2conf/uri.py
34
36
  md2conf/xml.py
35
37
  tests/__init__.py
38
+ tests/emoji.py
36
39
  tests/test_conversion.py
37
40
  tests/test_drawio.py
38
41
  tests/test_matcher.py
@@ -50,12 +53,15 @@ tests/source/fenced.md
50
53
  tests/source/footnote.md
51
54
  tests/source/ignore.md
52
55
  tests/source/images.md
56
+ tests/source/macro.md
53
57
  tests/source/math.md
54
58
  tests/source/mermaid.md
55
59
  tests/source/missing.md
56
60
  tests/source/sections.md
61
+ tests/source/status.md
57
62
  tests/source/table.md
58
63
  tests/source/tags.md
64
+ tests/source/tasklist.md
59
65
  tests/source/title.md
60
66
  tests/source/figure/diagram.drawio
61
67
  tests/source/figure/diagram.drawio.png
@@ -72,10 +78,13 @@ tests/target/collapsed.xml
72
78
  tests/target/fenced.xml
73
79
  tests/target/footnote.xml
74
80
  tests/target/images.xml
81
+ tests/target/macro.xml
75
82
  tests/target/math.xml
76
83
  tests/target/mermaid.xml
77
84
  tests/target/missing.xml
78
85
  tests/target/sections.xml
86
+ tests/target/status.xml
79
87
  tests/target/table.xml
80
88
  tests/target/tags.xml
89
+ tests/target/tasklist.xml
81
90
  tests/target/images/images.xml
@@ -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.3"
8
+ __version__ = "0.4.4"
9
9
  __author__ = "Levente Hunyadi"
10
10
  __copyright__ = "Copyright 2022-2025, Levente Hunyadi"
11
11
  __license__ = "MIT"
@@ -27,6 +27,8 @@ from .properties import ArgumentError, ConfluenceConnectionProperties, Confluenc
27
27
 
28
28
  T = TypeVar("T")
29
29
 
30
+ mimetypes.add_type("text/vnd.mermaid", ".mmd", strict=True)
31
+
30
32
 
31
33
  def _json_to_object(
32
34
  typ: type[T],
@@ -642,7 +644,7 @@ class ConfluenceSession:
642
644
  return
643
645
  elif raw_data is not None:
644
646
  if not force and attachment.fileSize == len(raw_data):
645
- LOGGER.info("Up-to-date embedded image: %s", attachment_name)
647
+ LOGGER.info("Up-to-date embedded file: %s", attachment_name)
646
648
  return
647
649
  else:
648
650
  raise NotImplementedError("parameter match not exhaustive")
@@ -11,7 +11,8 @@ from pathlib import Path
11
11
  from typing import Optional
12
12
 
13
13
  from .api import ConfluenceContentProperty, ConfluenceLabel, ConfluenceSession, ConfluenceStatus
14
- from .converter import ConfluenceDocument, attachment_name, elements_from_string, get_volatile_attributes
14
+ from .converter import ConfluenceDocument, attachment_name, get_volatile_attributes, get_volatile_elements
15
+ from .csf import elements_from_string
15
16
  from .domain import ConfluenceDocumentOptions, ConfluencePageID
16
17
  from .extra import override, path_relative_to
17
18
  from .metadata import ConfluencePageMetadata
@@ -122,7 +123,7 @@ class SynchronizingProcessor(Processor):
122
123
  attachment_path=image_path,
123
124
  )
124
125
 
125
- for name, data in document.embedded_images.items():
126
+ for name, data in document.embedded_files.items():
126
127
  self.api.upload_attachment(
127
128
  page_id.page_id,
128
129
  name,
@@ -156,6 +157,7 @@ class SynchronizingProcessor(Processor):
156
157
  document.root,
157
158
  elements_from_string(page.content),
158
159
  skip_attributes=get_volatile_attributes(),
160
+ skip_elements=get_volatile_elements(),
159
161
  ):
160
162
  self.api.update_page(page_id.page_id, content, title=title, version=page.version.number + 1)
161
163
  else: