-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Do you know of a way to exclude/include content in the PDF? As an example, 1.2. Keyboard Shortcuts should not be shown in the PDF. Similarly, the "In this segment" texts (as seen in 12. Pattern Matching) should also go away.
I got another ask for adding this to mdbook-pandoc
(max-heller/mdbook-pandoc#206) so I wanted to revisit and clarify the desired outcome.
-
For excluding portions of chapters such as the "In this segment" snippets, the most straightforward approach would likely be to add a class like
mdbook-pandoc::skip
to a div/header/etc. It looks like the snippets are generated from{{%segment outline}}
placeholders bymdbook-course
; which of the following options makes the most sense?- Disable
mdbook-course
when building withmdbook-pandoc
and use a Pandoc filter to strip{{%segment outline}}
placeholders from the source (this seems best to me) - Wrap
{{%segment outline}}
placeholders in the book with<div class="mdbook-pandoc::skip">
(this is verbose and easy to forget) - Have
mdbook-course
tag snippets withmdbook-pandoc::skip
(this feels wrong)
- Disable
-
If 1.2. Keyboard Shortcuts is excluded from the PDF, should 1.3. Translations remain numbered as 1.3 (i.e., leave a gap between 1.1 and 1.3) or be shifted up to 1.2. Translations? My intuition says that having chapter numbers match between the PDF and HTML forms is important, but gaps in numbering would also be confusing and I'm not sure if Pandoc even has a way to leave such a gap.
How would you prefer to specify which chapters should be excluded?
- List chapters to exclude in
book.toml
- Tag the chapter heading with
mdbook-pandoc::skip
(simple but requires source annotation)
- List chapters to exclude in