markdown-to-confluence 0.3.3__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdown_to_confluence-0.3.3/markdown_to_confluence.egg-info → markdown_to_confluence-0.3.5}/PKG-INFO +24 -11
- markdown_to_confluence-0.3.3/PKG-INFO → markdown_to_confluence-0.3.5/README.md +17 -38
- markdown_to_confluence-0.3.3/README.md → markdown_to_confluence-0.3.5/markdown_to_confluence.egg-info/PKG-INFO +51 -4
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/markdown_to_confluence.egg-info/SOURCES.txt +5 -1
- markdown_to_confluence-0.3.5/markdown_to_confluence.egg-info/requires.txt +9 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/__init__.py +1 -1
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/__main__.py +6 -5
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/api.py +235 -45
- markdown_to_confluence-0.3.5/md2conf/application.py +213 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/converter.py +53 -112
- markdown_to_confluence-0.3.5/md2conf/local.py +125 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/matcher.py +54 -13
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/mermaid.py +10 -4
- markdown_to_confluence-0.3.5/md2conf/metadata.py +42 -0
- markdown_to_confluence-0.3.5/md2conf/processor.py +216 -0
- markdown_to_confluence-0.3.5/md2conf/scanner.py +117 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/setup.cfg +6 -6
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/tests/test_conversion.py +9 -9
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/tests/test_matcher.py +6 -0
- markdown_to_confluence-0.3.5/tests/test_processor.py +105 -0
- markdown_to_confluence-0.3.5/tests/test_scanner.py +46 -0
- markdown_to_confluence-0.3.3/markdown_to_confluence.egg-info/requires.txt +0 -9
- markdown_to_confluence-0.3.3/md2conf/application.py +0 -295
- markdown_to_confluence-0.3.3/md2conf/processor.py +0 -148
- markdown_to_confluence-0.3.3/tests/test_processor.py +0 -66
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/LICENSE +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/markdown_to_confluence.egg-info/top_level.txt +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/markdown_to_confluence.egg-info/zip-safe +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/emoji.py +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/entities.dtd +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/properties.py +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/puppeteer-config.json +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/md2conf/py.typed +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/pyproject.toml +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/setup.py +0 -0
- {markdown_to_confluence-0.3.3 → markdown_to_confluence-0.3.5}/tests/test_mermaid.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Publish Markdown files to Confluence wiki
|
|
5
5
|
Home-page: https://github.com/hunyadi/md2conf
|
|
6
6
|
Author: Levente Hunyadi
|
|
@@ -21,12 +21,12 @@ Classifier: Typing :: Typed
|
|
|
21
21
|
Requires-Python: >=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: lxml>=5.
|
|
25
|
-
Requires-Dist: types-lxml>=
|
|
26
|
-
Requires-Dist: markdown>=3.
|
|
27
|
-
Requires-Dist: types-markdown>=3.
|
|
28
|
-
Requires-Dist: pymdown-extensions>=10.
|
|
29
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: lxml>=5.4
|
|
25
|
+
Requires-Dist: types-lxml>=2025.3.30
|
|
26
|
+
Requires-Dist: markdown>=3.8
|
|
27
|
+
Requires-Dist: types-markdown>=3.8
|
|
28
|
+
Requires-Dist: pymdown-extensions>=10.15
|
|
29
|
+
Requires-Dist: PyYAML>=6.0
|
|
30
30
|
Requires-Dist: types-PyYAML>=6.0
|
|
31
31
|
Requires-Dist: requests>=2.32
|
|
32
32
|
Requires-Dist: types-requests>=2.32
|
|
@@ -62,13 +62,13 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
|
|
|
62
62
|
|
|
63
63
|
## Installation
|
|
64
64
|
|
|
65
|
-
Install the core package from PyPI:
|
|
65
|
+
**Required.** Install the core package from [PyPI](https://pypi.org/project/markdown-to-confluence/):
|
|
66
66
|
|
|
67
67
|
```sh
|
|
68
68
|
pip install markdown-to-confluence
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
71
|
+
**Optional.** Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
72
72
|
|
|
73
73
|
```sh
|
|
74
74
|
npm install -g @mermaid-js/mermaid-cli
|
|
@@ -198,20 +198,26 @@ root
|
|
|
198
198
|
└── Mean vs. median
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
+
### Lists and tables
|
|
202
|
+
|
|
203
|
+
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.
|
|
204
|
+
|
|
201
205
|
### Publishing images
|
|
202
206
|
|
|
203
207
|
Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
|
|
204
208
|
|
|
205
|
-
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
209
|
+
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. (This seems to be a known issue in Confluence.) In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
206
210
|
|
|
207
211
|
External images referenced with an absolute URL retain the original URL.
|
|
208
212
|
|
|
209
213
|
### Ignoring files
|
|
210
214
|
|
|
211
|
-
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax 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.
|
|
215
|
+
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.
|
|
212
216
|
|
|
213
217
|
Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
|
|
214
218
|
|
|
219
|
+
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
220
|
+
|
|
215
221
|
### Page title
|
|
216
222
|
|
|
217
223
|
*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:
|
|
@@ -222,6 +228,13 @@ Files that don't have the extension `*.md` are skipped automatically. Hidden dir
|
|
|
222
228
|
|
|
223
229
|
If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
|
|
224
230
|
|
|
231
|
+
### Converting diagrams
|
|
232
|
+
|
|
233
|
+
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:
|
|
234
|
+
|
|
235
|
+
1. Pre-render into an image. 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.
|
|
236
|
+
2. Render on demand. 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 [Confluence plugin](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. This is a contributed feature. As authors of *md2conf*, we don't endorse or support any particular Confluence plugin.
|
|
237
|
+
|
|
225
238
|
### Running the tool
|
|
226
239
|
|
|
227
240
|
You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.3.3
|
|
4
|
-
Summary: Publish Markdown files to Confluence wiki
|
|
5
|
-
Home-page: https://github.com/hunyadi/md2conf
|
|
6
|
-
Author: Levente Hunyadi
|
|
7
|
-
Author-email: hunyadi@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
-
Classifier: Environment :: Console
|
|
11
|
-
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Operating System :: OS Independent
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
-
Classifier: Typing :: Typed
|
|
21
|
-
Requires-Python: >=3.9
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
24
|
-
Requires-Dist: lxml>=5.3
|
|
25
|
-
Requires-Dist: types-lxml>=2024.12.13
|
|
26
|
-
Requires-Dist: markdown>=3.7
|
|
27
|
-
Requires-Dist: types-markdown>=3.7
|
|
28
|
-
Requires-Dist: pymdown-extensions>=10.14
|
|
29
|
-
Requires-Dist: pyyaml>=6.0
|
|
30
|
-
Requires-Dist: types-PyYAML>=6.0
|
|
31
|
-
Requires-Dist: requests>=2.32
|
|
32
|
-
Requires-Dist: types-requests>=2.32
|
|
33
|
-
Dynamic: license-file
|
|
34
|
-
|
|
35
1
|
# Publish Markdown files to Confluence wiki
|
|
36
2
|
|
|
37
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.
|
|
@@ -62,13 +28,13 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
|
|
|
62
28
|
|
|
63
29
|
## Installation
|
|
64
30
|
|
|
65
|
-
Install the core package from PyPI:
|
|
31
|
+
**Required.** Install the core package from [PyPI](https://pypi.org/project/markdown-to-confluence/):
|
|
66
32
|
|
|
67
33
|
```sh
|
|
68
34
|
pip install markdown-to-confluence
|
|
69
35
|
```
|
|
70
36
|
|
|
71
|
-
Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
37
|
+
**Optional.** Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
72
38
|
|
|
73
39
|
```sh
|
|
74
40
|
npm install -g @mermaid-js/mermaid-cli
|
|
@@ -198,20 +164,26 @@ root
|
|
|
198
164
|
└── Mean vs. median
|
|
199
165
|
```
|
|
200
166
|
|
|
167
|
+
### Lists and tables
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
201
171
|
### Publishing images
|
|
202
172
|
|
|
203
173
|
Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
|
|
204
174
|
|
|
205
|
-
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
175
|
+
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. (This seems to be a known issue in Confluence.) In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
206
176
|
|
|
207
177
|
External images referenced with an absolute URL retain the original URL.
|
|
208
178
|
|
|
209
179
|
### Ignoring files
|
|
210
180
|
|
|
211
|
-
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax 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.
|
|
181
|
+
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.
|
|
212
182
|
|
|
213
183
|
Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
|
|
214
184
|
|
|
185
|
+
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
186
|
+
|
|
215
187
|
### Page title
|
|
216
188
|
|
|
217
189
|
*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:
|
|
@@ -222,6 +194,13 @@ Files that don't have the extension `*.md` are skipped automatically. Hidden dir
|
|
|
222
194
|
|
|
223
195
|
If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
|
|
224
196
|
|
|
197
|
+
### Converting diagrams
|
|
198
|
+
|
|
199
|
+
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:
|
|
200
|
+
|
|
201
|
+
1. Pre-render into an image. 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.
|
|
202
|
+
2. Render on demand. 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 [Confluence plugin](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. This is a contributed feature. As authors of *md2conf*, we don't endorse or support any particular Confluence plugin.
|
|
203
|
+
|
|
225
204
|
### Running the tool
|
|
226
205
|
|
|
227
206
|
You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: markdown-to-confluence
|
|
3
|
+
Version: 0.3.5
|
|
4
|
+
Summary: Publish Markdown files to Confluence wiki
|
|
5
|
+
Home-page: https://github.com/hunyadi/md2conf
|
|
6
|
+
Author: Levente Hunyadi
|
|
7
|
+
Author-email: hunyadi@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: lxml>=5.4
|
|
25
|
+
Requires-Dist: types-lxml>=2025.3.30
|
|
26
|
+
Requires-Dist: markdown>=3.8
|
|
27
|
+
Requires-Dist: types-markdown>=3.8
|
|
28
|
+
Requires-Dist: pymdown-extensions>=10.15
|
|
29
|
+
Requires-Dist: PyYAML>=6.0
|
|
30
|
+
Requires-Dist: types-PyYAML>=6.0
|
|
31
|
+
Requires-Dist: requests>=2.32
|
|
32
|
+
Requires-Dist: types-requests>=2.32
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
1
35
|
# Publish Markdown files to Confluence wiki
|
|
2
36
|
|
|
3
37
|
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.
|
|
@@ -28,13 +62,13 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
|
|
|
28
62
|
|
|
29
63
|
## Installation
|
|
30
64
|
|
|
31
|
-
Install the core package from PyPI:
|
|
65
|
+
**Required.** Install the core package from [PyPI](https://pypi.org/project/markdown-to-confluence/):
|
|
32
66
|
|
|
33
67
|
```sh
|
|
34
68
|
pip install markdown-to-confluence
|
|
35
69
|
```
|
|
36
70
|
|
|
37
|
-
Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
71
|
+
**Optional.** Converting code blocks of Mermaid diagrams into Confluence image attachments requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli):
|
|
38
72
|
|
|
39
73
|
```sh
|
|
40
74
|
npm install -g @mermaid-js/mermaid-cli
|
|
@@ -164,20 +198,26 @@ root
|
|
|
164
198
|
└── Mean vs. median
|
|
165
199
|
```
|
|
166
200
|
|
|
201
|
+
### Lists and tables
|
|
202
|
+
|
|
203
|
+
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.
|
|
204
|
+
|
|
167
205
|
### Publishing images
|
|
168
206
|
|
|
169
207
|
Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
|
|
170
208
|
|
|
171
|
-
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
209
|
+
Unfortunately, Confluence struggles with SVG images, e.g. they may only show in *edit* mode, display in a wrong size or text labels in the image may be truncated. (This seems to be a known issue in Confluence.) In order to mitigate the issue, whenever *md2conf* encounters a reference to an SVG image in a Markdown file, it checks whether a corresponding PNG image also exists in the same directory, and if a PNG image is found, it is published instead.
|
|
172
210
|
|
|
173
211
|
External images referenced with an absolute URL retain the original URL.
|
|
174
212
|
|
|
175
213
|
### Ignoring files
|
|
176
214
|
|
|
177
|
-
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax 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.
|
|
215
|
+
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.
|
|
178
216
|
|
|
179
217
|
Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
|
|
180
218
|
|
|
219
|
+
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
220
|
+
|
|
181
221
|
### Page title
|
|
182
222
|
|
|
183
223
|
*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:
|
|
@@ -188,6 +228,13 @@ Files that don't have the extension `*.md` are skipped automatically. Hidden dir
|
|
|
188
228
|
|
|
189
229
|
If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
|
|
190
230
|
|
|
231
|
+
### Converting diagrams
|
|
232
|
+
|
|
233
|
+
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:
|
|
234
|
+
|
|
235
|
+
1. Pre-render into an image. 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.
|
|
236
|
+
2. Render on demand. 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 [Confluence plugin](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. This is a contributed feature. As authors of *md2conf*, we don't endorse or support any particular Confluence plugin.
|
|
237
|
+
|
|
191
238
|
### Running the tool
|
|
192
239
|
|
|
193
240
|
You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
|
|
@@ -17,13 +17,17 @@ md2conf/application.py
|
|
|
17
17
|
md2conf/converter.py
|
|
18
18
|
md2conf/emoji.py
|
|
19
19
|
md2conf/entities.dtd
|
|
20
|
+
md2conf/local.py
|
|
20
21
|
md2conf/matcher.py
|
|
21
22
|
md2conf/mermaid.py
|
|
23
|
+
md2conf/metadata.py
|
|
22
24
|
md2conf/processor.py
|
|
23
25
|
md2conf/properties.py
|
|
24
26
|
md2conf/puppeteer-config.json
|
|
25
27
|
md2conf/py.typed
|
|
28
|
+
md2conf/scanner.py
|
|
26
29
|
tests/test_conversion.py
|
|
27
30
|
tests/test_matcher.py
|
|
28
31
|
tests/test_mermaid.py
|
|
29
|
-
tests/test_processor.py
|
|
32
|
+
tests/test_processor.py
|
|
33
|
+
tests/test_scanner.py
|
|
@@ -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.3.
|
|
8
|
+
__version__ = "0.3.5"
|
|
9
9
|
__author__ = "Levente Hunyadi"
|
|
10
10
|
__copyright__ = "Copyright 2022-2025, Levente Hunyadi"
|
|
11
11
|
__license__ = "MIT"
|
|
@@ -22,8 +22,9 @@ import requests
|
|
|
22
22
|
from . import __version__
|
|
23
23
|
from .api import ConfluenceAPI
|
|
24
24
|
from .application import Application
|
|
25
|
-
from .converter import ConfluenceDocumentOptions,
|
|
26
|
-
from .
|
|
25
|
+
from .converter import ConfluenceDocumentOptions, ConfluencePageID
|
|
26
|
+
from .local import LocalConverter
|
|
27
|
+
from .metadata import ConfluenceSiteMetadata
|
|
27
28
|
from .properties import (
|
|
28
29
|
ArgumentError,
|
|
29
30
|
ConfluenceConnectionProperties,
|
|
@@ -199,7 +200,7 @@ def main() -> None:
|
|
|
199
200
|
heading_anchors=args.heading_anchors,
|
|
200
201
|
ignore_invalid_url=args.ignore_invalid_url,
|
|
201
202
|
generated_by=args.generated_by,
|
|
202
|
-
root_page_id=args.root_page,
|
|
203
|
+
root_page_id=ConfluencePageID(args.root_page) if args.root_page else None,
|
|
203
204
|
keep_hierarchy=args.keep_hierarchy,
|
|
204
205
|
render_mermaid=args.render_mermaid,
|
|
205
206
|
diagram_output_format=args.diagram_output_format,
|
|
@@ -219,7 +220,7 @@ def main() -> None:
|
|
|
219
220
|
base_path=site_properties.base_path,
|
|
220
221
|
space_key=site_properties.space_key,
|
|
221
222
|
)
|
|
222
|
-
|
|
223
|
+
LocalConverter(options, site_metadata).process(args.mdpath)
|
|
223
224
|
else:
|
|
224
225
|
try:
|
|
225
226
|
properties = ConfluenceConnectionProperties(
|
|
@@ -237,7 +238,7 @@ def main() -> None:
|
|
|
237
238
|
Application(
|
|
238
239
|
api,
|
|
239
240
|
options,
|
|
240
|
-
).
|
|
241
|
+
).process(args.mdpath)
|
|
241
242
|
except requests.exceptions.HTTPError as err:
|
|
242
243
|
logging.error(err)
|
|
243
244
|
|