This allows me to reuse text throughout my site - I use {{< snippet src="snippets/mytopic/index.md" >}} and the text appears as predicted.
But there’s no TableOfContents on the right - I assume because Hugo thinks there’s no content (just a shortcode) so the .TableOfContents variable is empty.
First, call your shortcode with the {{% foo %}} notation. This will force the shortcode contents to be rendered before we send the content to the markdown renderer (Goldmark).
{{% snippet src="/snippets/mytopic/index.md" %}}
Second, change your shortcode to get the .RawContent (the markdowwn) of the snippet page.