TOC should render statically analyzable embedded expressions in headings (esp. imported partials) #9772
Open
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
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
- Create a partial file that uses a prop in a heading
- Import that file
- Use the partial
Expected behavior
The ToC shows the value passed to the partial
Actual behavior
The ToC shows {props.propname}
Your environment
No response
Self-service
- I'd be willing to fix this bug myself.