crowbook icon indicating copy to clipboard operation
crowbook copied to clipboard

Table of Contents not being created

Open LinFed opened this issue 8 months ago • 3 comments

I’m using Crowbook 0.16.1 to generate a PDF from a single Markdown file with the following YAML header:


title: "Mein Buchtitel" author: "Max Mustermann" lang: de output.pdf: MeinBuchNeu.pdf

My chapters and sections are formatted like this:

Deutsche Tugenden - Eine SWOT-Analyse für Startups

Was können wir gut und was prägt uns?

Die Rolle der Präzision in der deutschen Kultur

…and so on, with each heading separated by a blank line and text below.

Command:

crowbook -s Neu.md --to pdf --set tex.class book rendering.inline_toc true rendering.num_depth 2

Result: The PDF is generated, the content and headings are there, but the Table of Contents (TOC) page is always empty (just the heading, no entries).

What I’ve tried: • Different combinations of YAML header vs. CLI options. • Both rendering.inline_toc: true in YAML and as --set. • Changing the order of the YAML header fields. • Using both -s and omitting it. • Removing or keeping all blank lines, comments, etc. • Ensuring headings are all properly formatted as #, ##, ###. • I have LaTeX (xelatex) working; PDF is generated without other errors.

Expected: A TOC page that lists all top-level and section headings (at least those marked with # and ##).

Actual: The TOC page is empty.

Questions: • Is this a bug, or am I missing a required YAML or CLI option? • Does Crowbook require a certain minimal structure (e.g., multiple files or explicit chapters) for TOC to work in single-file mode? • Has anyone gotten a single-file, YAML-header-based workflow to produce a working TOC in PDF recently? If yes, can you share your exact working example (Markdown and command)?

LinFed avatar May 31 '25 10:05 LinFed

Definitely a bug!

crowdagger avatar Jun 02 '25 17:06 crowdagger

Looking at it a bit more, maybe not really a bug but still not great. At the time I designed the --single option to be equivalent to including the file hiding the main titles (h1) so this is incompatible with creating a tableofcontents. This make sense for the usage I had but maybe is not great.

So maybe the fix would be to actually have two different options. I'm looking at it but currently you'll unfortunately have to create a .book file :(

crowdagger avatar Jun 02 '25 18:06 crowdagger

Hey, thanks for getting back to me on that issue, now I have some more experience and I worked around it and did create a .book and a template tex file and it worked in creating the table of contents. 👍

LinFed avatar Jun 02 '25 18:06 LinFed