I currently have a full ebook (=ebook) written in bookdown with a large table of content.
I am about to restrict the access to this ebook after registration on a website.
I would like to have an extract of this ebook (= extract book) accessible before registration though.
In this extract book, I would like to restrict the access to some chapters while keeping the entire TOC of the ebook on the left side.
Once the reader click on '5.2 Section 5.2' in the TOC, I would like him to see:
Chapter 5
"This chapter is only accessible after FREE registration".
I have searched a lot to make the title of specific sections invisible somehow (like setting the colour to white) but with no success. Anyone has a work around to suggest?
This is tricky but you can probably achieve this three ways:
Use knitr chunk as a way to do conditional insertion of child document with your content. For the free version, you would not insert the real child document, but the dummy one. You could then build a version of the ebook with a variable as parameters so that it will insert the right child. Example of this conditional insertion at 16.4 Child documents (*) | R Markdown Cookbook
This is to me the easiest way you can achieve that with bookdown
A post processing of the produced HTML in the ebook. Can be tricky to not break the ebook format.
A Lua filter for Pandoc so that you can replace all sections by some specific content. It could be tricky to build as you need to understand Pandoc's AST and how to write a filter using Lua. But it would definitely work as this will allow to identify some Nodes in the tree (your whole chapters to hide) and only keep the header, while replace content.