confluence-md-sync 0.8.5 → 0.8.6

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 CHANGED
@@ -336,6 +336,10 @@ that doesn't fit falls back to markers/fenced blocks automatically.
336
336
  | `status` | `{{status:Текст\|colour=Green\|subtle=true}}` |
337
337
  | `anchor` | `{{anchor:name}}` |
338
338
  | `detailssummary` (Page Properties Report) | `{{properties-report:cql=…\|firstcolumn=…}}` |
339
+ | `portfolio-for-jira-plan` (Portfolio/Advanced Roadmaps plan) | `{{portfolio-for-jira-plan:url=…\|planHeight=900}}` |
340
+
341
+ Adding a macro is a single folder: `src/macros/plugins/` (one file per macro) —
342
+ see [`src/macros/plugins/README.md`](src/macros/plugins/README.md).
339
343
 
340
344
  Inside fenced code blocks the syntax is left untouched. The machine-readable
341
345
  list is exported as `nativeMacroList()`; the md→markers pass is
@@ -307,6 +307,7 @@ class Converter {
307
307
  static NATIVE_PLACEHOLDER_NAME = {
308
308
  toc: 'toc', children: 'children', jira: 'jira', status: 'status',
309
309
  anchor: 'anchor', detailssummary: 'properties-report',
310
+ 'portfolio-for-jira-plan': 'portfolio-for-jira-plan',
310
311
  };
311
312
  tryNativeMd(el, name) {
312
313
  const parts = this.macroParts(el);
@@ -5,10 +5,12 @@ export { escapeXmlAttr, generateMacroId, structuredMacro, pageLinkValue, type St
5
5
  export { coreMacrosPlugin, extractPlainText } from './plugins/core.js';
6
6
  export { tableFilterPlugin, TABLE_FILTER_DEFAULTS } from './plugins/table-filter.js';
7
7
  export { csvTablePlugin, CSV_TABLE_DEFAULTS } from './plugins/csv-table.js';
8
+ export { portfolioForJiraPlanPlugin } from './plugins/portfolio-for-jira-plan.js';
8
9
  import { MacroRegistry } from './registry.js';
9
10
  import { anchor, children, codeBlock, excerpt, excerptInclude, expand, includePage, jiraIssue, panel, status, toc } from './plugins/core.js';
10
11
  import { tableExcerpt, tableExcerptInclude, tableFilter, tableJoiner } from './plugins/table-filter.js';
11
12
  import { csvTable } from './plugins/csv-table.js';
13
+ import { portfolioForJiraPlan } from './plugins/portfolio-for-jira-plan.js';
12
14
  /** Creates a registry pre-loaded with all built-in plugins. */
13
15
  export declare function createDefaultRegistry(): MacroRegistry;
14
16
  /**
@@ -45,4 +47,5 @@ export declare const macros: {
45
47
  tableExcerptInclude: typeof tableExcerptInclude;
46
48
  tableJoiner: typeof tableJoiner;
47
49
  csvTable: typeof csvTable;
50
+ portfolioForJiraPlan: typeof portfolioForJiraPlan;
48
51
  };
@@ -5,16 +5,23 @@ export { escapeXmlAttr, generateMacroId, structuredMacro, pageLinkValue, } from
5
5
  export { coreMacrosPlugin, extractPlainText } from './plugins/core.js';
6
6
  export { tableFilterPlugin, TABLE_FILTER_DEFAULTS } from './plugins/table-filter.js';
7
7
  export { csvTablePlugin, CSV_TABLE_DEFAULTS } from './plugins/csv-table.js';
8
+ export { portfolioForJiraPlanPlugin } from './plugins/portfolio-for-jira-plan.js';
8
9
  import { MacroRegistry } from './registry.js';
9
10
  import { coreMacrosPlugin } from './plugins/core.js';
10
11
  import { tableFilterPlugin } from './plugins/table-filter.js';
11
12
  import { csvTablePlugin } from './plugins/csv-table.js';
13
+ import { portfolioForJiraPlanPlugin } from './plugins/portfolio-for-jira-plan.js';
12
14
  import { anchor, children, codeBlock, excerpt, excerptInclude, expand, includePage, info, jiraIssue, note, panel, status, tip, toc, warning, } from './plugins/core.js';
13
15
  import { tableExcerpt, tableExcerptInclude, tableFilter, tableJoiner } from './plugins/table-filter.js';
14
16
  import { csvTable } from './plugins/csv-table.js';
17
+ import { portfolioForJiraPlan } from './plugins/portfolio-for-jira-plan.js';
15
18
  /** Creates a registry pre-loaded with all built-in plugins. */
16
19
  export function createDefaultRegistry() {
17
- return new MacroRegistry().use(coreMacrosPlugin).use(tableFilterPlugin).use(csvTablePlugin);
20
+ return new MacroRegistry()
21
+ .use(coreMacrosPlugin)
22
+ .use(tableFilterPlugin)
23
+ .use(csvTablePlugin)
24
+ .use(portfolioForJiraPlanPlugin);
18
25
  }
19
26
  /**
20
27
  * Глобальный реестр по умолчанию (core + table-filter). Используется,
@@ -52,4 +59,5 @@ export const macros = {
52
59
  tableExcerptInclude,
53
60
  tableJoiner,
54
61
  csvTable,
62
+ portfolioForJiraPlan,
55
63
  };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Plugin for the "Portfolio for Jira — Plan" macro (portfolio-for-jira-plan):
3
+ * embeds an Advanced Roadmaps / Portfolio plan roadmap on a Confluence page.
4
+ * Bodyless macro; the plan is addressed by `url`, height by `planHeight`.
5
+ *
6
+ * Native md syntax (see native.ts + README): `{{portfolio-for-jira-plan:url=…|planHeight=900}}`.
7
+ */
8
+ import { Markdown } from '../../markdown/markdown.js';
9
+ import { type MacroPlugin } from '../types.js';
10
+ export declare const portfolioForJiraPlanPlugin: MacroPlugin;
11
+ /**
12
+ * Строит макрос «Portfolio for Jira — Plan».
13
+ *
14
+ * @example
15
+ * portfolioForJiraPlan('https://jira/secure/PortfolioRoadmapConfluence.jspa?r=abc', { planHeight: '900' })
16
+ */
17
+ export declare function portfolioForJiraPlan(url: string, opts?: Record<string, string | undefined>): Markdown;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Plugin for the "Portfolio for Jira — Plan" macro (portfolio-for-jira-plan):
3
+ * embeds an Advanced Roadmaps / Portfolio plan roadmap on a Confluence page.
4
+ * Bodyless macro; the plan is addressed by `url`, height by `planHeight`.
5
+ *
6
+ * Native md syntax (see native.ts + README): `{{portfolio-for-jira-plan:url=…|planHeight=900}}`.
7
+ */
8
+ import { macro } from '../builder.js';
9
+ import { paramMap } from '../types.js';
10
+ import { structuredMacro } from '../xml.js';
11
+ // Порядок параметров как у редактора Confluence (стабильный вывод под hash-diff).
12
+ const PORTFOLIO_PARAM_ORDER = ['planHeight', 'url'];
13
+ export const portfolioForJiraPlanPlugin = {
14
+ name: 'portfolio-for-jira-plan',
15
+ macros: [
16
+ {
17
+ // Макрос «Portfolio for Jira — Plan». Bodyless; параметры пробрасываются
18
+ // как есть, в каноничном порядке редактора. url — ссылка на план-роадмап,
19
+ // planHeight — высота встраивания в пикселях.
20
+ name: 'portfolio-for-jira-plan',
21
+ render: (ctx) => {
22
+ const m = paramMap(ctx.params);
23
+ const keys = [...PORTFOLIO_PARAM_ORDER.filter((k) => m[k] !== undefined),
24
+ ...Object.keys(m).filter((k) => !PORTFOLIO_PARAM_ORDER.includes(k))];
25
+ const params = keys.map((k) => ({ name: k, value: m[k] }));
26
+ return structuredMacro('portfolio-for-jira-plan', ctx.macroId, { params });
27
+ },
28
+ },
29
+ ],
30
+ };
31
+ // ── Convenience builder ─────────────────────────────────────────────────
32
+ /**
33
+ * Строит макрос «Portfolio for Jira — Plan».
34
+ *
35
+ * @example
36
+ * portfolioForJiraPlan('https://jira/secure/PortfolioRoadmapConfluence.jspa?r=abc', { planHeight: '900' })
37
+ */
38
+ export function portfolioForJiraPlan(url, opts = {}) {
39
+ return macro('portfolio-for-jira-plan').param('url', url).withParams(opts).toMarkdown();
40
+ }
@@ -51,6 +51,7 @@ export const NATIVE_PLACEHOLDERS = {
51
51
  status: 'status',
52
52
  anchor: 'anchor',
53
53
  'properties-report': 'detailssummary',
54
+ 'portfolio-for-jira-plan': 'portfolio-for-jira-plan',
54
55
  };
55
56
  /** Полный перечень макросов с нативной md-разметкой (для документации/UI). */
56
57
  export function nativeMacroList() {
@@ -68,12 +69,13 @@ export function nativeMacroList() {
68
69
  { macro: 'status', syntax: '{{status:Текст|colour=Green|subtle=true}}' },
69
70
  { macro: 'anchor', syntax: '{{anchor:имя}}' },
70
71
  { macro: 'detailssummary', syntax: '{{properties-report:cql=…|firstcolumn=…}}' },
72
+ { macro: 'portfolio-for-jira-plan', syntax: '{{portfolio-for-jira-plan:url=…|planHeight=900}}' },
71
73
  ];
72
74
  }
73
75
  const ADMONITION_FIRST_RE = /^>\s*\[!([A-Za-z]+)\]\s*(.*)$/;
74
76
  const DIRECTIVE_OPEN_RE = /^:::\s+([a-z-]+)(?:\s+(.*?))?\s*$/;
75
77
  const DIRECTIVE_CLOSE_RE = /^:::\s*$/;
76
- const PLACEHOLDER_INLINE_RE = /\{\{(toc|children|jira|status|anchor|properties-report)(?::((?:[^{}]|\{[^{])*?))?\}\}/g;
78
+ const PLACEHOLDER_INLINE_RE = /\{\{(toc|children|jira|status|anchor|properties-report|portfolio-for-jira-plan)(?::((?:[^{}]|\{[^{])*?))?\}\}/g;
77
79
  const FENCE_RE = /^\s*(`{3,}|~{3,})/;
78
80
  /** Компактная пара маркеров без тела — для строчного контекста. */
79
81
  function inlineMarker(macroName, params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence-md-sync",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "Publish Markdown to Confluence (Data Center & Cloud): idempotent page sync, attachment dedup, tables and a pluggable macro system",
5
5
  "keywords": [
6
6
  "confluence",