A table of contents is a list of jump links that lead to different sections on a page or post. 

there is a good plugin and I want share it to you.

I have researched and see ,it have good rating from user.

there are 400,000+ people install it.

check it on this link https://wordpress.org/plugins/easy-table-of-contents/ .

Plugin Features

  • Automatically generate a table of contents for your posts, pages and custom post types by parsing its contents for headers.
  • Supports the <!--nextpage--> tag.
  • Supports the Rank Math plugin.
  • Works with the Classic Editor, Gutenberg, Divi, Elementor, WPBakery Page Builder and Visual Composer page editors.
  • Optionally enable for pages and/or posts. Custom post types are supported, as long as their content is output with the the_content() template tag.
  • Optionally auto insert the table of contents into the page, selectable by enabled post type.
  • Provides many easy to understand options to configure when and where to insert the table of contents.
  • Many options are available to configure how the inserted table of contents appears which include several builtin themes. If the supplied themes do no meet you needs, you can create your own by choosing you own colors for the border, background and link color.
  • Multiple counter bullet formats to choose from; none, decimal, numeric and roman.
  • Choose to display the table of contents hierarchical or not. This means headings of lower priority will be nested under headings of higher priority.
  • User can optionally hide the table of contents. You full control of this feature. It can be disabled and you can choose to have it hidden by default.
  • Supports smooth scrolling.
  • Selectively enable or disabled the table of contents on a post by post basis.
  • Choose which headings are used to generate the table of contents. This too can be set on a post by post basis.
  • Easily exclude headers globally and on a post by post basis.
  • If you rather not insert the table of contents in the post content, you can use the supplied widget and place the table of contents in your theme’s sidebar.
  • The widgets supports being affixed or stuck on the page so it is always visible as you scroll down the page. NOTE: this is an advanced option since every theme is different, you might need support from your theme developer to learn what the correct item selector to use in the settings to enable this feature.
  • The widget auto highlights the sections currently visible on the page. The highlight color is configurable.
  • Developer friendly with many action hooks and filters available. More can be added by request on Github. Pull requests are welcomed.

Result and Preview table of content

Plugin Setting

go to settings -> table of contents

you can customize it too.

User Rating on Easy Table of Contents

there are good rating on this plugin with a lot of installation of people.