Passwordlist
Lists the passwords a Hyperbook uses, and where each one is used. It is meant for a teacher's overview page: one place that answers "which password opens that section again?".
::passwordlist
This directive prints passwords into the built page. Anyone who can open the page can read every password it lists.
Put it on a page you do not publish, or wrap it in a protect block with a password only you know:
:::protect{use="teachers"}
::passwordlist
:::
Attributes
| Attribute | Description | Default |
|---|---|---|
scope |
all, section (the section of the current page) or page (the current page) |
all |
type |
Which kinds of entry to show: registry, section, page, block. Comma-separated |
all |
source |
A query, in the same language as pagelist | - |
format |
table, ul, ol, or #snippet to render a snippet |
table |
orderBy |
Field and direction, e.g. key:asc |
key:asc |
limit |
Show at most this many | - |
groupBy |
Comma-separated grouping levels: section, top-section, page, or any entry field such as type, key, context, name, description, password, href, or file |
- |
collapsible |
Collapse groups for this many levels (collapsible = 1, collapsible="2" = two levels, collapsible="all" = every level) |
- |
showCount |
Add the number of entries to every group title | - |
columns |
Comma-separated columns: context, password, where, or description |
password,where,description |
A generated solutions page
Protected blocks get their context from their name attribute, the nearest
preceding task-snippet title, or the nearest level-two-or-deeper
heading. A hand-maintained solutions page can therefore use one directive:
::passwordlist{type="block" orderBy="navigation" groupBy="top-section,page" collapsible showCount columns="context,password"}
Grouping levels are applied from left to right (commas and / are accepted as
separators). section follows the complete
navigation hierarchy and therefore creates nested groups automatically; use
section,page (or the equivalent section/section/page) for sections,
subsections, and then their pages. top-section
is the short form that groups only by the outermost section. Grouping by a
field is useful for registry views, for example:
::passwordlist{groupBy="type,key" showCount}
Entries without a value are collected in an Other group. The page group
title links to the page when one exists. Grouping works with table and list
formats; snippets continue to receive the flat, filtered entry list.
For unusual page structures, provide the label explicitly:
:::protect{password="chapter-2-1" name="Exercise 1: Two approaches"}
...
:::
Scope
scope filters relative to the page the directive is on.
::passwordlist{scope="section"}
Lists only the passwords used inside the current section — useful on a
section's index.md.
::passwordlist{scope="page"}
Lists only what the current page itself uses.
Patterns
source takes the same query language as pagelist, so
you can select by path, name or description:
::passwordlist{source="href(/chapter-3.*)"}
::passwordlist{source="href(/exercises.*) AND NOT description(draft)"}
Types
Every password is reported where it is used, and once more for the registry
entry itself. Narrow that down with type:
::passwordlist{type="registry"}
::passwordlist{type="page,section"}
Snippets
With format="#name" the list is rendered through a
snippet, which receives passwords:
{{#each passwords}}
- **{{password}}** —
{{description}}
({{where}})
{{/each}}
Each entry has key, password, description, name, type, href,
file, line, inherited and where (a link to the page, or the file it
came from).
From the command line
hyperbook passwords prints the same information in your terminal, without
putting it in the built book. See passwords.