markdown-to-confluence 0.4.2__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.2/markdown_to_confluence.egg-info → markdown_to_confluence-0.4.4}/PKG-INFO +61 -14
  2. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/README.md +60 -13
  3. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4/markdown_to_confluence.egg-info}/PKG-INFO +61 -14
  4. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/SOURCES.txt +14 -1
  5. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/__init__.py +1 -1
  6. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/__main__.py +42 -10
  7. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/api.py +3 -1
  8. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/application.py +6 -3
  9. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/converter.py +440 -565
  10. markdown_to_confluence-0.4.4/md2conf/csf.py +151 -0
  11. markdown_to_confluence-0.4.4/md2conf/domain.py +46 -0
  12. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/drawio.py +49 -0
  13. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/local.py +9 -4
  14. markdown_to_confluence-0.4.4/md2conf/markdown.py +114 -0
  15. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/processor.py +2 -1
  16. markdown_to_confluence-0.4.4/md2conf/toc.py +89 -0
  17. markdown_to_confluence-0.4.4/md2conf/uri.py +46 -0
  18. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/xml.py +47 -14
  19. markdown_to_confluence-0.4.4/tests/source/macro.md +15 -0
  20. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/mermaid.md +0 -3
  21. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/sections.md +23 -4
  22. markdown_to_confluence-0.4.4/tests/source/status.md +14 -0
  23. markdown_to_confluence-0.4.4/tests/source/table.md +28 -0
  24. markdown_to_confluence-0.4.4/tests/source/tasklist.md +6 -0
  25. markdown_to_confluence-0.4.4/tests/target/macro.xml +15 -0
  26. markdown_to_confluence-0.4.4/tests/target/mermaid.xml +54 -0
  27. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/sections.xml +12 -4
  28. markdown_to_confluence-0.4.4/tests/target/status.xml +32 -0
  29. markdown_to_confluence-0.4.4/tests/target/table.xml +81 -0
  30. markdown_to_confluence-0.4.4/tests/target/tasklist.xml +20 -0
  31. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/test_conversion.py +34 -10
  32. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/test_processor.py +1 -1
  33. markdown_to_confluence-0.4.4/tests/test_unit.py +121 -0
  34. markdown_to_confluence-0.4.2/tests/target/mermaid.xml +0 -113
  35. markdown_to_confluence-0.4.2/tests/test_unit.py +0 -42
  36. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/LICENSE +0 -0
  37. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/MANIFEST.in +0 -0
  38. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
  39. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
  40. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/requires.txt +0 -0
  41. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/top_level.txt +0 -0
  42. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/markdown_to_confluence.egg-info/zip-safe +0 -0
  43. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/collection.py +0 -0
  44. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/entities.dtd +0 -0
  45. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/extra.py +0 -0
  46. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/matcher.py +0 -0
  47. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/mermaid.py +0 -0
  48. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/metadata.py +0 -0
  49. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/properties.py +0 -0
  50. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/puppeteer-config.json +0 -0
  51. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/py.typed +0 -0
  52. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/md2conf/scanner.py +0 -0
  53. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/pyproject.toml +0 -0
  54. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/setup.cfg +0 -0
  55. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/setup.py +0 -0
  56. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/__init__.py +0 -0
  57. {markdown_to_confluence-0.4.2/md2conf → markdown_to_confluence-0.4.4/tests}/emoji.py +0 -0
  58. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/admonition.md +0 -0
  59. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/alert.md +0 -0
  60. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/anchors.md +0 -0
  61. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/basic.md +0 -0
  62. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/code.md +0 -0
  63. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/collapsed.md +0 -0
  64. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/fenced.md +0 -0
  65. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio +0 -0
  66. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio.png +0 -0
  67. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/figure/diagram.drawio.svg +0 -0
  68. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/figure/raster.png +0 -0
  69. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/figure/vector.svg +0 -0
  70. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/footnote.md +0 -0
  71. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/ignore.md +0 -0
  72. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/images/images.md +0 -0
  73. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/images.md +0 -0
  74. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/math.md +0 -0
  75. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/missing.md +0 -0
  76. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/tags.md +0 -0
  77. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/source/title.md +0 -0
  78. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/admonition.xml +0 -0
  79. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/alert.xml +0 -0
  80. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/anchors.xml +0 -0
  81. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/basic.xml +0 -0
  82. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/code.xml +0 -0
  83. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/collapsed.xml +0 -0
  84. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/fenced.xml +0 -0
  85. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/footnote.xml +0 -0
  86. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/images/images.xml +0 -0
  87. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/images.xml +0 -0
  88. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/math.xml +0 -0
  89. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/missing.xml +0 -0
  90. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/target/tags.xml +0 -0
  91. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/test_drawio.py +0 -0
  92. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/test_matcher.py +0 -0
  93. {markdown_to_confluence-0.4.2 → markdown_to_confluence-0.4.4}/tests/test_mermaid.py +0 -0
  94. {markdown_to_confluence-0.4.2 → 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.2
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>
@@ -58,7 +58,7 @@ This Python package
58
58
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
59
  * Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
60
60
  * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
61
- * Math formulas with LaTeX notation [^math]
61
+ * Math formulas with LaTeX notation
62
62
  * Emoji
63
63
  * Ordered and unordered lists
64
64
  * Block quotes
@@ -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
- * draw\.io diagrams [^drawio]
73
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images) [^mermaid]
72
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
+ * draw\.io diagrams
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
 
@@ -84,9 +86,9 @@ pip install markdown-to-confluence
84
86
 
85
87
  ### Command-line utilities
86
88
 
87
- **Optional.** Converting `*.drawio` diagrams into PNG or SVG images requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
89
+ **Optional.** Converting `*.drawio` diagrams to PNG or SVG images before uploading to Confluence as attachments requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
88
90
 
89
- **Optional.** Converting code blocks of Mermaid diagrams into PNG or SVG images requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
91
+ **Optional.** Converting code blocks of Mermaid diagrams to PNG or SVG images before uploading to Confluence as attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
90
92
 
91
93
  ```sh
92
94
  npm install -g @mermaid-js/mermaid-cli
@@ -98,9 +100,9 @@ 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 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
- **Optional.** Displaying formulas and equations requires [LaTeX Math marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations).
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
 
105
107
  ## Getting started
106
108
 
@@ -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`).
@@ -523,7 +574,3 @@ FROM leventehunyadi/md2conf:latest
523
574
 
524
575
  CMD ["-d", "example.atlassian.net", "-u", "levente.hunyadi@instructure.com", "-a", "0123456789abcdef", "-s", "SPACE", "./"]
525
576
  ```
526
-
527
- [^math]: Requires installing Confluence plugin [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
528
- [^drawio]: Converting draw\.io diagrams to images before uploading to Confluence requires an installation of [draw.io](https://www.drawio.com/). Editable draw\.io diagrams require separate marketplace app.
529
- [^mermaid]: Converting Mermaid diagrams to images before uploading to Confluence requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Displaying Mermaid diagrams on the fly requires separate marketplace app.
@@ -16,7 +16,7 @@ This Python package
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
18
  * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
19
- * Math formulas with LaTeX notation [^math]
19
+ * Math formulas with LaTeX notation
20
20
  * Emoji
21
21
  * Ordered and unordered lists
22
22
  * Block quotes
@@ -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
- * draw\.io diagrams [^drawio]
31
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images) [^mermaid]
30
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
31
+ * draw\.io diagrams
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
 
@@ -42,9 +44,9 @@ pip install markdown-to-confluence
42
44
 
43
45
  ### Command-line utilities
44
46
 
45
- **Optional.** Converting `*.drawio` diagrams into PNG or SVG images requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
47
+ **Optional.** Converting `*.drawio` diagrams to PNG or SVG images before uploading to Confluence as attachments requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
46
48
 
47
- **Optional.** Converting code blocks of Mermaid diagrams into PNG or SVG images requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
49
+ **Optional.** Converting code blocks of Mermaid diagrams to PNG or SVG images before uploading to Confluence as attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
48
50
 
49
51
  ```sh
50
52
  npm install -g @mermaid-js/mermaid-cli
@@ -56,9 +58,9 @@ 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 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
- **Optional.** Displaying formulas and equations requires [LaTeX Math marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations).
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
 
63
65
  ## Getting started
64
66
 
@@ -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`).
@@ -481,7 +532,3 @@ FROM leventehunyadi/md2conf:latest
481
532
 
482
533
  CMD ["-d", "example.atlassian.net", "-u", "levente.hunyadi@instructure.com", "-a", "0123456789abcdef", "-s", "SPACE", "./"]
483
534
  ```
484
-
485
- [^math]: Requires installing Confluence plugin [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
486
- [^drawio]: Converting draw\.io diagrams to images before uploading to Confluence requires an installation of [draw.io](https://www.drawio.com/). Editable draw\.io diagrams require separate marketplace app.
487
- [^mermaid]: Converting Mermaid diagrams to images before uploading to Confluence requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Displaying Mermaid diagrams on the fly requires separate marketplace app.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.4.2
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>
@@ -58,7 +58,7 @@ This Python package
58
58
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
59
  * Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
60
60
  * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
61
- * Math formulas with LaTeX notation [^math]
61
+ * Math formulas with LaTeX notation
62
62
  * Emoji
63
63
  * Ordered and unordered lists
64
64
  * Block quotes
@@ -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
- * draw\.io diagrams [^drawio]
73
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images) [^mermaid]
72
+ * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
+ * draw\.io diagrams
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
 
@@ -84,9 +86,9 @@ pip install markdown-to-confluence
84
86
 
85
87
  ### Command-line utilities
86
88
 
87
- **Optional.** Converting `*.drawio` diagrams into PNG or SVG images requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
89
+ **Optional.** Converting `*.drawio` diagrams to PNG or SVG images before uploading to Confluence as attachments requires installing [draw.io](https://www.drawio.com/). (Refer to `--render-drawio`.)
88
90
 
89
- **Optional.** Converting code blocks of Mermaid diagrams into PNG or SVG images requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
91
+ **Optional.** Converting code blocks of Mermaid diagrams to PNG or SVG images before uploading to Confluence as attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). (Refer to `--render-mermaid`.)
90
92
 
91
93
  ```sh
92
94
  npm install -g @mermaid-js/mermaid-cli
@@ -98,9 +100,9 @@ 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 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
- **Optional.** Displaying formulas and equations requires [LaTeX Math marketplace app](https://marketplace.atlassian.com/apps/1226109/latex-math-for-confluence-math-formula-equations).
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
 
105
107
  ## Getting started
106
108
 
@@ -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`).
@@ -523,7 +574,3 @@ FROM leventehunyadi/md2conf:latest
523
574
 
524
575
  CMD ["-d", "example.atlassian.net", "-u", "levente.hunyadi@instructure.com", "-a", "0123456789abcdef", "-s", "SPACE", "./"]
525
576
  ```
526
-
527
- [^math]: Requires installing Confluence plugin [LaTeX Math for Confluence - Math Formula & Equations](https://help.narva.net/latex-math-for-confluence/).
528
- [^drawio]: Converting draw\.io diagrams to images before uploading to Confluence requires an installation of [draw.io](https://www.drawio.com/). Editable draw\.io diagrams require separate marketplace app.
529
- [^mermaid]: Converting Mermaid diagrams to images before uploading to Confluence requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Displaying Mermaid diagrams on the fly requires separate marketplace app.
@@ -16,11 +16,13 @@ md2conf/api.py
16
16
  md2conf/application.py
17
17
  md2conf/collection.py
18
18
  md2conf/converter.py
19
+ md2conf/csf.py
20
+ md2conf/domain.py
19
21
  md2conf/drawio.py
20
- md2conf/emoji.py
21
22
  md2conf/entities.dtd
22
23
  md2conf/extra.py
23
24
  md2conf/local.py
25
+ md2conf/markdown.py
24
26
  md2conf/matcher.py
25
27
  md2conf/mermaid.py
26
28
  md2conf/metadata.py
@@ -29,8 +31,11 @@ md2conf/properties.py
29
31
  md2conf/puppeteer-config.json
30
32
  md2conf/py.typed
31
33
  md2conf/scanner.py
34
+ md2conf/toc.py
35
+ md2conf/uri.py
32
36
  md2conf/xml.py
33
37
  tests/__init__.py
38
+ tests/emoji.py
34
39
  tests/test_conversion.py
35
40
  tests/test_drawio.py
36
41
  tests/test_matcher.py
@@ -48,11 +53,15 @@ tests/source/fenced.md
48
53
  tests/source/footnote.md
49
54
  tests/source/ignore.md
50
55
  tests/source/images.md
56
+ tests/source/macro.md
51
57
  tests/source/math.md
52
58
  tests/source/mermaid.md
53
59
  tests/source/missing.md
54
60
  tests/source/sections.md
61
+ tests/source/status.md
62
+ tests/source/table.md
55
63
  tests/source/tags.md
64
+ tests/source/tasklist.md
56
65
  tests/source/title.md
57
66
  tests/source/figure/diagram.drawio
58
67
  tests/source/figure/diagram.drawio.png
@@ -69,9 +78,13 @@ tests/target/collapsed.xml
69
78
  tests/target/fenced.xml
70
79
  tests/target/footnote.xml
71
80
  tests/target/images.xml
81
+ tests/target/macro.xml
72
82
  tests/target/math.xml
73
83
  tests/target/mermaid.xml
74
84
  tests/target/missing.xml
75
85
  tests/target/sections.xml
86
+ tests/target/status.xml
87
+ tests/target/table.xml
76
88
  tests/target/tags.xml
89
+ tests/target/tasklist.xml
77
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.2"
8
+ __version__ = "0.4.4"
9
9
  __author__ = "Levente Hunyadi"
10
10
  __copyright__ = "Copyright 2022-2025, Levente Hunyadi"
11
11
  __license__ = "MIT"
@@ -17,14 +17,9 @@ import typing
17
17
  from pathlib import Path
18
18
  from typing import Any, Iterable, Literal, Optional, Sequence, Union
19
19
 
20
- import requests
21
-
22
20
  from . import __version__
23
- from .api import ConfluenceAPI
24
- from .application import Application
25
- from .converter import ConfluenceDocumentOptions, ConfluencePageID
21
+ from .domain import ConfluenceDocumentOptions, ConfluencePageID
26
22
  from .extra import override
27
- from .local import LocalConverter
28
23
  from .metadata import ConfluenceSiteMetadata
29
24
  from .properties import ArgumentError, ConfluenceConnectionProperties, ConfluenceSiteProperties
30
25
 
@@ -52,7 +47,7 @@ class Arguments(argparse.Namespace):
52
47
 
53
48
 
54
49
  class KwargsAppendAction(argparse.Action):
55
- """Append key-value pairs to a dictionary"""
50
+ """Append key-value pairs to a dictionary."""
56
51
 
57
52
  @override
58
53
  def __call__(
@@ -72,6 +67,30 @@ class KwargsAppendAction(argparse.Action):
72
67
  setattr(namespace, self.dest, d)
73
68
 
74
69
 
70
+ def unsupported(prefer: str) -> type[argparse.Action]:
71
+ class UnsupportedAction(argparse.Action):
72
+ """Display an error for unsupported command-line options."""
73
+
74
+ @override
75
+ def __call__(
76
+ self,
77
+ parser: argparse.ArgumentParser,
78
+ namespace: argparse.Namespace,
79
+ values: Union[None, str, Sequence[Any]],
80
+ option_string: Optional[str] = None,
81
+ ) -> None:
82
+ raise argparse.ArgumentError(
83
+ self,
84
+ f"this command-line option is no longer supported, use `--{prefer}`",
85
+ )
86
+
87
+ @override
88
+ def __repr__(self) -> str:
89
+ return f"{unsupported.__name__}({repr(prefer)})"
90
+
91
+ return UnsupportedAction
92
+
93
+
75
94
  class PositionalOnlyHelpFormatter(argparse.HelpFormatter):
76
95
  def _format_usage(
77
96
  self,
@@ -189,12 +208,18 @@ def main() -> None:
189
208
  help="Inline Mermaid diagram in Confluence page. (Marketplace app required.)",
190
209
  )
191
210
  parser.add_argument(
192
- "--render-mermaid-format",
211
+ "--diagram-output-format",
193
212
  dest="diagram_output_format",
194
213
  choices=["png", "svg"],
195
214
  default="png",
196
215
  help="Format for rendering Mermaid and draw.io diagrams (default: 'png').",
197
216
  )
217
+ parser.add_argument(
218
+ "--render-mermaid-format",
219
+ action=unsupported("diagram-output-format"),
220
+ metavar="FORMAT",
221
+ help="Format for rendering Mermaid diagrams (default: 'png').",
222
+ )
198
223
  parser.add_argument(
199
224
  "--heading-anchors",
200
225
  action="store_true",
@@ -256,6 +281,8 @@ def main() -> None:
256
281
  webui_links=args.webui_links,
257
282
  )
258
283
  if args.local:
284
+ from .local import LocalConverter
285
+
259
286
  try:
260
287
  site_properties = ConfluenceSiteProperties(
261
288
  domain=args.domain,
@@ -271,6 +298,11 @@ def main() -> None:
271
298
  )
272
299
  LocalConverter(options, site_metadata).process(args.mdpath)
273
300
  else:
301
+ from requests import HTTPError, JSONDecodeError
302
+
303
+ from .api import ConfluenceAPI
304
+ from .application import Application
305
+
274
306
  try:
275
307
  properties = ConfluenceConnectionProperties(
276
308
  api_url=args.api_url,
@@ -289,14 +321,14 @@ def main() -> None:
289
321
  api,
290
322
  options,
291
323
  ).process(args.mdpath)
292
- except requests.exceptions.HTTPError as err:
324
+ except HTTPError as err:
293
325
  logging.error(err)
294
326
 
295
327
  # print details for a response with JSON body
296
328
  if err.response is not None:
297
329
  try:
298
330
  logging.error(err.response.json())
299
- except requests.exceptions.JSONDecodeError:
331
+ except JSONDecodeError:
300
332
  pass
301
333
 
302
334
  sys.exit(1)
@@ -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")