confluence-cli 1.33.3 → 1.34.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/lib/macro-converter.js +26 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/lib/macro-converter.js
CHANGED
|
@@ -82,6 +82,12 @@ class MacroConverter {
|
|
|
82
82
|
|
|
83
83
|
storage = storage.replace(/<code>(.*?)<\/code>/g, '<code>$1</code>');
|
|
84
84
|
|
|
85
|
+
// **TOC** paragraph → Confluence Table of Contents macro (uses macro defaults)
|
|
86
|
+
storage = storage.replace(
|
|
87
|
+
/<p><strong>TOC<\/strong><\/p>/g,
|
|
88
|
+
'<ac:structured-macro ac:name="toc" />'
|
|
89
|
+
);
|
|
90
|
+
|
|
85
91
|
storage = storage.replace(/<blockquote>(.*?)<\/blockquote>/gs, (_, content) => {
|
|
86
92
|
if (content.includes('<strong>INFO</strong>')) {
|
|
87
93
|
const cleanContent = content.replace(/<p><strong>INFO<\/strong><\/p>\s*/, '');
|
|
@@ -112,6 +118,26 @@ class MacroConverter {
|
|
|
112
118
|
storage = storage.replace(/<th>(.*?)<\/th>/g, '<th><p>$1</p></th>');
|
|
113
119
|
storage = storage.replace(/<td>(.*?)<\/td>/g, '<td><p>$1</p></td>');
|
|
114
120
|
|
|
121
|
+
// **ANCHOR: id** paragraph → Confluence anchor macro
|
|
122
|
+
storage = storage.replace(
|
|
123
|
+
/<p><strong>ANCHOR: (.*?)<\/strong><\/p>/g,
|
|
124
|
+
'<ac:structured-macro ac:name="anchor"><ac:parameter ac:name="">$1</ac:parameter></ac:structured-macro>'
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// Same-page anchor links (href="#id") → ac:link with ac:anchor. Must run
|
|
128
|
+
// before the general link conversion below so the #id pattern is not
|
|
129
|
+
// consumed by the generic <a href> replacement (and so it works under
|
|
130
|
+
// all linkStyle modes, including "plain" which leaves <a> tags as-is).
|
|
131
|
+
storage = storage.replace(/<a href="#(.*?)">(.*?)<\/a>/gs, (_, anchor, body) => {
|
|
132
|
+
const text = body
|
|
133
|
+
.replace(/&/g, '&')
|
|
134
|
+
.replace(/</g, '<')
|
|
135
|
+
.replace(/>/g, '>')
|
|
136
|
+
.replace(/"/g, '"')
|
|
137
|
+
.replace(/'/g, '\'');
|
|
138
|
+
return `<ac:link ac:anchor="${anchor}"><ac:plain-text-link-body><![CDATA[${text}]]></ac:plain-text-link-body></ac:link>`;
|
|
139
|
+
});
|
|
140
|
+
|
|
115
141
|
// Convert links based on linkStyle:
|
|
116
142
|
// "smart" — Cloud smart links (<a data-card-appearance="inline">)
|
|
117
143
|
// "plain" — simple <a href>; workaround for "Cannot handle: DefaultLink"
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "confluence-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "confluence-cli",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.34.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.15.0",
|