Summary
When a macro is missing the parameter the handler reads, the walker emits a marker with an empty interpolation slot, producing visibly broken markdown.
Cases
-
Anchor without <ac:parameter>:
- Input:
<ac:structured-macro ac:name="anchor"></ac:structured-macro>
- Output:
**ANCHOR: ** (literal trailing space + empty id)
- Expected: drop the macro entirely.
-
Panel without title parameter:
- Input:
<ac:structured-macro ac:name="panel"><ac:rich-text-body><p>body</p></ac:rich-text-body></ac:structured-macro>
- Output:
> ****\n>\n> body
- Expected: skip the title bold (
> body only) or fall back to a default label.
-
Code with neither language nor body:
- Lower-priority cosmetic edge.
Why it matters
Real Confluence pages occasionally contain partially-authored macros (e.g. someone deleted a panel title in the editor). The walker should gracefully degrade rather than emit literally **** or **ANCHOR: **.
Proposed fix
Each handler that reads a parameter should guard explicitly:
```js
handleAnchor(node) {
const param = this.findParamByName(node, '');
const id = param ? this.getTextContent(param) : '';
if (!id) return ''; // Skip the macro instead of emitting an empty marker
return `\nANCHOR: ${id}\n`;
}
```
Source
Summary
When a macro is missing the parameter the handler reads, the walker emits a marker with an empty interpolation slot, producing visibly broken markdown.
Cases
Anchor without
<ac:parameter>:<ac:structured-macro ac:name="anchor"></ac:structured-macro>**ANCHOR: **(literal trailing space + empty id)Panel without title parameter:
<ac:structured-macro ac:name="panel"><ac:rich-text-body><p>body</p></ac:rich-text-body></ac:structured-macro>> ****\n>\n> body> bodyonly) or fall back to a default label.Code with neither language nor body:
Why it matters
Real Confluence pages occasionally contain partially-authored macros (e.g. someone deleted a panel title in the editor). The walker should gracefully degrade rather than emit literally
****or**ANCHOR: **.Proposed fix
Each handler that reads a parameter should guard explicitly:
```js
handleAnchor(node) {
const param = this.findParamByName(node, '');
const id = param ? this.getTextContent(param) : '';
if (!id) return ''; // Skip the macro instead of emitting an empty marker
return `\nANCHOR: ${id}\n`;
}
```
Source
lib/storage-walker.js—handleAnchor,handlePanel,handleCode