Closed jmorel closed 1 year ago
Hi,
The initial intent was to be able to have private sections within pages. I didn't think of making entire pages private, it would definitely be a nice addition.
I'll look into it and come back to you.
On Wed, Aug 9, 2023, 14:01 Jérémy Morel @.***> wrote:
Hello,
I'm trying to have some pages that are entirely private: they wouldn't be built at all if the remove option is set to true.
I tried the following:
Summary
With remove set to false, the resulting index.html contains the link to private-content.html but private-content.html is not built at all.
Is there another way of creating private pages ?
— Reply to this email directly, view it on GitHub https://github.com/RealAtix/mdbook-private/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7X5U3C6FKHOIJ2JUHMCVLXUN32TANCNFSM6AAAAAA3J4PEEM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I've conducted some investigations and discovered that the issue lies in the fact that SUMMARY.md isn't available during preprocessing.
Currently, the code cannot get any information regarding SUMMARY.md. The mdbook library provides access to the chapters, and I scan through these chapters specifically searching for private tags.
# Summary
[Introduction](./introduction.md)
- [Public content](./public-content.md)
<!--private
- [Private content](./private-content.md)
-->
- [Other public content](./other-public-content.md)
When you utilize the private comment format as shown above, the content enclosed within is treated as a markdown comment. As a result, it isn't forwarded as a chapter in the book to the preprocessors.
I'm currently exploring a possible solution, which involves defining private chapters via book.toml. I think it might be a bit too error prone as renaming any chapter in will need to be propagated to book.toml
private chapters configuration, or the chapter will become public.
Thank you for the investigation!
I'm currently exploring a possible solution, which involves defining private chapters via book.toml. I think it might be a bit too error prone as renaming any chapter in will need to be propagated to book.toml private chapters configuration, or the chapter will become public.
To avoid having to declare chapters in book.toml, what do you think of defining a private prefix in book.toml and then consider all pages whose filename start with this prefix as private ? Something like ./_private_my-private-content.md
.
Hi, sorry for the delay I was on vacation.
I implemented your suggestion, there's a few items left: configurable prefix, some tests to be written and documentation in the README.
PR coming soon.
Fantastic, thanks a lot !
Hello,
I'm trying to have some pages that are entirely private: they wouldn't be built at all if the
remove
option is set to true.I tried the following:
With
remove
set to false, the resultingindex.html
contains the link toprivate-content.html
butprivate-content.html
is not built at all.Is there another way of creating private pages ?