Skip to content
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

question: anchored headings through included markdown file in ToC #988

Open
matebarabas opened this issue Jan 8, 2025 · 1 comment
Open
Labels
support Request for achieving a specific goal

Comments

@matebarabas
Copy link

Hi @McShelby, thank you for the amazing work on this theme; I really love it!

I'd like to ask for your help to achieve the following: through the include shortcode (e.g., {{% include file="includes/sample.md" %}}), I'd like to embed a markdown file into my main page (e.g., main.md). The sample.md file to be embedded has some chapter titles, using the standard ## markdown syntax. Once sample.md shows up in main.md parent page, the content renders smoothly as it should, however, the headings in sample.md are not showing up in the ToC of the parent page. Which configuration needs to be changed in order for these to show up in the ToC?

Bonus question: when such an include clause is inside of an expand section, the headings from the sample.md file even lose their anchors (i.e., when hovering over, the clickable "link" icon no longer shows). What needs to be configured in order for these to show?

Any help is much appreciated!

@McShelby
Copy link
Owner

McShelby commented Jan 8, 2025

For your nomal case, you can do {{% include file="shortcodes/include/INCLUDE_ME.md" %}} as written in the docs. Note to use % instead of <.

Currently, the headings are not picked up if you use include in an expand (or any other shortcode), partly due to limitations of Hugo.

Formating is a different issue. I'll change this.

@McShelby McShelby added the support Request for achieving a specific goal label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Request for achieving a specific goal
Projects
None yet
Development

No branches or pull requests

2 participants