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
TOC should render statically analyzable embedded expressions in headings (esp. imported partials) #9772
Comments
I don't think it's possible to solve in a generic way without us rendering the whole page, but we might be able to solve a few specific and statically analyzable cases. Maybe if the heading contains expressions, we should export the TOC like |
👍 That's also the idea I had in mind to support React components usage in TOC: We should rather pass the props to all MDX and all React components Wondering if the "root" (non partial) MDX doc should still export a One interesting thing with a function is that maybe it opens the door to "dynamic TOCs" where TOC items can be different if headings are in tabs for example? 🤔 |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
If a prop is passed to a partial Markdown file, then the ToC displays
{props.propname}
, instead of the actual value.As @slorber pointed out in #9684, this is a known limitaion that stems from that even in non-partial files headings don't support expressions.
While having expressions in non-partial headings is a feature, that would be nice for completeness, it's probably not too practical. On the other hand, having expressions in headings of partials can be very useful.
Reproducible demo
No response
Steps to reproduce
Expected behavior
The ToC shows the value passed to the partial
Actual behavior
The ToC shows
{props.propname}
Your environment
No response
Self-service
The text was updated successfully, but these errors were encountered: