confluence-cli 1.2.0 → 1.3.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ # [1.3.0](https://github.com/pchuri/confluence-cli/compare/v1.2.0...v1.3.0) (2025-06-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improve format handling based on production testing ([820f9cd](https://github.com/pchuri/confluence-cli/commit/820f9cdc7e59b6aa4b676eda6cff7e22865ec8fb))
7
+
8
+
9
+ ### Features
10
+
11
+ * implement page creation and update capabilities ([3c43b19](https://github.com/pchuri/confluence-cli/commit/3c43b19765f94318d01fea3a22b324ada00a77d1))
12
+
13
+ # [1.2.1](https://github.com/pchuri/confluence-cli/compare/v1.2.0...v1.2.1) (2025-06-27)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **format handling**: improve compatibility across Confluence instances
19
+ - Switch from 'html' macro to 'markdown' macro for better compatibility
20
+ - Change HTML processing to direct Storage format (no macro wrapper)
21
+ - Add markdownToNativeStorage method for alternative conversion
22
+ - Fix issues discovered during production testing in real Confluence environments
23
+
1
24
  # [1.2.0](https://github.com/pchuri/confluence-cli/compare/v1.1.0...v1.2.0) (2025-06-27)
2
25
 
3
26
 
@@ -17,8 +40,13 @@
17
40
  - Support for reading content from files or inline
18
41
  - Markdown to Confluence Storage format conversion
19
42
  * **content formats**: support multiple input formats
43
+ <<<<<<< HEAD
44
+ - Markdown format with automatic conversion using `markdown` macro
45
+ - HTML format with direct Storage format integration
46
+ =======
20
47
  - Markdown format with automatic conversion
21
48
  - HTML format with Storage format wrapping
49
+ >>>>>>> origin/main
22
50
  - Native Confluence Storage format
23
51
  * **examples**: add sample files and demo scripts for new features
24
52
 
@@ -139,15 +139,47 @@ class ConfluenceClient {
139
139
  * Convert markdown to Confluence storage format
140
140
  */
141
141
  markdownToStorage(markdown) {
142
+ // Use Confluence's markdown macro instead of HTML
143
+ return `<ac:structured-macro ac:name="markdown">
144
+ <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
145
+ <ac:plain-text-body><![CDATA[${markdown}]]></ac:plain-text-body>
146
+ </ac:structured-macro>`;
147
+ }
148
+
149
+ /**
150
+ * Convert markdown to Confluence storage format using native storage format
151
+ */
152
+ markdownToNativeStorage(markdown) {
142
153
  // Convert markdown to HTML first
143
154
  const html = this.markdown.render(markdown);
144
155
 
145
- // Basic conversion to Confluence storage format
146
- // This is a simplified version - Confluence has a specific storage format
147
- return `<ac:structured-macro ac:name="html">
148
- <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
149
- <ac:plain-text-body><![CDATA[${html}]]></ac:plain-text-body>
150
- </ac:structured-macro>`;
156
+ // Simple HTML to Storage format conversion
157
+ // This is a basic implementation - for full support, we'd need a more sophisticated converter
158
+ let storage = html
159
+ .replace(/<h1>/g, '<h1>')
160
+ .replace(/<\/h1>/g, '</h1>')
161
+ .replace(/<h2>/g, '<h2>')
162
+ .replace(/<\/h2>/g, '</h2>')
163
+ .replace(/<h3>/g, '<h3>')
164
+ .replace(/<\/h3>/g, '</h3>')
165
+ .replace(/<p>/g, '<p>')
166
+ .replace(/<\/p>/g, '</p>')
167
+ .replace(/<strong>/g, '<strong>')
168
+ .replace(/<\/strong>/g, '</strong>')
169
+ .replace(/<em>/g, '<em>')
170
+ .replace(/<\/em>/g, '</em>')
171
+ .replace(/<ul>/g, '<ul>')
172
+ .replace(/<\/ul>/g, '</ul>')
173
+ .replace(/<ol>/g, '<ol>')
174
+ .replace(/<\/ol>/g, '</ol>')
175
+ .replace(/<li>/g, '<li>')
176
+ .replace(/<\/li>/g, '</li>')
177
+ .replace(/<code>/g, '<code>')
178
+ .replace(/<\/code>/g, '</code>')
179
+ .replace(/<pre><code>/g, '<ac:structured-macro ac:name="code"><ac:plain-text-body><![CDATA[')
180
+ .replace(/<\/code><\/pre>/g, ']]></ac:plain-text-body></ac:structured-macro>');
181
+
182
+ return storage;
151
183
  }
152
184
 
153
185
  /**
@@ -159,11 +191,8 @@ class ConfluenceClient {
159
191
  if (format === 'markdown') {
160
192
  storageContent = this.markdownToStorage(content);
161
193
  } else if (format === 'html') {
162
- // Wrap HTML in storage format
163
- storageContent = `<ac:structured-macro ac:name="html">
164
- <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
165
- <ac:plain-text-body><![CDATA[${content}]]></ac:plain-text-body>
166
- </ac:structured-macro>`;
194
+ // Convert HTML directly to storage format (no macro wrapper)
195
+ storageContent = content;
167
196
  }
168
197
 
169
198
  const pageData = {
@@ -193,11 +222,8 @@ class ConfluenceClient {
193
222
  if (format === 'markdown') {
194
223
  storageContent = this.markdownToStorage(content);
195
224
  } else if (format === 'html') {
196
- // Wrap HTML in storage format
197
- storageContent = `<ac:structured-macro ac:name="html">
198
- <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
199
- <ac:plain-text-body><![CDATA[${content}]]></ac:plain-text-body>
200
- </ac:structured-macro>`;
225
+ // Convert HTML directly to storage format (no macro wrapper)
226
+ storageContent = content;
201
227
  }
202
228
 
203
229
  const pageData = {
@@ -236,11 +262,8 @@ class ConfluenceClient {
236
262
  if (format === 'markdown') {
237
263
  storageContent = this.markdownToStorage(content);
238
264
  } else if (format === 'html') {
239
- // Wrap HTML in storage format
240
- storageContent = `<ac:structured-macro ac:name="html">
241
- <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
242
- <ac:plain-text-body><![CDATA[${content}]]></ac:plain-text-body>
243
- </ac:structured-macro>`;
265
+ // Convert HTML directly to storage format (no macro wrapper)
266
+ storageContent = content;
244
267
  }
245
268
 
246
269
  const pageData = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence-cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A command-line interface for Atlassian Confluence with page creation and editing capabilities",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -32,9 +32,9 @@ describe('ConfluenceClient', () => {
32
32
  const markdown = '# Hello World\n\nThis is a **test** page.';
33
33
  const result = client.markdownToStorage(markdown);
34
34
 
35
- expect(result).toContain('<ac:structured-macro ac:name="html">');
36
- expect(result).toContain('<h1>Hello World</h1>');
37
- expect(result).toContain('<strong>test</strong>');
35
+ expect(result).toContain('<ac:structured-macro ac:name="markdown">');
36
+ expect(result).toContain('Hello World');
37
+ expect(result).toContain('**test**');
38
38
  });
39
39
  });
40
40