quarto-index extension: one back-of-book index for PDF, HTML, EPUB and Typst
#15195
jmgirard
started this conversation in
Show and Tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Quarto has no built-in subject index. For PDF you can load
makeidxand write\index{}by hand. Those marks do nothing in HTML, and you have to add\printindexyourself. This has come up here several times: #3849, #5579, #8251, #10213 and #12249.quarto-indexis a filter extension for this. You mark a term once, in Markdown, and each output format gets its own index:\index{}entries throughimakeidx, with page numbers, listed in the table of contents.In other formats, such as Word and reveal.js, the marked text passes through unchanged.
Install it in your project:
Then turn on the filter:
Marks are spans, so the visible text stays as you wrote it:
It also handles see-also references, page ranges, sort keys, and marks in figure captions and image alt text. One document can hold several named indexes, for example a subject index and an index of names. The index heading and the see words follow your
lang:for Spanish, French, German and Italian. (Let me know if you need another language added.)A Quarto book gets one index for the whole book. Put this marker where the index belongs:
::: {.qi-index-here} :::In an HTML book the marker chapter must come last. Quarto renders each HTML chapter on its own, and the index collects the chapters before it. Run a full
quarto renderbefore you publish so that the index is current. PDF and EPUB books do not have this limit.It needs Quarto 1.5 or later. Continuous integration renders the example fixtures on Quarto 1.5.52 and on a current release, and compares the indexes they produce.
Docs: https://jmgirard.github.io/quarto-index/
Source: https://github.com/jmgirard/quarto-index
Bug reports and feature requests are welcome as issues on the repo.
All reactions