markdown-to-confluence 0.3.2__tar.gz → 0.3.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 (35) hide show
  1. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/PKG-INFO +32 -8
  2. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/README.md +31 -7
  3. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/PKG-INFO +32 -8
  4. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/SOURCES.txt +2 -0
  5. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/__init__.py +1 -1
  6. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/__main__.py +40 -14
  7. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/api.py +135 -50
  8. markdown_to_confluence-0.3.4/md2conf/application.py +208 -0
  9. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/converter.py +142 -44
  10. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/emoji.py +3 -1
  11. markdown_to_confluence-0.3.4/md2conf/local.py +132 -0
  12. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/mermaid.py +1 -1
  13. markdown_to_confluence-0.3.4/md2conf/metadata.py +42 -0
  14. markdown_to_confluence-0.3.4/md2conf/processor.py +218 -0
  15. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/properties.py +40 -16
  16. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/tests/test_conversion.py +50 -15
  17. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/tests/test_matcher.py +1 -0
  18. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/tests/test_mermaid.py +3 -3
  19. markdown_to_confluence-0.3.4/tests/test_processor.py +104 -0
  20. markdown_to_confluence-0.3.2/md2conf/application.py +0 -279
  21. markdown_to_confluence-0.3.2/md2conf/processor.py +0 -147
  22. markdown_to_confluence-0.3.2/tests/test_processor.py +0 -71
  23. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/LICENSE +0 -0
  24. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/dependency_links.txt +0 -0
  25. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/entry_points.txt +0 -0
  26. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/requires.txt +0 -0
  27. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/top_level.txt +0 -0
  28. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/markdown_to_confluence.egg-info/zip-safe +0 -0
  29. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/entities.dtd +0 -0
  30. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/matcher.py +0 -0
  31. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/puppeteer-config.json +0 -0
  32. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/md2conf/py.typed +0 -0
  33. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/pyproject.toml +0 -0
  34. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/setup.cfg +0 -0
  35. {markdown_to_confluence-0.3.2 → markdown_to_confluence-0.3.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Publish Markdown files to Confluence wiki
5
5
  Home-page: https://github.com/hunyadi/md2conf
6
6
  Author: Levente Hunyadi
@@ -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
@@ -167,7 +167,7 @@ The concepts above are illustrated in the following sections.
167
167
 
168
168
  #### File-system directory hierarchy
169
169
 
170
- The title of each Markdown file (either the text of the first heading (`#`), or the title specified in front-matter) is shown next to the file name.
170
+ The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name.
171
171
 
172
172
  ```
173
173
  .
@@ -198,12 +198,37 @@ root
198
198
  └── Mean vs. median
199
199
  ```
200
200
 
201
+ ### Publishing images
202
+
203
+ Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
204
+
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.
206
+
207
+ External images referenced with an absolute URL retain the original URL.
208
+
201
209
  ### Ignoring files
202
210
 
203
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.
204
212
 
205
213
  Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
206
214
 
215
+ ### Page title
216
+
217
+ *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:
218
+
219
+ 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. Currently, only YAML syntax is supported.
220
+ 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.
221
+ 3. The file name (without the extension `.md`).
222
+
223
+ If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
224
+
225
+ ### Converting diagrams
226
+
227
+ 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:
228
+
229
+ 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.
230
+ 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.
231
+
207
232
  ### Running the tool
208
233
 
209
234
  You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
@@ -216,10 +241,8 @@ Use the `--help` switch to get a full list of supported command-line options:
216
241
 
217
242
  ```console
218
243
  $ python3 -m md2conf --help
219
- usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE]
220
- [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--generated-by GENERATED_BY] [--no-generated-by]
221
- [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
222
- [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
244
+ usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--generated-by GENERATED_BY] [--no-generated-by]
245
+ [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
223
246
  mdpath
224
247
 
225
248
  positional arguments:
@@ -240,6 +263,7 @@ options:
240
263
  -l {debug,info,warning,error,critical}, --loglevel {debug,info,warning,error,critical}
241
264
  Use this option to set the log verbosity.
242
265
  -r ROOT_PAGE Root Confluence page to create new pages. If omitted, will raise exception when creating new pages.
266
+ --keep-hierarchy Maintain source directory structure when exporting to Confluence.
243
267
  --generated-by GENERATED_BY
244
268
  Add prompt to pages (default: 'This page has been generated with a tool.').
245
269
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
@@ -28,13 +28,13 @@ Whenever possible, the implementation uses [Confluence REST API v2](https://deve
28
28
 
29
29
  ## Installation
30
30
 
31
- Install the core package from PyPI:
31
+ **Required.** Install the core package from [PyPI](https://pypi.org/project/markdown-to-confluence/):
32
32
 
33
33
  ```sh
34
34
  pip install markdown-to-confluence
35
35
  ```
36
36
 
37
- 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):
38
38
 
39
39
  ```sh
40
40
  npm install -g @mermaid-js/mermaid-cli
@@ -133,7 +133,7 @@ The concepts above are illustrated in the following sections.
133
133
 
134
134
  #### File-system directory hierarchy
135
135
 
136
- The title of each Markdown file (either the text of the first heading (`#`), or the title specified in front-matter) is shown next to the file name.
136
+ The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name.
137
137
 
138
138
  ```
139
139
  .
@@ -164,12 +164,37 @@ root
164
164
  └── Mean vs. median
165
165
  ```
166
166
 
167
+ ### Publishing images
168
+
169
+ Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
170
+
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.
172
+
173
+ External images referenced with an absolute URL retain the original URL.
174
+
167
175
  ### Ignoring files
168
176
 
169
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.
170
178
 
171
179
  Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
172
180
 
181
+ ### Page title
182
+
183
+ *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:
184
+
185
+ 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. Currently, only YAML syntax is supported.
186
+ 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.
187
+ 3. The file name (without the extension `.md`).
188
+
189
+ If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
190
+
191
+ ### Converting diagrams
192
+
193
+ 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:
194
+
195
+ 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.
196
+ 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.
197
+
173
198
  ### Running the tool
174
199
 
175
200
  You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
@@ -182,10 +207,8 @@ Use the `--help` switch to get a full list of supported command-line options:
182
207
 
183
208
  ```console
184
209
  $ python3 -m md2conf --help
185
- usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE]
186
- [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--generated-by GENERATED_BY] [--no-generated-by]
187
- [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
188
- [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
210
+ usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--generated-by GENERATED_BY] [--no-generated-by]
211
+ [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
189
212
  mdpath
190
213
 
191
214
  positional arguments:
@@ -206,6 +229,7 @@ options:
206
229
  -l {debug,info,warning,error,critical}, --loglevel {debug,info,warning,error,critical}
207
230
  Use this option to set the log verbosity.
208
231
  -r ROOT_PAGE Root Confluence page to create new pages. If omitted, will raise exception when creating new pages.
232
+ --keep-hierarchy Maintain source directory structure when exporting to Confluence.
209
233
  --generated-by GENERATED_BY
210
234
  Add prompt to pages (default: 'This page has been generated with a tool.').
211
235
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-to-confluence
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Publish Markdown files to Confluence wiki
5
5
  Home-page: https://github.com/hunyadi/md2conf
6
6
  Author: Levente Hunyadi
@@ -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
@@ -167,7 +167,7 @@ The concepts above are illustrated in the following sections.
167
167
 
168
168
  #### File-system directory hierarchy
169
169
 
170
- The title of each Markdown file (either the text of the first heading (`#`), or the title specified in front-matter) is shown next to the file name.
170
+ The title of each Markdown file (either the text of the topmost unique heading (`#`), or the title specified in front-matter) is shown next to the file name.
171
171
 
172
172
  ```
173
173
  .
@@ -198,12 +198,37 @@ root
198
198
  └── Mean vs. median
199
199
  ```
200
200
 
201
+ ### Publishing images
202
+
203
+ Local images referenced in a Markdown file are automatically published to Confluence as attachments to the page.
204
+
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.
206
+
207
+ External images referenced with an absolute URL retain the original URL.
208
+
201
209
  ### Ignoring files
202
210
 
203
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.
204
212
 
205
213
  Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
206
214
 
215
+ ### Page title
216
+
217
+ *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:
218
+
219
+ 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. Currently, only YAML syntax is supported.
220
+ 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.
221
+ 3. The file name (without the extension `.md`).
222
+
223
+ If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
224
+
225
+ ### Converting diagrams
226
+
227
+ 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:
228
+
229
+ 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.
230
+ 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.
231
+
207
232
  ### Running the tool
208
233
 
209
234
  You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
@@ -216,10 +241,8 @@ Use the `--help` switch to get a full list of supported command-line options:
216
241
 
217
242
  ```console
218
243
  $ python3 -m md2conf --help
219
- usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE]
220
- [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--generated-by GENERATED_BY] [--no-generated-by]
221
- [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors]
222
- [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
244
+ usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a APIKEY] [-s SPACE] [-l {debug,info,warning,error,critical}] [-r ROOT_PAGE] [--keep-hierarchy] [--generated-by GENERATED_BY] [--no-generated-by]
245
+ [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
223
246
  mdpath
224
247
 
225
248
  positional arguments:
@@ -240,6 +263,7 @@ options:
240
263
  -l {debug,info,warning,error,critical}, --loglevel {debug,info,warning,error,critical}
241
264
  Use this option to set the log verbosity.
242
265
  -r ROOT_PAGE Root Confluence page to create new pages. If omitted, will raise exception when creating new pages.
266
+ --keep-hierarchy Maintain source directory structure when exporting to Confluence.
243
267
  --generated-by GENERATED_BY
244
268
  Add prompt to pages (default: 'This page has been generated with a tool.').
245
269
  --no-generated-by Do not add 'generated by a tool' prompt to pages.
@@ -17,8 +17,10 @@ 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
@@ -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.2"
8
+ __version__ = "0.3.4"
9
9
  __author__ = "Levente Hunyadi"
10
10
  __copyright__ = "Copyright 2022-2025, Levente Hunyadi"
11
11
  __license__ = "MIT"
@@ -22,18 +22,23 @@ 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 .processor import Processor
27
- from .properties import ConfluenceProperties
25
+ from .converter import ConfluenceDocumentOptions, ConfluencePageID
26
+ from .local import LocalConverter
27
+ from .metadata import ConfluenceSiteMetadata
28
+ from .properties import (
29
+ ArgumentError,
30
+ ConfluenceConnectionProperties,
31
+ ConfluenceSiteProperties,
32
+ )
28
33
 
29
34
 
30
35
  class Arguments(argparse.Namespace):
31
36
  mdpath: Path
32
- domain: str
33
- path: str
34
- username: str
35
- apikey: str
36
- space: str
37
+ domain: Optional[str]
38
+ path: Optional[str]
39
+ username: Optional[str]
40
+ apikey: Optional[str]
41
+ space: Optional[str]
37
42
  loglevel: str
38
43
  ignore_invalid_url: bool
39
44
  heading_anchors: bool
@@ -195,24 +200,45 @@ def main() -> None:
195
200
  heading_anchors=args.heading_anchors,
196
201
  ignore_invalid_url=args.ignore_invalid_url,
197
202
  generated_by=args.generated_by,
198
- root_page_id=args.root_page,
203
+ root_page_id=ConfluencePageID(args.root_page) if args.root_page else None,
199
204
  keep_hierarchy=args.keep_hierarchy,
200
205
  render_mermaid=args.render_mermaid,
201
206
  diagram_output_format=args.diagram_output_format,
202
207
  webui_links=args.webui_links,
203
208
  )
204
- properties = ConfluenceProperties(
205
- args.domain, args.path, args.username, args.apikey, args.space, args.headers
206
- )
207
209
  if args.local:
208
- Processor(options, properties).process(args.mdpath)
210
+ try:
211
+ site_properties = ConfluenceSiteProperties(
212
+ domain=args.domain,
213
+ base_path=args.path,
214
+ space_key=args.space,
215
+ )
216
+ except ArgumentError as e:
217
+ parser.error(str(e))
218
+ site_metadata = ConfluenceSiteMetadata(
219
+ domain=site_properties.domain,
220
+ base_path=site_properties.base_path,
221
+ space_key=site_properties.space_key,
222
+ )
223
+ LocalConverter(options, site_metadata).process(args.mdpath)
209
224
  else:
225
+ try:
226
+ properties = ConfluenceConnectionProperties(
227
+ args.domain,
228
+ args.path,
229
+ args.username,
230
+ args.apikey,
231
+ args.space,
232
+ args.headers,
233
+ )
234
+ except ArgumentError as e:
235
+ parser.error(str(e))
210
236
  try:
211
237
  with ConfluenceAPI(properties) as api:
212
238
  Application(
213
239
  api,
214
240
  options,
215
- ).synchronize(args.mdpath)
241
+ ).process(args.mdpath)
216
242
  except requests.exceptions.HTTPError as err:
217
243
  logging.error(err)
218
244