confluence-cli 2.1.9 → 2.1.11

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.
@@ -250,9 +250,9 @@ class StorageWalker {
250
250
 
251
251
  handleExpand(node) {
252
252
  const titleParam = this.findParamByName(node, 'title');
253
+ const title = (titleParam ? this.getTextContent(titleParam) : '').trim();
253
254
  const body = this.getMacroBody(node);
254
- if (titleParam) {
255
- const title = this.getTextContent(titleParam);
255
+ if (title) {
256
256
  return `\n**EXPAND: ${title}**\n\n${this.walkNodes(body).trim()}\n\n**EXPAND_END**\n`;
257
257
  }
258
258
  return `\n<details>\n<summary>${this.labels.expandDetails || 'Expand Details'}</summary>\n\n${this.walkNodes(body).trim()}\n\n</details>\n`;
@@ -281,19 +281,23 @@ class StorageWalker {
281
281
 
282
282
  handleAnchor(node) {
283
283
  const param = this.findParamByName(node, '');
284
- const id = param ? this.getTextContent(param) : '';
284
+ const id = (param ? this.getTextContent(param) : '').trim();
285
+ if (!id) return '';
285
286
  return `\n**ANCHOR: ${id}**\n`;
286
287
  }
287
288
 
288
289
  handlePanel(node) {
289
290
  const titleParam = this.findParamByName(node, 'title');
290
- const title = titleParam ? this.getTextContent(titleParam) : '';
291
+ const title = (titleParam ? this.getTextContent(titleParam) : '').trim();
291
292
  const body = this.getMacroBody(node);
292
293
  // Trim before quoting — walkNodes wraps every <p> with a leading and
293
294
  // trailing \n, so untrimmed body splits into ['', 'body', ''] and emits
294
295
  // extra `>` blank lines that bracket the real content.
295
296
  const cleanContent = this.walkNodes(body).trim();
297
+ if (!title && !cleanContent) return '';
296
298
  const quoted = cleanContent.split('\n').map((line) => (line ? `> ${line}` : '>')).join('\n');
299
+ if (!title) return `\n${quoted}\n`;
300
+ if (!cleanContent) return `\n> **${title}**\n`;
297
301
  return `\n> **${title}**\n>\n${quoted}\n`;
298
302
  }
299
303
 
@@ -324,7 +328,7 @@ class StorageWalker {
324
328
 
325
329
  handleSharedBlock(node, type) {
326
330
  const blockKeyParam = this.findParamByName(node, 'shared-block-key');
327
- const blockKey = blockKeyParam ? this.getTextContent(blockKeyParam) : '';
331
+ const blockKey = (blockKeyParam ? this.getTextContent(blockKeyParam) : '').trim();
328
332
  const pageParam = this.findParamByName(node, 'page');
329
333
  if (pageParam && type === 'include-shared-block') {
330
334
  const acLink = this.findChildByName(pageParam, 'ac:link');
@@ -334,7 +338,8 @@ class StorageWalker {
334
338
  const pageTitle = this.escapeMarkdownText(decodeEntities(riPage.attribs['ri:content-title'] || ''));
335
339
  const includeLabel = this.labels.includeSharedBlock || 'Include Shared Block';
336
340
  const fromPageLabel = this.labels.fromPage || 'from page';
337
- return `\n> 📄 **${includeLabel}**: ${blockKey} (${fromPageLabel}: ${pageTitle} [link needs manual correction])\n`;
341
+ const keyPart = blockKey ? `: ${blockKey} ` : ' ';
342
+ return `\n> 📄 **${includeLabel}**${keyPart}(${fromPageLabel}: ${pageTitle} [link needs manual correction])\n`;
338
343
  }
339
344
  }
340
345
  }
@@ -342,8 +347,11 @@ class StorageWalker {
342
347
  // See handlePanel — trim to avoid bracketing `>` blank lines.
343
348
  const cleanContent = this.walkNodes(body).trim();
344
349
  const sharedLabel = this.labels.sharedBlock || 'Shared Block';
350
+ if (!blockKey && !cleanContent) return '';
351
+ const header = blockKey ? `**${sharedLabel}: ${blockKey}**` : `**${sharedLabel}**`;
352
+ if (!cleanContent) return `\n> ${header}\n`;
345
353
  const quoted = cleanContent.split('\n').map((line) => (line ? `> ${line}` : '>')).join('\n');
346
- return `\n> **${sharedLabel}: ${blockKey}**\n>\n${quoted}\n`;
354
+ return `\n> ${header}\n>\n${quoted}\n`;
347
355
  }
348
356
 
349
357
  handleViewFile(node) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "confluence-cli",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "confluence-cli",
9
- "version": "2.1.9",
9
+ "version": "2.1.11",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "axios": "^1.15.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence-cli",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "A command-line interface for Atlassian Confluence with page creation and editing capabilities",
5
5
  "main": "index.js",
6
6
  "bin": {