Skip to content

Can the document TOC render HTML? #10158

Answered by slorber
Zenahr asked this question in Q&A
Discussion options

You must be logged in to vote

The TOC headings are historically converted as strings

It is possible in the future that we'll support JSX in TOC better in the future, as explained in this PR comment: #9773 (review)


However, I believe what you want to achieve is somehow possible already with some limitations, considering we use dangerouslySetInnerHTML from React you could use simple HTML tags in headings

An example is the RN website.

https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis-android

### `getRecommendedTimeoutMillis()` <div class="label android">Android</div>

It's open source so you can try to copy their html/CSS and adjust this to your needs

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Zenahr
Comment options

Answer selected by Zenahr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants