Skip to content
Discussion options

You must be logged in to vote

Swizzling the TOC is forbidden.

I don't think it is forbidden. It should be flagged as "unsafe", which only means that we might need to do component breaking changes. But this is perfectly mine to swizzle, just be aware of the maintenance cost when you do so.

Using a React tag, I can hide content in the page, but headers still appear in the TOC.

This is because the TOC is extracted statically at build time through a remark plugin. We can't know what <AdminText> will do at runtime, so we have to keep the items in the TOC.

Note that hiding things this way is not ideal because even though the admin content is visually hidden, it still is included in your non-admin site in bundles and jso…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by schlameel
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