The inner content of these can be either Markdown or pure HTML (look at the docs). Combine it with the highlight template func and you should have a solid foundation:
Something in the back of my mind makes me think that the mmark backend has
support for transclusion already - i’m not at my computer atm, so i can’t
confirm it though
As the following screenshot shows, headings in included md are missed, while I did use shortcode like {{% include "share/requests.md" %}} in the file content\tut\03.md
In Hugo 0.55 we changed how the % delimiter works. Shortcodes using the % as the outer-most delimiter will now be fully rendered when sent to the content renderer (e.g. Blackfriday for Markdown), meaning they can be part of the generated table of contents, footnotes, etc.
The above description only applies to those shortcodes with included content directly in related html file.
But for those like having readFile command, the file content to be read is not fully rendered before sent to the markdown processor ( goldmark in my case).
So I have to write a pre-process script in Python to replace include direction with real file content.
Really hope Hugo guys could solve it in better way.
Thank you for this discussion – it taught me how to include files without having to pull their content using python first! However, the headings still don’t show up in the TOC – how can they be made to show up? I am including ~30-40 files and the TOC really is required here. You seem to have come across this problem – maybe you’ve found a solution?