markdown-to-confluence 0.3.5__py3-none-any.whl → 0.4.1__py3-none-any.whl
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.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/METADATA +150 -17
- markdown_to_confluence-0.4.1.dist-info/RECORD +25 -0
- md2conf/__init__.py +1 -1
- md2conf/__main__.py +20 -17
- md2conf/api.py +529 -216
- md2conf/application.py +85 -96
- md2conf/collection.py +31 -0
- md2conf/converter.py +99 -78
- md2conf/emoji.py +28 -3
- md2conf/extra.py +27 -0
- md2conf/local.py +28 -41
- md2conf/matcher.py +1 -3
- md2conf/mermaid.py +2 -7
- md2conf/metadata.py +0 -2
- md2conf/processor.py +135 -57
- md2conf/properties.py +66 -14
- md2conf/scanner.py +56 -23
- markdown_to_confluence-0.3.5.dist-info/RECORD +0 -23
- {markdown_to_confluence-0.3.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/WHEEL +0 -0
- {markdown_to_confluence-0.3.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/entry_points.txt +0 -0
- {markdown_to_confluence-0.3.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {markdown_to_confluence-0.3.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/top_level.txt +0 -0
- {markdown_to_confluence-0.3.5.dist-info → markdown_to_confluence-0.4.1.dist-info}/zip-safe +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Publish Markdown files to Confluence wiki
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
9
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
12
|
Classifier: Environment :: Console
|
|
11
13
|
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
14
|
Classifier: Operating System :: OS Independent
|
|
14
15
|
Classifier: Programming Language :: Python :: 3
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -17,19 +18,26 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
22
|
Classifier: Typing :: Typed
|
|
21
23
|
Requires-Python: >=3.9
|
|
22
24
|
Description-Content-Type: text/markdown
|
|
23
25
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: json_strong_typing>=0.3.9
|
|
27
|
+
Requires-Dist: lxml>=6.0
|
|
26
28
|
Requires-Dist: markdown>=3.8
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist: pymdown-extensions>=10.15
|
|
29
|
+
Requires-Dist: pymdown-extensions>=10.16
|
|
29
30
|
Requires-Dist: PyYAML>=6.0
|
|
30
|
-
Requires-Dist: types-PyYAML>=6.0
|
|
31
31
|
Requires-Dist: requests>=2.32
|
|
32
|
-
Requires-Dist:
|
|
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"
|
|
33
41
|
Dynamic: license-file
|
|
34
42
|
|
|
35
43
|
# Publish Markdown files to Confluence wiki
|
|
@@ -49,7 +57,10 @@ This Python package
|
|
|
49
57
|
* Sections and subsections
|
|
50
58
|
* Text with **bold**, *italic*, `monospace`, <ins>underline</ins> and ~~strikethrough~~
|
|
51
59
|
* 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>`)
|
|
61
|
+
* Emoji
|
|
52
62
|
* Ordered and unordered lists
|
|
63
|
+
* Block quotes
|
|
53
64
|
* Code blocks (e.g. Python, JSON, XML)
|
|
54
65
|
* Images (uploaded as Confluence page attachments or hosted externally)
|
|
55
66
|
* Tables
|
|
@@ -95,7 +106,7 @@ In order to get started, you will need
|
|
|
95
106
|
|
|
96
107
|
Confluence organization domain, base path, username, API token and space key can be specified at runtime or set as Confluence environment variables (e.g. add to your `~/.profile` on Linux, or `~/.bash_profile` or `~/.zshenv` on MacOS):
|
|
97
108
|
|
|
98
|
-
```
|
|
109
|
+
```sh
|
|
99
110
|
export CONFLUENCE_DOMAIN='example.atlassian.net'
|
|
100
111
|
export CONFLUENCE_PATH='/wiki/'
|
|
101
112
|
export CONFLUENCE_USER_NAME='levente.hunyadi@instructure.com'
|
|
@@ -105,10 +116,29 @@ export CONFLUENCE_SPACE_KEY='SPACE'
|
|
|
105
116
|
|
|
106
117
|
On Windows, these can be set via system properties.
|
|
107
118
|
|
|
119
|
+
If you use Atlassian scoped API tokens, you should set API URL, substituting `CLOUD_ID` with your own Cloud ID:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
export CONFLUENCE_API_URL='https://api.atlassian.com/ex/confluence/CLOUD_ID/'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
In this case, *md2conf* can automatically determine `CONFLUENCE_DOMAIN` and `CONFLUENCE_PATH`.
|
|
126
|
+
|
|
108
127
|
### Permissions
|
|
109
128
|
|
|
110
129
|
The tool requires appropriate permissions in Confluence in order to invoke endpoints.
|
|
111
130
|
|
|
131
|
+
Required scopes for scoped API tokens are as follows:
|
|
132
|
+
|
|
133
|
+
* `read:page:confluence`
|
|
134
|
+
* `write:page:confluence`
|
|
135
|
+
* `read:space:confluence`
|
|
136
|
+
* `write:space:confluence`
|
|
137
|
+
* `read:attachment:confluence`
|
|
138
|
+
* `write:attachment:confluence`
|
|
139
|
+
* `read:label:confluence`
|
|
140
|
+
* `write:label:confluence`
|
|
141
|
+
|
|
112
142
|
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.
|
|
113
143
|
|
|
114
144
|
If you lack appropriate permissions, you will get an *Unauthorized* response from Confluence. The tool will emit a message that looks as follows:
|
|
@@ -198,6 +228,65 @@ root
|
|
|
198
228
|
└── Mean vs. median
|
|
199
229
|
```
|
|
200
230
|
|
|
231
|
+
### Emoji
|
|
232
|
+
|
|
233
|
+
The short name notation `:smile:` in a Markdown document is converted into the corresponding emoji 😄 when publishing to Confluence.
|
|
234
|
+
|
|
235
|
+
*md2conf* relies on the [Emoji extension](https://facelessuser.github.io/pymdown-extensions/extensions/emoji/) of [PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/) to parse the short name notation with colons, and generate Confluence Storage Format output such as
|
|
236
|
+
|
|
237
|
+
```xml
|
|
238
|
+
<ac:emoticon ac:name="smile" ac:emoji-shortname=":smile:" ac:emoji-id="1f604" ac:emoji-fallback="😄"/>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Colors
|
|
242
|
+
|
|
243
|
+
Confluence allows setting text color and highlight color. Even though Markdown doesn't directly support colors, it is possible to set text and highlight color via the HTML element `<span>` and the CSS attributes `color` and `background-color`, respectively:
|
|
244
|
+
|
|
245
|
+
Text in <span style="color: rgb(255,86,48);">red</span>, <span style="color: rgb(54,179,126);">green</span> and <span style="color: rgb(76,154,255);">blue</span>:
|
|
246
|
+
|
|
247
|
+
```markdown
|
|
248
|
+
Text in <span style="color: rgb(255,86,48);">red</span>, <span style="color: rgb(54,179,126);">green</span> and <span style="color: rgb(76,154,255);">blue</span>.
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
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>:
|
|
252
|
+
|
|
253
|
+
```markdown
|
|
254
|
+
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>.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The following table shows standard text colors (CSS `color`) that are available via Confluence UI:
|
|
258
|
+
|
|
259
|
+
| Color name | CSS attribute value |
|
|
260
|
+
| ------------- | ------------------- |
|
|
261
|
+
| bold blue | rgb(7,71,166) |
|
|
262
|
+
| blue | rgb(76,154,255) |
|
|
263
|
+
| subtle blue | rgb(179,212,255) |
|
|
264
|
+
| bold teal | rgb(0,141,166) |
|
|
265
|
+
| teal | rgb(0,184,217) |
|
|
266
|
+
| subtle teal | rgb(179,245,255) |
|
|
267
|
+
| bold green | rgb(0,102,68) |
|
|
268
|
+
| green | rgb(54,179,126) |
|
|
269
|
+
| subtle green | rgb(171,245,209) |
|
|
270
|
+
| bold orange | rgb(255,153,31) |
|
|
271
|
+
| yellow | rgb(255,196,0) |
|
|
272
|
+
| subtle yellow | rgb(255,240,179) |
|
|
273
|
+
| bold red | rgb(191,38,0) |
|
|
274
|
+
| red | rgb(255,86,48) |
|
|
275
|
+
| subtle red | rgb(255,189,173) |
|
|
276
|
+
| bold purple | rgb(64,50,148) |
|
|
277
|
+
| purple | rgb(101,84,192) |
|
|
278
|
+
| subtle purple | rgb(234,230,255) |
|
|
279
|
+
|
|
280
|
+
The following table shows standard highlight colors (CSS `background-color`) that are available via Confluence UI:
|
|
281
|
+
|
|
282
|
+
| Color name | CSS attribute value |
|
|
283
|
+
| ------------- | ------------------- |
|
|
284
|
+
| teal | rgb(198,237,251) |
|
|
285
|
+
| lime | rgb(211,241,167) |
|
|
286
|
+
| yellow | rgb(254,222,200) |
|
|
287
|
+
| magenta | rgb(253,208,236) |
|
|
288
|
+
| purple | rgb(223,216,253) |
|
|
289
|
+
|
|
201
290
|
### Lists and tables
|
|
202
291
|
|
|
203
292
|
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.
|
|
@@ -222,12 +311,43 @@ Relative paths to items in a nested directory are not supported. You must put `.
|
|
|
222
311
|
|
|
223
312
|
*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:
|
|
224
313
|
|
|
225
|
-
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.
|
|
314
|
+
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.
|
|
226
315
|
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.
|
|
227
316
|
3. The file name (without the extension `.md`).
|
|
228
317
|
|
|
229
318
|
If a matching Confluence page already exists for a Markdown file, the page title in Confluence is left unchanged.
|
|
230
319
|
|
|
320
|
+
### Labels
|
|
321
|
+
|
|
322
|
+
If a Markdown document has the front-matter attribute `tags`, *md2conf* assigns the specified tags to the Confluence page as labels.
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
---
|
|
326
|
+
title: "Example document"
|
|
327
|
+
tags: ["markdown", "md", "wiki"]
|
|
328
|
+
---
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Any previously assigned labels are discarded. As per Confluence terminology, new labels have the `prefix` of `global`.
|
|
332
|
+
|
|
333
|
+
If a document has no `tags` attribute, existing Confluence labels are left intact.
|
|
334
|
+
|
|
335
|
+
### Content properties
|
|
336
|
+
|
|
337
|
+
The front-matter attribute `properties` in a Markdown document allows setting Confluence content properties on a page. Confluence content properties are a way to store structured metadata in the form of key-value pairs directly on Confluence content. The values in content properties are represented as JSON objects.
|
|
338
|
+
|
|
339
|
+
Some content properties have special meaning to Confluence. For example, the following properties cause Confluence to display a wiki page with content confined to a fixed width in regular view mode, and taking the full page width in draft mode:
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
---
|
|
343
|
+
properties:
|
|
344
|
+
content-appearance-published: fixed-width
|
|
345
|
+
content-appearance-draft: full-width
|
|
346
|
+
---
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
The attribute `properties` is parsed as a dictionary with keys of type string and values of type JSON. *md2conf* passes JSON values to Confluence REST API unchanged.
|
|
350
|
+
|
|
231
351
|
### Converting diagrams
|
|
232
352
|
|
|
233
353
|
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:
|
|
@@ -235,6 +355,18 @@ You can include [Mermaid diagrams](https://mermaid.js.org/) in your Markdown doc
|
|
|
235
355
|
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
356
|
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
357
|
|
|
358
|
+
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:
|
|
359
|
+
|
|
360
|
+
```sh
|
|
361
|
+
mmdc -i sample.mmd -o sample.png -b transparent --scale 2
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
|
|
365
|
+
|
|
366
|
+
### Local output
|
|
367
|
+
|
|
368
|
+
*md2conf* supports local output, in which the tool doesn't communicate with the Confluence REST API. Instead, it reads a single Markdown file or a directory of Markdown files, and writes Confluence Storage Format (`*.csf`) output for each document. (Confluence Storage Format is a derivative of XHTML with Confluence-specific tags for complex elements such as images with captions, code blocks, info panels, collapsed sections, etc.) You can push the generated output to Confluence by invoking the API (e.g. with `curl`).
|
|
369
|
+
|
|
238
370
|
### Running the tool
|
|
239
371
|
|
|
240
372
|
You execute the command-line tool `md2conf` to synchronize the Markdown file with Confluence:
|
|
@@ -247,8 +379,8 @@ Use the `--help` switch to get a full list of supported command-line options:
|
|
|
247
379
|
|
|
248
380
|
```console
|
|
249
381
|
$ python3 -m md2conf --help
|
|
250
|
-
usage: md2conf [-h] [--version] [-d DOMAIN] [-p PATH] [-u USERNAME] [-a
|
|
251
|
-
[--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
|
|
382
|
+
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] [--generated-by GENERATED_BY]
|
|
383
|
+
[--no-generated-by] [--render-mermaid] [--no-render-mermaid] [--render-mermaid-format {png,svg}] [--heading-anchors] [--ignore-invalid-url] [--local] [--headers [KEY=VALUE ...]] [--webui-links]
|
|
252
384
|
mdpath
|
|
253
385
|
|
|
254
386
|
positional arguments:
|
|
@@ -260,9 +392,10 @@ options:
|
|
|
260
392
|
-d DOMAIN, --domain DOMAIN
|
|
261
393
|
Confluence organization domain.
|
|
262
394
|
-p PATH, --path PATH Base path for Confluence (default: '/wiki/').
|
|
395
|
+
--api-url API_URL Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.
|
|
263
396
|
-u USERNAME, --username USERNAME
|
|
264
397
|
Confluence user name.
|
|
265
|
-
-a
|
|
398
|
+
-a API_KEY, --apikey API_KEY, --api-key API_KEY
|
|
266
399
|
Confluence API key. Refer to documentation how to obtain one.
|
|
267
400
|
-s SPACE, --space SPACE
|
|
268
401
|
Confluence space key for pages to be published. If omitted, will default to user space.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
markdown_to_confluence-0.4.1.dist-info/licenses/LICENSE,sha256=Pv43so2bPfmKhmsrmXFyAvS7M30-1i1tzjz6-dfhyOo,1077
|
|
2
|
+
md2conf/__init__.py,sha256=K6ZE42N5KJjN5o2GqIFa_lcPZvMMCXPMMRWEkvlmcp0,402
|
|
3
|
+
md2conf/__main__.py,sha256=MJm9U75savKWKYm4dLREqlsyBWEqkTtaM4YTWkEeo0E,8388
|
|
4
|
+
md2conf/api.py,sha256=RQ_nb0Z0VnhJma1BU9ABeb4MQZvZEfFS5mTXXKcY6bk,37584
|
|
5
|
+
md2conf/application.py,sha256=cXYXYdEdmMXwhxF69eUiPPG2Ixt4xtlWHXa28wTq150,7571
|
|
6
|
+
md2conf/collection.py,sha256=EAXuIFcIRBO-Giic2hdU2d4Hpj0_ZFBAWI3aKQ2fjrI,775
|
|
7
|
+
md2conf/converter.py,sha256=x2LAY1Hpw5mTVFNJE5_Zm-o7p5y6TTds6KfrpdM5qQk,38823
|
|
8
|
+
md2conf/emoji.py,sha256=UzDrxqFo59wHmbbJmMNdn0rYFDXbZE4qirOM-_egzXc,2603
|
|
9
|
+
md2conf/entities.dtd,sha256=M6NzqL5N7dPs_eUA_6sDsiSLzDaAacrx9LdttiufvYU,30215
|
|
10
|
+
md2conf/extra.py,sha256=VuMxuOnnC2Qwy6y52ukIxsaYhrZArRqMmRHRE4QZl8g,687
|
|
11
|
+
md2conf/local.py,sha256=MVwGxy_n00uqCInLK8FVGaaVnaOp1nfn28PVrWz3cCQ,3496
|
|
12
|
+
md2conf/matcher.py,sha256=izgL_MAMqbXjKPvAz3KpFv5OTDsaJ9GplTJbixrT3oY,4918
|
|
13
|
+
md2conf/mermaid.py,sha256=f0x7ISj-41ZMh4zTAFPhIWwr94SDcsVZUc1NWqmH_G4,2508
|
|
14
|
+
md2conf/metadata.py,sha256=TxgUrskqsWor_pvlQx-p86C0-0qRJ2aeQhuDcXU9Dpc,886
|
|
15
|
+
md2conf/processor.py,sha256=yWVRYtbc9UHSUfRxqyPDsgeVqO7gx0s3RiGL1GzMotE,9405
|
|
16
|
+
md2conf/properties.py,sha256=RC1jY_TKVbOv2bJxXn27Fj4fNWzyoNUQt6ltgUyVQAQ,3987
|
|
17
|
+
md2conf/puppeteer-config.json,sha256=-dMTAN_7kNTGbDlfXzApl0KJpAWna9YKZdwMKbpOb60,159
|
|
18
|
+
md2conf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
md2conf/scanner.py,sha256=qXfnJkaEwDbz6G6Z9llqifBp2TLAlrXAIP4qkCbGdWo,4964
|
|
20
|
+
markdown_to_confluence-0.4.1.dist-info/METADATA,sha256=rAXtL2mR1LHmc_pwkmnwrGpIDMEw-7kZjIJOnMi-NLA,24864
|
|
21
|
+
markdown_to_confluence-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
markdown_to_confluence-0.4.1.dist-info/entry_points.txt,sha256=F1zxa1wtEObtbHS-qp46330WVFLHdMnV2wQ-ZorRmX0,50
|
|
23
|
+
markdown_to_confluence-0.4.1.dist-info/top_level.txt,sha256=_FJfl_kHrHNidyjUOuS01ngu_jDsfc-ZjSocNRJnTzU,8
|
|
24
|
+
markdown_to_confluence-0.4.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
25
|
+
markdown_to_confluence-0.4.1.dist-info/RECORD,,
|
md2conf/__init__.py
CHANGED
|
@@ -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.
|
|
8
|
+
__version__ = "0.4.1"
|
|
9
9
|
__author__ = "Levente Hunyadi"
|
|
10
10
|
__copyright__ = "Copyright 2022-2025, Levente Hunyadi"
|
|
11
11
|
__license__ = "MIT"
|
md2conf/__main__.py
CHANGED
|
@@ -23,21 +23,19 @@ from . import __version__
|
|
|
23
23
|
from .api import ConfluenceAPI
|
|
24
24
|
from .application import Application
|
|
25
25
|
from .converter import ConfluenceDocumentOptions, ConfluencePageID
|
|
26
|
+
from .extra import override
|
|
26
27
|
from .local import LocalConverter
|
|
27
28
|
from .metadata import ConfluenceSiteMetadata
|
|
28
|
-
from .properties import
|
|
29
|
-
ArgumentError,
|
|
30
|
-
ConfluenceConnectionProperties,
|
|
31
|
-
ConfluenceSiteProperties,
|
|
32
|
-
)
|
|
29
|
+
from .properties import ArgumentError, ConfluenceConnectionProperties, ConfluenceSiteProperties
|
|
33
30
|
|
|
34
31
|
|
|
35
32
|
class Arguments(argparse.Namespace):
|
|
36
33
|
mdpath: Path
|
|
37
34
|
domain: Optional[str]
|
|
38
35
|
path: Optional[str]
|
|
36
|
+
api_url: Optional[str]
|
|
39
37
|
username: Optional[str]
|
|
40
|
-
|
|
38
|
+
api_key: Optional[str]
|
|
41
39
|
space: Optional[str]
|
|
42
40
|
loglevel: str
|
|
43
41
|
ignore_invalid_url: bool
|
|
@@ -55,6 +53,7 @@ class Arguments(argparse.Namespace):
|
|
|
55
53
|
class KwargsAppendAction(argparse.Action):
|
|
56
54
|
"""Append key-value pairs to a dictionary"""
|
|
57
55
|
|
|
56
|
+
@override
|
|
58
57
|
def __call__(
|
|
59
58
|
self,
|
|
60
59
|
parser: argparse.ArgumentParser,
|
|
@@ -68,7 +67,7 @@ class KwargsAppendAction(argparse.Action):
|
|
|
68
67
|
raise argparse.ArgumentError(
|
|
69
68
|
self,
|
|
70
69
|
f'Could not parse argument "{values}". It should follow the format: k1=v1 k2=v2 ...',
|
|
71
|
-
)
|
|
70
|
+
) from None
|
|
72
71
|
setattr(namespace, self.dest, d)
|
|
73
72
|
|
|
74
73
|
|
|
@@ -76,17 +75,20 @@ def main() -> None:
|
|
|
76
75
|
parser = argparse.ArgumentParser()
|
|
77
76
|
parser.prog = os.path.basename(os.path.dirname(__file__))
|
|
78
77
|
parser.add_argument("--version", action="version", version=__version__)
|
|
79
|
-
parser.add_argument(
|
|
80
|
-
"mdpath", help="Path to Markdown file or directory to convert and publish."
|
|
81
|
-
)
|
|
78
|
+
parser.add_argument("mdpath", help="Path to Markdown file or directory to convert and publish.")
|
|
82
79
|
parser.add_argument("-d", "--domain", help="Confluence organization domain.")
|
|
80
|
+
parser.add_argument("-p", "--path", help="Base path for Confluence (default: '/wiki/').")
|
|
83
81
|
parser.add_argument(
|
|
84
|
-
"-
|
|
82
|
+
"--api-url",
|
|
83
|
+
dest="api_url",
|
|
84
|
+
help="Confluence API URL. Required for scoped tokens. Refer to documentation how to obtain one.",
|
|
85
85
|
)
|
|
86
86
|
parser.add_argument("-u", "--username", help="Confluence user name.")
|
|
87
87
|
parser.add_argument(
|
|
88
88
|
"-a",
|
|
89
89
|
"--apikey",
|
|
90
|
+
"--api-key",
|
|
91
|
+
dest="api_key",
|
|
90
92
|
help="Confluence API key. Refer to documentation how to obtain one.",
|
|
91
93
|
)
|
|
92
94
|
parser.add_argument(
|
|
@@ -224,12 +226,13 @@ def main() -> None:
|
|
|
224
226
|
else:
|
|
225
227
|
try:
|
|
226
228
|
properties = ConfluenceConnectionProperties(
|
|
227
|
-
args.
|
|
228
|
-
args.
|
|
229
|
-
args.
|
|
230
|
-
args.
|
|
231
|
-
args.
|
|
232
|
-
args.
|
|
229
|
+
api_url=args.api_url,
|
|
230
|
+
domain=args.domain,
|
|
231
|
+
base_path=args.path,
|
|
232
|
+
user_name=args.username,
|
|
233
|
+
api_key=args.api_key,
|
|
234
|
+
space_key=args.space,
|
|
235
|
+
headers=args.headers,
|
|
233
236
|
)
|
|
234
237
|
except ArgumentError as e:
|
|
235
238
|
parser.error(str(e))
|