Replies: 2 comments 1 reply
-
|
EDIT: |
Beta Was this translation helpful? Give feedback.
-
|
I don't really understand what problems you encounter, but you can implement conditional rendering of content with remark, and yes that affects the TOC. This means you can build the same site into multiple variants based on an env variable for example. Here's a POC where the same site is built for regular users and admins: #10250 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hii! I am working on a feature which adds an ability to conditionally render content. Initially I have gone the custom component route but it has failed. The hidden headings appear in the TOC component.
I have decided to write a custom Remark plugin. An example of my latest iteration of the feature
I am able to get the
valueattribute of thetype: 'code'node, which contains the actuall content to display. However, the tree I get after usingremark.parse()is not insert-able because of an error "Cause: Cannot handle unknown noderaw". Mdx components are transformed intotype: 'html'.Should I change my plans and do something else or it is possible to do
remark.parse(content, some_docusaurus_options)?Something similar to my request #9187 but in my case the people, who work on the document, want to edit only a single document and not many. And the generating environment is not really dynamic per se
Beta Was this translation helpful? Give feedback.
All reactions