You can handle this on your application:
- Your code parses the page content
- We generate the items of the table of content with an id for each element
- the HTML serializer assigns an id to the DOM for any element matching an id of the table of content
Here is an example of a Scala.
If you implemented something similar in your app, feel free to share it on our #developers channel of the Prismic Slack.