TOC in Current Page

Creates a table of contents from heading in the current page and inserts at the top of the page. Optionally it adds "Back to Top" links to the headings.


Author(s) : Onetastic ★
Category : TOC
Last Updated : September 22, 2023
Requirements : OneNote 2010 or above
Watch this short video to learn more about this macro
Screenshot :

TOC in Current Page

Include headings up to
Changelog :

September 22, 2023 (50A1D8) - Onetastic ★
Fixed a second issue which would result in an empty line before the last item in the TOC

December 16, 2022 (9B42F1) - Onetastic ★
Fixed an issue where an empty line would appear before the last item in the TOC

December 13, 2022 (169982) - Onetastic ★
Added menu to quickly select the heading level. Fixed an issue where there would be extra space left after the TOC or TOC would be incorrectly generated when different levels are selected.

August 08, 2022 (EFAC69) - Onetastic ★
Fixed an issue where the macro will fail with an error on some pages with images

May 14, 2022 (9F1898) - Onetastic ★
Fixed a bug where page content would be removed if it consists of tables or other non-text content

January 17, 2022 (EE2A63) - Onetastic ★
Added option to have the TOC contain list numbers if the headings are part of a numbered list.

December 07, 2020 (10CBCC) - Onetastic ★
Added option to choose heading level for TOC

May 28, 2018 (CF836A) - Onetastic ★
Fixed an issue where the macro will fail with an error

April 24, 2018 (1B3508) - Onetastic ★
Fixed an issue where the "Back to Top" links wouldn't be updated if they already exist. Also the macro will now remember the "Back to Top" setting.

December 17, 2017 (EA5512) - Onetastic ★
Updated to refresh the TOC in the current page if it already exists.

September 04, 2016 (157AED) - Onetastic ★
Now finds all the headers in the page, even if they are in a table.

August 16, 2016 (C55DB0) - Onetastic ★
Re-added the option for "Back to Top" links, which was lost in the previous update.

July 30, 2016 (A20BF1) - Onetastic ★
TOC now uses indents based on heading level so that it can be collapsed

June 20, 2016 (E0E260) - Onetastic ★
Re-written with the new Macro Language to take advantage of cleaner syntax and performance improvements

These versions are no longer supported:

July 24, 2014 - Onetastic ★
Added the option for "Back to Top" links.

March 17, 2013 - Onetastic ★
Initial version


zhongye - 2023-07-18
When updating the directory, the original directory was not overwritten repeatedly, resulting in two directories.
yandot - 2023-02-20
The empty line still appears before the last item in the TOC. Even in version December 16, 2022 (9B42F1)
Tiffany - 2022-12-27
Is it possible to use headings to create a TOC for the entire section?
Show more comments (110 more)