markdown-to-confluence 0.4.4__tar.gz → 0.4.6__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 (105) hide show
  1. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/LICENSE +1 -1
  2. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/PKG-INFO +83 -33
  3. markdown_to_confluence-0.4.4/markdown_to_confluence.egg-info/PKG-INFO → markdown_to_confluence-0.4.6/README.md +76 -72
  4. markdown_to_confluence-0.4.4/README.md → markdown_to_confluence-0.4.6/markdown_to_confluence.egg-info/PKG-INFO +122 -30
  5. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/SOURCES.txt +10 -2
  6. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/requires.txt +11 -2
  7. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/__init__.py +1 -1
  8. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/__main__.py +35 -39
  9. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/api.py +90 -20
  10. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/converter.py +585 -300
  11. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/csf.py +66 -0
  12. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/domain.py +2 -0
  13. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/drawio.py +18 -14
  14. markdown_to_confluence-0.4.6/md2conf/emoticon.py +22 -0
  15. markdown_to_confluence-0.4.6/md2conf/latex.py +245 -0
  16. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/local.py +2 -2
  17. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/markdown.py +3 -1
  18. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/mermaid.py +38 -29
  19. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/processor.py +1 -1
  20. markdown_to_confluence-0.4.4/md2conf/application.py → markdown_to_confluence-0.4.6/md2conf/publisher.py +28 -19
  21. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/scanner.py +46 -0
  22. markdown_to_confluence-0.4.6/md2conf/text.py +54 -0
  23. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/xml.py +37 -0
  24. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/pyproject.toml +7 -2
  25. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/emoji.py +18 -4
  26. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/anchors.md +10 -0
  27. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/basic.md +4 -2
  28. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/code.md +6 -0
  29. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/images.md +7 -3
  30. markdown_to_confluence-0.4.6/tests/source/missing.md +13 -0
  31. markdown_to_confluence-0.4.6/tests/source/toc.md +11 -0
  32. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/anchors.xml +5 -0
  33. markdown_to_confluence-0.4.6/tests/target/basic.xml +70 -0
  34. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/code.xml +8 -5
  35. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/collapsed.xml +0 -1
  36. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/fenced.xml +21 -13
  37. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/footnote.xml +1 -1
  38. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/images/images.xml +2 -4
  39. markdown_to_confluence-0.4.6/tests/target/images.xml +31 -0
  40. markdown_to_confluence-0.4.6/tests/target/missing.xml +16 -0
  41. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/status.xml +0 -1
  42. markdown_to_confluence-0.4.6/tests/target/table.xml +81 -0
  43. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/tags.xml +9 -9
  44. markdown_to_confluence-0.4.6/tests/target/toc.xml +15 -0
  45. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_conversion.py +38 -7
  46. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_drawio.py +4 -1
  47. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_matcher.py +2 -1
  48. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_mermaid.py +3 -1
  49. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_processor.py +2 -13
  50. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_scanner.py +42 -2
  51. markdown_to_confluence-0.4.6/tests/test_text.py +66 -0
  52. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/test_unit.py +19 -10
  53. markdown_to_confluence-0.4.6/tests/test_xml.py +115 -0
  54. markdown_to_confluence-0.4.6/tests/utility.py +41 -0
  55. markdown_to_confluence-0.4.4/tests/source/missing.md +0 -7
  56. markdown_to_confluence-0.4.4/tests/target/basic.xml +0 -59
  57. markdown_to_confluence-0.4.4/tests/target/images.xml +0 -39
  58. markdown_to_confluence-0.4.4/tests/target/missing.xml +0 -13
  59. markdown_to_confluence-0.4.4/tests/target/table.xml +0 -81
  60. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/MANIFEST.in +0 -0
  61. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
  62. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
  63. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/top_level.txt +0 -0
  64. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/markdown_to_confluence.egg-info/zip-safe +0 -0
  65. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/collection.py +0 -0
  66. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/entities.dtd +0 -0
  67. /markdown_to_confluence-0.4.4/md2conf/properties.py → /markdown_to_confluence-0.4.6/md2conf/environment.py +0 -0
  68. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/extra.py +0 -0
  69. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/matcher.py +0 -0
  70. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/metadata.py +0 -0
  71. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/puppeteer-config.json +0 -0
  72. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/py.typed +0 -0
  73. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/toc.py +0 -0
  74. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/md2conf/uri.py +0 -0
  75. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/setup.cfg +0 -0
  76. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/setup.py +0 -0
  77. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/__init__.py +0 -0
  78. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/admonition.md +0 -0
  79. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/alert.md +0 -0
  80. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/collapsed.md +0 -0
  81. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/fenced.md +0 -0
  82. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/figure/diagram.drawio +0 -0
  83. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/figure/diagram.drawio.png +0 -0
  84. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/figure/diagram.drawio.svg +0 -0
  85. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/figure/raster.png +0 -0
  86. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/figure/vector.svg +0 -0
  87. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/footnote.md +0 -0
  88. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/ignore.md +0 -0
  89. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/images/images.md +0 -0
  90. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/macro.md +0 -0
  91. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/math.md +0 -0
  92. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/mermaid.md +0 -0
  93. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/sections.md +0 -0
  94. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/status.md +0 -0
  95. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/table.md +0 -0
  96. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/tags.md +0 -0
  97. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/tasklist.md +0 -0
  98. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/source/title.md +0 -0
  99. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/admonition.xml +0 -0
  100. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/alert.xml +0 -0
  101. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/macro.xml +0 -0
  102. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/math.xml +0 -0
  103. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/mermaid.xml +0 -0
  104. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/tests/target/sections.xml +0 -0
  105. {markdown_to_confluence-0.4.4 → markdown_to_confluence-0.4.6}/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.6
4
4
  Summary: Publish Markdown files to Confluence wiki
5
5
  Author-email: Levente Hunyadi <hunyadi@gmail.com>
6
6
  Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
@@ -23,13 +23,15 @@ Classifier: Typing :: Typed
23
23
  Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
- Requires-Dist: json_strong_typing>=0.3.9
26
+ Requires-Dist: certifi>=2025.8.3; python_version < "3.10"
27
+ Requires-Dist: json_strong_typing>=0.4
27
28
  Requires-Dist: lxml>=6.0
28
29
  Requires-Dist: markdown>=3.8
29
30
  Requires-Dist: pymdown-extensions>=10.16
30
31
  Requires-Dist: PyYAML>=6.0
31
32
  Requires-Dist: requests>=2.32
32
- Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
33
+ Requires-Dist: truststore>=0.10; python_version >= "3.10"
34
+ Requires-Dist: typing-extensions>=4.14; python_version < "3.12"
33
35
  Provides-Extra: dev
34
36
  Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
35
37
  Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
@@ -38,6 +40,8 @@ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
38
40
  Requires-Dist: types-requests>=2.32; extra == "dev"
39
41
  Requires-Dist: mypy>=1.16; extra == "dev"
40
42
  Requires-Dist: ruff>=0.12; extra == "dev"
43
+ Provides-Extra: formulas
44
+ Requires-Dist: matplotlib>=3.9; extra == "formulas"
41
45
  Dynamic: license-file
42
46
 
43
47
  # Publish Markdown files to Confluence wiki
@@ -57,7 +61,7 @@ This Python package
57
61
  * Sections and subsections
58
62
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
63
  * Link to [sections on the same page](#getting-started) or [external locations](http://example.com/)
60
- * Subscript and superscript (with HTML tags `<sub>` and `<sup>`)
64
+ * Subscript and superscript
61
65
  * Math formulas with LaTeX notation
62
66
  * Emoji
63
67
  * Ordered and unordered lists
@@ -71,7 +75,7 @@ This Python package
71
75
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
76
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
77
  * draw\.io diagrams
74
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
78
+ * [Mermaid diagrams](https://mermaid.live/)
75
79
  * Confluence status labels and date widget
76
80
 
77
81
  Whenever possible, the implementation uses [Confluence REST API v2](https://developer.atlassian.com/cloud/confluence/rest/v2/) to fetch space properties, and get, create or update page content.
@@ -94,6 +98,12 @@ pip install markdown-to-confluence
94
98
  npm install -g @mermaid-js/mermaid-cli
95
99
  ```
96
100
 
101
+ **Optional.** Converting formulas and equations to PNG or SVG images requires [Matplotlib](https://matplotlib.org/):
102
+
103
+ ```sh
104
+ pip install matplotlib
105
+ ```
106
+
97
107
  ### Marketplace apps
98
108
 
99
109
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -135,7 +145,7 @@ export CONFLUENCE_SPACE_KEY='SPACE'
135
145
 
136
146
  On Windows, these can be set via system properties.
137
147
 
138
- If you use Atlassian scoped API tokens, you should set API URL, substituting `CLOUD_ID` with your own Cloud ID:
148
+ If you use Atlassian scoped API tokens, you may want to set API URL directly, substituting `CLOUD_ID` with your own Cloud ID:
139
149
 
140
150
  ```sh
141
151
  export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
@@ -143,20 +153,27 @@ export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
143
153
 
144
154
  In this case, *md2conf* can automatically determine `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`.
145
155
 
156
+ If you can't find your `CLOUD_ID` but assign both `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`, *md2conf* makes a best-effort attempt to determine `CONFLUENCE_API_URL`.
157
+
146
158
  ### Permissions
147
159
 
148
160
  The tool requires appropriate permissions in Confluence in order to invoke endpoints.
149
161
 
150
- Required scopes for scoped API tokens are as follows:
162
+ We recommend the following scopes for scoped API tokens:
151
163
 
164
+ * `read:attachment:confluence`
165
+ * `read:content:confluence`
166
+ * `read:content-details:confluence`
167
+ * `read:label:confluence`
152
168
  * `read:page:confluence`
153
- * `write:page:confluence`
154
169
  * `read:space:confluence`
155
- * `write:space:confluence`
156
- * `read:attachment:confluence`
157
170
  * `write:attachment:confluence`
158
- * `read:label:confluence`
171
+ * `write:content:confluence`
159
172
  * `write:label:confluence`
173
+ * `write:page:confluence`
174
+ * `delete:attachment:confluence`
175
+ * `delete:content:confluence`
176
+ * `delete:page:confluence`
160
177
 
161
178
  If a Confluence username is set, the tool uses HTTP *Basic* authentication to pass the username and the API key to Confluence REST API endpoints. If no username is provided, the tool authenticates with HTTP *Bearer*, and passes the API key as the bearer token.
162
179
 
@@ -252,6 +269,12 @@ Root page
252
269
  └── Ethical considerations
253
270
  ```
254
271
 
272
+ ### Subscript and superscript
273
+
274
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
275
+
276
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
277
+
255
278
  ### Emoji
256
279
 
257
280
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -278,6 +301,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
278
301
  Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <span style="background-color: rgb(211,241,167);">lime</span> and <span style="background-color: rgb(254,222,200);">yellow</span>.
279
302
  ```
280
303
 
304
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
305
+
281
306
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
282
307
 
283
308
  | Color name | CSS attribute value |
@@ -315,6 +340,21 @@ The following table shows standard highlight colors (CSS `background-color`) tha
315
340
 
316
341
  If your Markdown lists or tables don't appear in Confluence as expected, verify that the list or table is delimited by a blank line both before and after, as per strict Markdown syntax. While some previewers accept a more lenient syntax (e.g. an itemized list immediately following a paragraph), *md2conf* uses [Python-Markdown](https://python-markdown.github.io/) internally to convert Markdown into XHTML, which expects the Markdown document to adhere to the stricter syntax.
317
342
 
343
+ Likewise, if you have a nested list, make sure that nested items are indented by exactly ***four*** spaces as compared to the parent node:
344
+
345
+ ```markdown
346
+ 1. List item 1
347
+ * Nested item 1
348
+ 1. Item 1
349
+ 2. Item 2
350
+ * Nested item 2
351
+ - Item 3
352
+ - Item 4
353
+ 2. List item 2
354
+ 1. Nested item 3
355
+ 2. Nested item 4
356
+ ```
357
+
318
358
  ### Publishing images
319
359
 
320
360
  Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
@@ -332,7 +372,7 @@ Inline formulas can be enclosed with `$` signs, or delimited with `\(` and `\)`,
332
372
 
333
373
  Block formulas can be enclosed with `$$`, or wrapped in code blocks specifying the language `math`:
334
374
 
335
- ```md
375
+ ```markdown
336
376
  $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
337
377
  ```
338
378
 
@@ -357,6 +397,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
357
397
 
358
398
  | Markdown code | Confluence equivalent |
359
399
  | :----------------------------------------- | :------------------------------------------------------ |
400
+ | `[[_TOC_]]` | table of contents (based on headings) |
401
+ | `[[_LISTING_]]` | child pages (of current page) |
360
402
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
403
  | `![My label][STATUS-PURPLE]` | purple status label |
362
404
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -367,7 +409,7 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
367
409
 
368
410
  Use the pseudo-language `csf` in a Markdown code block to pass content directly to Confluence. The content must be a single XML node that conforms to Confluence Storage Format (typically an `ac:structured-macro`) but is otherwise not validated. The following example shows how to create a panel similar to an *info panel* but with custom background color and emoji. Notice that `ac:rich-text-body` uses XHTML, not Markdown.
369
411
 
370
- ````md
412
+ ````markdown
371
413
  ```csf
372
414
  <ac:structured-macro ac:name="panel" ac:schema-version="1">
373
415
  <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
@@ -405,13 +447,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
405
447
 
406
448
  ### Page title
407
449
 
408
- *md2conf* makes a best-effort attempt at setting the Confluence wiki page title when it publishes a Markdown document the first time. The following are probed in this order:
450
+ *md2conf* makes a best-effort attempt at setting the Confluence wiki page title when it publishes a Markdown document the first time. The following act as sources for deriving a page title:
409
451
 
410
452
  1. The `title` attribute set in the [front-matter](https://daily-dev-tips.com/posts/what-exactly-is-frontmatter/). Front-matter is a block delimited by `---` at the beginning of a Markdown document. Both JSON and YAML syntax are supported.
411
453
  2. The text of the topmost unique Markdown heading (`#`). For example, if a document has a single first-level heading (e.g. `# My document`), its text is used. However, if there are multiple first-level headings, this step is skipped.
412
- 3. The file name (without the extension `.md`).
454
+ 3. The file name (without the extension `.md`) and a digest. The digest is included to ensure the title is unique across the Confluence space.
413
455
 
414
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
456
+ If the `title` attribute (in the front-matter) or the topmost unique heading (in the document body) changes, the Confluence page title is updated. A warning is raised if the new title conflicts with the title of another page, and thus cannot be updated.
415
457
 
416
458
  ### Labels
417
459
 
@@ -446,16 +488,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
446
488
 
447
489
  ### draw\.io diagrams
448
490
 
449
- With the command-line option `--no-render-drawio` (default), editable diagram data is extracted from images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`), and uploaded to Confluence as attachments. `*.drawio` and `*.drawio.xml` files are uploaded as-is. You need a [marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts) to view and edit these diagrams on a Confluence page.
491
+ With the command-line option `--no-render-drawio` (default), editable diagram data is extracted from images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`), and uploaded to Confluence as attachments. Files that match `*.drawio` or `*.drawio.xml` are uploaded as-is. You need a [marketplace app](https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-uml-bpmn-aws-erd-flowcharts) to view and edit these diagrams on a Confluence page.
450
492
 
451
- With the command-line option `--render-drawio`, images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`) are uploaded unchanged, and shown on the Confluence page as images. These diagrams are not editable in Confluence. When both an SVG and a PNG image is available, PNG is preferred. `*.drawio` and `*.drawio.xml` files are converted into PNG or SVG images by invoking draw\.io as a command-line utility, and the generated images are uploaded to Confluence as attachments, and shown as images.
493
+ With the command-line option `--render-drawio`, images with embedded draw\.io diagrams (`*.drawio.png` and `*.drawio.svg`) are uploaded unchanged, and shown on the Confluence page as images. These diagrams are not editable in Confluence. When both an SVG and a PNG image is available, PNG is preferred. Files that match `*.drawio` or `*.drawio.xml` are converted into PNG or SVG images by invoking draw\.io as a command-line utility, and the generated images are uploaded to Confluence as attachments, and shown as images.
452
494
 
453
495
  ### Mermaid diagrams
454
496
 
455
- You can include [Mermaid diagrams](https://mermaid.js.org/) in your Markdown documents to create visual representations of systems, processes, and relationships. When a Markdown document contains a code block with the language specifier `mermaid`, *md2conf* offers two options to publish the diagram:
497
+ You can add [Mermaid diagrams](https://mermaid.js.org/) to your Markdown documents to create visual representations of systems, processes, and relationships. There are two ways to include a Mermaid diagram:
498
+
499
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
500
+ * a fenced code block with the language specifier `mermaid`.
501
+
502
+ *md2conf* offers two options to publish the diagram:
456
503
 
457
- 1. Pre-render into an image (command-line option `--render-mermaid`). The code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
458
- 2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://stratus-addons.atlassian.net/wiki/spaces/MDFC/overview), which is processed by Confluence. You need a [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence) to turn macro definitions into images when a Confluence page is visited.
504
+ 1. Pre-render into an image (command-line option `--render-mermaid`). The source file or code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page. This is the approach we use and support.
505
+ 2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://stratus-addons.atlassian.net/wiki/spaces/MDFC/overview), which is processed by Confluence. You need a separate [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence) to turn macro definitions into images when a Confluence page is visited.
459
506
 
460
507
  If you are running into issues with the pre-rendering approach (e.g. misaligned labels in the generated image), verify if `mermaid-cli` can process the Mermaid source:
461
508
 
@@ -465,11 +512,15 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
465
512
 
466
513
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
467
514
 
515
+ ### Links to attachments
516
+
517
+ If *md2conf* encounters a Markdown link that points to a file in the directory hierarchy being synchronized, it automatically uploads the file as an attachment to the Confluence page. Activating the link in Confluence downloads the file. Typical examples include PDFs (`*.pdf`), word processor documents (`*.docx`), spreadsheets (`*.xlsx`), plain text files (`*.txt`) or logs (`*.log`). The MIME type is set based on the file type.
518
+
468
519
  ### Implicit URLs
469
520
 
470
521
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
471
522
 
472
- ```md
523
+ ```markdown
473
524
  [CUSTOM-URL]: https://example.com/path/to/resource
474
525
  ```
475
526
 
@@ -491,10 +542,7 @@ Use the `--help` switch to get a full list of supported command-line options:
491
542
 
492
543
  ```console
493
544
  $ python3 -m md2conf --help
494
- usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [--api-url API_URL] [-u USERNAME] [-a API_KEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--flatten-hierarchy]
495
- [--generated-by GENERATED_BY] [--no-generated-by] [--render-drawio] [--no-render-drawio] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
496
- [--no-heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
497
- mdpath
545
+ usage: md2conf mdpath [OPTIONS]
498
546
 
499
547
  positional arguments:
500
548
  mdpath Path to Markdown file or directory to convert and publish.
@@ -507,7 +555,7 @@ options:
507
555
  --api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
508
556
  -u, --username USERNAME
509
557
  Confluence user name.
510
- -a, --apikey, --api-key API_KEY
558
+ -a, --api-key API_KEY
511
559
  Confluence API key. Refer to documentation how to obtain one.
512
560
  -s, --space SPACE Confluence space key for pages to be published. If omitted, will default to user space.
513
561
  -l, --loglevel {debug,info,warning,error,critical}
@@ -518,17 +566,19 @@ options:
518
566
  --generated-by GENERATED_BY
519
567
  Add prompt to pages (default: 'This page has been generated with a tool.').
520
568
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
521
- --render-drawio Render draw.io diagrams as image files and add as attachments. (Converter required.)
522
- --no-render-drawio Inline draw.io diagram in Confluence page. (Marketplace app required.)
523
- --render-mermaid Render Mermaid diagrams as image files and add as attachments. (Converter required.)
524
- --no-render-mermaid Inline Mermaid diagram in Confluence page. (Marketplace app required.)
525
- --render-mermaid-format {png,svg}
569
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
570
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
571
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
572
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
573
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
574
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
575
+ --diagram-output-format {png,svg}
526
576
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
527
577
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
528
578
  --no-heading-anchors Don't place an anchor at each section heading.
529
579
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
530
580
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
531
- --headers [KEY=VALUE ...]
581
+ --headers KEY=VALUE [KEY=VALUE ...]
532
582
  Apply custom headers to all Confluence API requests.
533
583
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
534
584
  ```
@@ -1,45 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: markdown-to-confluence
3
- Version: 0.4.4
4
- Summary: Publish Markdown files to Confluence wiki
5
- Author-email: Levente Hunyadi <hunyadi@gmail.com>
6
- Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
7
- License-Expression: MIT
8
- Project-URL: Homepage, https://github.com/hunyadi/md2conf
9
- Project-URL: Source, https://github.com/hunyadi/md2conf
10
- Keywords: markdown,converter,confluence
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Environment :: Console
13
- Classifier: Intended Audience :: End Users/Desktop
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.9
17
- Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Programming Language :: Python :: 3.12
20
- Classifier: Programming Language :: Python :: 3.13
21
- Classifier: Programming Language :: Python :: 3 :: Only
22
- Classifier: Typing :: Typed
23
- Requires-Python: >=3.9
24
- Description-Content-Type: text/markdown
25
- License-File: LICENSE
26
- Requires-Dist: json_strong_typing>=0.3.9
27
- Requires-Dist: lxml>=6.0
28
- Requires-Dist: markdown>=3.8
29
- Requires-Dist: pymdown-extensions>=10.16
30
- Requires-Dist: PyYAML>=6.0
31
- Requires-Dist: requests>=2.32
32
- Requires-Dist: typing_extensions>=4.14; python_version < "3.12"
33
- Provides-Extra: dev
34
- Requires-Dist: markdown_doc>=0.1.4; python_version >= "3.10" and extra == "dev"
35
- Requires-Dist: types-lxml>=2025.3.30; extra == "dev"
36
- Requires-Dist: types-markdown>=3.8; extra == "dev"
37
- Requires-Dist: types-PyYAML>=6.0; extra == "dev"
38
- Requires-Dist: types-requests>=2.32; extra == "dev"
39
- Requires-Dist: mypy>=1.16; extra == "dev"
40
- Requires-Dist: ruff>=0.12; extra == "dev"
41
- Dynamic: license-file
42
-
43
1
  # Publish Markdown files to Confluence wiki
44
2
 
45
3
  Contributors to software projects typically write documentation in Markdown format and host Markdown files in collaborative version control systems (VCS) such as GitHub or GitLab to track changes and facilitate the review process. However, not everyone at a company has access to VCS, and documents are often circulated in Confluence wiki instead.
@@ -57,7 +15,7 @@ This Python package
57
15
  * Sections and subsections
58
16
  * Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
59
17
  * 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>`)
18
+ * Subscript and superscript
61
19
  * Math formulas with LaTeX notation
62
20
  * Emoji
63
21
  * Ordered and unordered lists
@@ -71,7 +29,7 @@ This Python package
71
29
  * [Collapsed sections](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections)
72
30
  * [Tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists)
73
31
  * draw\.io diagrams
74
- * [Mermaid diagrams](https://mermaid.live/) in code blocks (converted to images)
32
+ * [Mermaid diagrams](https://mermaid.live/)
75
33
  * Confluence status labels and date widget
76
34
 
77
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.
@@ -94,6 +52,12 @@ pip install markdown-to-confluence
94
52
  npm install -g @mermaid-js/mermaid-cli
95
53
  ```
96
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
+
97
61
  ### Marketplace apps
98
62
 
99
63
  As authors of *md2conf*, we don't endorse or support any particular Confluence marketplace apps.
@@ -135,7 +99,7 @@ export CONFLUENCE_SPACE_KEY='SPACE'
135
99
 
136
100
  On Windows, these can be set via system properties.
137
101
 
138
- If you use Atlassian scoped API tokens, you should set API URL, substituting `CLOUD_ID` with your own Cloud ID:
102
+ If you use Atlassian scoped API tokens, you may want to set API URL directly, substituting `CLOUD_ID` with your own Cloud ID:
139
103
 
140
104
  ```sh
141
105
  export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
@@ -143,20 +107,27 @@ export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
143
107
 
144
108
  In this case, *md2conf* can automatically determine `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`.
145
109
 
110
+ If you can't find your `CLOUD_ID` but assign both `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`, *md2conf* makes a best-effort attempt to determine `CONFLUENCE_API_URL`.
111
+
146
112
  ### Permissions
147
113
 
148
114
  The tool requires appropriate permissions in Confluence in order to invoke endpoints.
149
115
 
150
- Required scopes for scoped API tokens are as follows:
116
+ We recommend the following scopes for scoped API tokens:
151
117
 
118
+ * `read:attachment:confluence`
119
+ * `read:content:confluence`
120
+ * `read:content-details:confluence`
121
+ * `read:label:confluence`
152
122
  * `read:page:confluence`
153
- * `write:page:confluence`
154
123
  * `read:space:confluence`
155
- * `write:space:confluence`
156
- * `read:attachment:confluence`
157
124
  * `write:attachment:confluence`
158
- * `read:label:confluence`
125
+ * `write:content:confluence`
159
126
  * `write:label:confluence`
127
+ * `write:page:confluence`
128
+ * `delete:attachment:confluence`
129
+ * `delete:content:confluence`
130
+ * `delete:page:confluence`
160
131
 
161
132
  If a Confluence username is set, the tool uses HTTP *Basic* authentication to pass the username and the API key to Confluence REST API endpoints. If no username is provided, the tool authenticates with HTTP *Bearer*, and passes the API key as the bearer token.
162
133
 
@@ -252,6 +223,12 @@ Root page
252
223
  └── Ethical considerations
253
224
  ```
254
225
 
226
+ ### Subscript and superscript
227
+
228
+ Subscripts may either use the character *tilde* (e.g. `CH~3~CH~2~OH`) or the HTML tag `<sub>`.
229
+
230
+ Superscripts may either use the character *caret* (e.g. `e^-ix^`) or the HTML tag `<sup>`.
231
+
255
232
  ### Emoji
256
233
 
257
234
  The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
@@ -278,6 +255,8 @@ Highlight in <span style="background-color: rgb(198,237,251);">teal</span>, <spa
278
255
  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
256
  ```
280
257
 
258
+ Highlighting is also supported via `==marks==`. However, the background color is not customizable.
259
+
281
260
  The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
282
261
 
283
262
  | Color name | CSS attribute value |
@@ -315,6 +294,21 @@ The following table shows standard highlight colors (CSS `background-color`) tha
315
294
 
316
295
  If your Markdown lists or tables don't appear in Confluence as expected, verify that the list or table is delimited by a blank line both before and after, as per strict Markdown syntax. While some previewers accept a more lenient syntax (e.g. an itemized list immediately following a paragraph), *md2conf* uses [Python-Markdown](https://python-markdown.github.io/) internally to convert Markdown into XHTML, which expects the Markdown document to adhere to the stricter syntax.
317
296
 
297
+ Likewise, if you have a nested list, make sure that nested items are indented by exactly ***four*** spaces as compared to the parent node:
298
+
299
+ ```markdown
300
+ 1. List item 1
301
+ * Nested item 1
302
+ 1. Item 1
303
+ 2. Item 2
304
+ * Nested item 2
305
+ - Item 3
306
+ - Item 4
307
+ 2. List item 2
308
+ 1. Nested item 3
309
+ 2. Nested item 4
310
+ ```
311
+
318
312
  ### Publishing images
319
313
 
320
314
  Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
@@ -332,7 +326,7 @@ Inline formulas can be enclosed with `$` signs, or delimited with `\(` and `\)`,
332
326
 
333
327
  Block formulas can be enclosed with `$$`, or wrapped in code blocks specifying the language `math`:
334
328
 
335
- ```md
329
+ ```markdown
336
330
  $$\int _{a}^{b}f(x)dx=F(b)-F(a)$$
337
331
  ```
338
332
 
@@ -357,6 +351,8 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
357
351
 
358
352
  | Markdown code | Confluence equivalent |
359
353
  | :----------------------------------------- | :------------------------------------------------------ |
354
+ | `[[_TOC_]]` | table of contents (based on headings) |
355
+ | `[[_LISTING_]]` | child pages (of current page) |
360
356
  | `![My label][STATUS-GRAY]` | gray status label (with specified label text) |
361
357
  | `![My label][STATUS-PURPLE]` | purple status label |
362
358
  | `![My label][STATUS-BLUE]` | blue status label |
@@ -367,7 +363,7 @@ Displaying math formulas in Confluence requires the extension [LaTeX Math for Co
367
363
 
368
364
  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
365
 
370
- ````md
366
+ ````markdown
371
367
  ```csf
372
368
  <ac:structured-macro ac:name="panel" ac:schema-version="1">
373
369
  <ac:parameter ac:name="panelIcon">:slight_smile:</ac:parameter>
@@ -405,13 +401,13 @@ This is useful if you have a page in a hierarchy that participates in parent-chi
405
401
 
406
402
  ### Page title
407
403
 
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:
404
+ *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
405
 
410
406
  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
407
  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`).
408
+ 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
409
 
414
- If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
410
+ 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
411
 
416
412
  ### Labels
417
413
 
@@ -446,16 +442,21 @@ The attribute `properties` is parsed as a dictionary with keys of type string an
446
442
 
447
443
  ### draw\.io diagrams
448
444
 
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.
445
+ 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
446
 
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.
447
+ 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
448
 
453
449
  ### Mermaid diagrams
454
450
 
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:
451
+ 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:
452
+
453
+ * an image reference to a `.mmd` or `.mermaid` file, i.e. `![My diagram](figure/diagram.mmd)`, or
454
+ * a fenced code block with the language specifier `mermaid`.
455
+
456
+ *md2conf* offers two options to publish the diagram:
456
457
 
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.
458
+ 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.
459
+ 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
460
 
460
461
  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
462
 
@@ -465,11 +466,15 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
465
466
 
466
467
  Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
467
468
 
469
+ ### Links to attachments
470
+
471
+ 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.
472
+
468
473
  ### Implicit URLs
469
474
 
470
475
  *md2conf* implicitly defines some URLs, as if you included the following at the start of the Markdown document for each URL:
471
476
 
472
- ```md
477
+ ```markdown
473
478
  [CUSTOM-URL]: https://example.com/path/to/resource
474
479
  ```
475
480
 
@@ -491,10 +496,7 @@ Use the `--help` switch to get a full list of supported command-line options:
491
496
 
492
497
  ```console
493
498
  $ 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
499
+ usage: md2conf mdpath [OPTIONS]
498
500
 
499
501
  positional arguments:
500
502
  mdpath Path to Markdown file or directory to convert and publish.
@@ -507,7 +509,7 @@ options:
507
509
  --api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
508
510
  -u, --username USERNAME
509
511
  Confluence user name.
510
- -a, --apikey, --api-key API_KEY
512
+ -a, --api-key API_KEY
511
513
  Confluence API key. Refer to documentation how to obtain one.
512
514
  -s, --space SPACE Confluence space key for pages to be published. If omitted, will default to user space.
513
515
  -l, --loglevel {debug,info,warning,error,critical}
@@ -518,17 +520,19 @@ options:
518
520
  --generated-by GENERATED_BY
519
521
  Add prompt to pages (default: 'This page has been generated with a tool.').
520
522
  --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}
523
+ --render-drawio Render draw.io diagrams as image files. (Installed utility required to covert.)
524
+ --no-render-drawio Upload draw.io diagram sources as Confluence page attachments. (Marketplace app required to display.)
525
+ --render-mermaid Render Mermaid diagrams as image files. (Installed utility required to convert.)
526
+ --no-render-mermaid Upload Mermaid diagram sources as Confluence page attachments. (Marketplace app required to display.)
527
+ --render-latex Render LaTeX formulas as image files. (Matplotlib required to convert.)
528
+ --no-render-latex Inline LaTeX formulas in Confluence page. (Marketplace app required to display.)
529
+ --diagram-output-format {png,svg}
526
530
  Format for rendering Mermaid and draw.io diagrams (default: 'png').
527
531
  --heading-anchors Place an anchor at each section heading with GitHub-style same-page identifiers.
528
532
  --no-heading-anchors Don't place an anchor at each section heading.
529
533
  --ignore-invalid-url Emit a warning but otherwise ignore relative URLs that point to ill-specified locations.
530
534
  --local Write XHTML-based Confluence Storage Format files locally without invoking Confluence API.
531
- --headers [KEY=VALUE ...]
535
+ --headers KEY=VALUE [KEY=VALUE ...]
532
536
  Apply custom headers to all Confluence API requests.
533
537
  --webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
534
538
  ```