I have attached a patch ( redmine-7.0.1-wiki-sidebar-toc.patch ) that adds an option to display the wiki table of contents in the right sidebar.
On pages with many headings, an inline table of contents takes up a large amount of vertical space before the main content. Displaying it in the sidebar allows users to see the main content immediately while keeping the page structure accessible.
To enable this feature, add {{toc(sidebar)}} on a separate line in the wiki page. Both Textile and Markdown (CommonMark) are supported.
On desktop screens, the table of contents stays visible while scrolling and has its own scrollable area. All heading levels included in the table of contents remain expanded, and the current heading is highlighted. Two buttons allow users to jump to the top or bottom of the page.
The patch is based on Redmine 7.0.1 (commit 752772866745) and includes helper, controller, and system tests. The updated system tests pass in Docker using SQLite and headless Chromium (4 tests, 41 assertions, no failures or errors).
The new syntax has not yet been added to the formatting help.
Feedback on the behavior and implementation would be appreciated.
Before:

After:
