confluence-cli 1.35.0 → 2.0.1
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.
- package/README.md +49 -0
- package/lib/config.js +11 -7
- package/lib/macro-converter.js +4 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -770,6 +770,55 @@ echo "# Hello" | confluence convert --input-format markdown --output-format stor
|
|
|
770
770
|
confluence convert -i page.xml -o page.md --input-format storage --output-format markdown
|
|
771
771
|
```
|
|
772
772
|
|
|
773
|
+
## Markdown Marker Conventions
|
|
774
|
+
|
|
775
|
+
When converting markdown to Confluence storage format (via `confluence convert`, `create`, or `update`), the following paragraph-level markers produce native Confluence macros. Each marker round-trips back to its markdown form when going storage → markdown.
|
|
776
|
+
|
|
777
|
+
### Callout macros — `INFO`, `WARNING`, `NOTE`
|
|
778
|
+
|
|
779
|
+
A blockquote whose first line is `**INFO**`, `**WARNING**`, or `**NOTE**` becomes the corresponding Confluence macro:
|
|
780
|
+
|
|
781
|
+
```markdown
|
|
782
|
+
> **INFO**
|
|
783
|
+
> Heads up — this is an info box.
|
|
784
|
+
|
|
785
|
+
> **WARNING**
|
|
786
|
+
> Watch out for this.
|
|
787
|
+
|
|
788
|
+
> **NOTE**
|
|
789
|
+
> Side note for the reader.
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
The reverse direction emits the equivalent shorthand (`[!info]` / `[!warning]` / `[!note]` followed by the body), which markdown→storage then re-expands.
|
|
793
|
+
|
|
794
|
+
A blockquote without one of these markers stays a **plain blockquote** (`<blockquote>…</blockquote>`) — `> …` is treated as a quotation, not an alert. Use the markers above when you want a callout.
|
|
795
|
+
|
|
796
|
+
### `**TOC**` — Table of Contents
|
|
797
|
+
|
|
798
|
+
A paragraph containing only `**TOC**` becomes a Confluence Table of Contents macro using the macro's default heading levels:
|
|
799
|
+
|
|
800
|
+
```markdown
|
|
801
|
+
**TOC**
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### `**ANCHOR: id**` — anchor
|
|
805
|
+
|
|
806
|
+
A paragraph containing only `**ANCHOR: my-section**` becomes a Confluence anchor macro with the given id:
|
|
807
|
+
|
|
808
|
+
```markdown
|
|
809
|
+
**ANCHOR: my-section**
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### `[text](#id)` — same-page anchor link
|
|
813
|
+
|
|
814
|
+
A standard markdown link whose href starts with `#` becomes an `ac:link` with `ac:anchor`, rendering as an in-page jump in Confluence:
|
|
815
|
+
|
|
816
|
+
```markdown
|
|
817
|
+
See [the anchor](#my-section) above.
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
This works under all three `linkStyle` modes (`smart`, `wiki`, `plain`) — the anchor-link conversion runs before the general `<a href>` handling.
|
|
821
|
+
|
|
773
822
|
## Development
|
|
774
823
|
|
|
775
824
|
```bash
|
package/lib/config.js
CHANGED
|
@@ -257,7 +257,7 @@ function saveConfigFile(data) {
|
|
|
257
257
|
const validateCliOptions = (options) => {
|
|
258
258
|
const errors = [];
|
|
259
259
|
|
|
260
|
-
if (options.domain && !options.domain.trim()) {
|
|
260
|
+
if (options.domain && (typeof options.domain !== 'string' || !options.domain.trim())) {
|
|
261
261
|
errors.push('--domain cannot be empty');
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -265,12 +265,12 @@ const validateCliOptions = (options) => {
|
|
|
265
265
|
errors.push('--token cannot be empty');
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
if (options.email && !options.email.trim()) {
|
|
268
|
+
if (options.email && (typeof options.email !== 'string' || !options.email.trim())) {
|
|
269
269
|
errors.push('--email cannot be empty');
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
if (options.apiPath) {
|
|
273
|
-
if (!options.apiPath.startsWith('/')) {
|
|
273
|
+
if (typeof options.apiPath !== 'string' || !options.apiPath.startsWith('/')) {
|
|
274
274
|
errors.push('--api-path must start with "/"');
|
|
275
275
|
} else {
|
|
276
276
|
// Validate API path format
|
|
@@ -282,16 +282,18 @@ const validateCliOptions = (options) => {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
if (options.protocol && !['http', 'https'].includes(options.protocol.toLowerCase())) {
|
|
285
|
+
if (options.protocol && (typeof options.protocol !== 'string' || !['http', 'https'].includes(options.protocol.toLowerCase()))) {
|
|
286
286
|
errors.push('--protocol must be "http" or "https"');
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
if (options.authType && !AUTH_TYPES.includes(options.authType.toLowerCase())) {
|
|
289
|
+
if (options.authType && (typeof options.authType !== 'string' || !AUTH_TYPES.includes(options.authType.toLowerCase()))) {
|
|
290
290
|
errors.push('--auth-type must be "basic", "bearer", "mtls", or "cookie"');
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
// Check if basic auth is provided with email
|
|
294
|
-
const normAuthType = options.authType
|
|
294
|
+
const normAuthType = (typeof options.authType === 'string' && options.authType)
|
|
295
|
+
? normalizeAuthType(options.authType, Boolean(options.email))
|
|
296
|
+
: null;
|
|
295
297
|
if (normAuthType === 'basic' && !options.email) {
|
|
296
298
|
errors.push('--email is required when using basic authentication (use your username for on-premise)');
|
|
297
299
|
}
|
|
@@ -512,7 +514,9 @@ async function initConfig(cliOptions = {}) {
|
|
|
512
514
|
protocol: cliOptions.protocol,
|
|
513
515
|
domain: cliOptions.domain,
|
|
514
516
|
apiPath: cliOptions.apiPath,
|
|
515
|
-
authType: cliOptions.authType
|
|
517
|
+
authType: (typeof cliOptions.authType === 'string' && cliOptions.authType)
|
|
518
|
+
? cliOptions.authType.trim().toLowerCase()
|
|
519
|
+
: cliOptions.authType,
|
|
516
520
|
email: cliOptions.email,
|
|
517
521
|
token: cliOptions.token,
|
|
518
522
|
cookie: cliOptions.cookie,
|
package/lib/macro-converter.js
CHANGED
|
@@ -105,9 +105,10 @@ class MacroConverter {
|
|
|
105
105
|
<ac:rich-text-body>${cleanContent}</ac:rich-text-body>
|
|
106
106
|
</ac:structured-macro>`;
|
|
107
107
|
} else {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
// Plain blockquote — `> …` is a quotation, not an alert. Use the
|
|
109
|
+
// `> **INFO**` / `> **WARNING**` / `> **NOTE**` markers above to
|
|
110
|
+
// produce a Confluence info / warning / note macro instead.
|
|
111
|
+
return `<blockquote>${content}</blockquote>`;
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
114
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "confluence-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "confluence-cli",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "2.0.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.15.0",
|