Skip to content

fix(converter): emit **TOC** marker for toc macro in storage → markdown - #266

Merged
pchuri merged 1 commit into
mainfrom
fix/storage-toc-marker
Oct 3, 2026
Merged

pchuri merged 1 commit into
mainfrom
fix/storage-toc-marker

Conversation

@pchuri

@pchuri pchuri commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Problem

confluence read -f markdown drops the table of contents entirely. handleMacro() in lib/storage-walker.js returned an empty string for the self-closing toc macro, so the TOC position was lost on read. The write direction already maps **TOC** to a toc macro, which made the round-trip asymmetric.

Changes

  • toc now renders as a standalone **TOC** block (same shape as the existing **ANCHOR: id** output), so markdown → storage → markdown preserves its position.
  • floatmenu is unchanged and still renders nothing.
  • Regenerated the parity fixture 11-layouts-and-edge-cases.expected.md with WRITE_PARITY_EXPECTED=1; the only diff is the added **TOC** paragraph.
  • Added round-trip tests in tests/macro-converter.test.js.

Known limitations

  • Macro parameters (maxLevel, minLevel, style, ...) cannot be expressed by **TOC** and are still dropped.
  • Like anchor, a toc macro nested inside a table cell or list item is emitted inline and is not converted back to a macro on write.

Testing

npm test (39 suites, 1485 tests) and eslint pass.

Fixes #265

The walker returned an empty string for the toc macro, so the table of
contents position was lost on read. Emit the **TOC** marker that
markdown → storage already maps back to a toc macro, making the
round-trip symmetric. floatmenu is unchanged.

Fixes #265
@pchuri
pchuri merged commit 5441f9b into main Oct 3, 2026
6 checks passed
@pchuri
pchuri deleted the fix/storage-toc-marker branch October 3, 2026 16:39
github-actions Bot pushed a commit that referenced this pull request Oct 3, 2026
## [2.25.11](v2.25.10...v2.25.11) (2026-10-03)

### Bug Fixes

* **converter:** emit **TOC** marker for toc macro in storage → markdown ([#266](#266)) ([5441f9b](5441f9b)), closes [#265](#265)
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.25.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] TOC macro produces no output when converting storage → markdown

1 participant