-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown shortcode content is not included in Table of Contents (TOC) #10866
Comments
@JeppeKlitgaard There are some scenarios where it not possible for the You have two options: |
@jmooring Thank you for your quick and informative reply! I will leave this open for now, as I still think this could be considered either a bug or alternatively be turned into an enhancement proposal, albeit the technical details of that are beyond my knowledge of Hugo. I will have a go at implementing your first suggestion on my site. Thank you! |
To be clear,
If you're saying that the above isn't true, that's a bug. What I suspect, though, is that what gets included in I agree that there are situations where it would be useful to calculate the |
Thank you for getting back to me!
A sample of a markdown file I am including using the ## Background
As part of my undergraduate studies I recently had to write a formal report on the exciting
topic of mechanical resonance after having collected data from the transient and
steady state responses of a oscillating torsional pendulum.
... These aren't pre-rendered into HTML or wrapped in any HTML elements. With a number of other headings further down the document, but these are not included in the ToC. From the other discussions I have linked, I believe other people are having a similar issue. |
OK, I see it now: See the passing test case at https://github.com/gohugoio/hugo/pull/10867/files
|
Changing to Feel free to close this and thank you again |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
I am still running into the issue described in #6690, which was closed due to doubts whether it was a bug or bad configuration. I believe it is a bug, as I can reproduce the issue described there, and so could the lowRISC team in lowRISC/opentitan#3313.
The way I am reading the documentation, a markdown shortcode (
{{% md-shortcode %}}
) should be fully rendered and therefore be a part of the generated table of contents – https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdownAlternatively I believe this could be read as the included markdown being rendered as HTML and therefore would be present as HTML in the TOC heading lists, etc, but any headings included would not be considered for the TOC. If this is the case, this should perhaps be a proposal instead of a bug report.
I think there is a bit of well-meaning misdirection going on in the forum when searching for similar issues: https://discourse.gohugo.io/t/no-table-of-contents-from-partial-calling-separate-markdown-files/38967. I don't believe the proposed solution works.
I can't get this to work, however, nor could @jcyrss. See also: https://discourse.gohugo.io/t/sections-wrapped-in-a-shortcode-do-not-appear-in-the-toc/21304/11
My shortcode includes another markdown file and looks like:
But the included headings are not included in the TOC.
I am keen to elaborate on any points that aren't clear. The issue should be easy to reproduce on any Hugo installation:
includer.html
)include_me.md
{{% includer "include_me.md" %}}
The text was updated successfully, but these errors were encountered: