Add summary: to character templates; fix two bugs that were hiding it

Add a summary: field (with a short explanatory comment) to
01_character_template.md, and fill the field in on the two shipped
examples, 01_protagonist.md and 02_antagonist.md. Documented in the
Story Bible README's "Adding a New Character" example and its new
"Automatic Linking in the Draft" section, and in the main README's
Story Bible docs.

While wiring this up against the real bundled template rather than a
hand-written test fixture, found two bugs that were silently defeating
last session's auto-linking feature for every project made from that
template:

- extract_from_frontmatter() only read a title: field for an item's
  name, but every bundled Story Bible template — character, location,
  lore, object, all of them — writes name:, never title:. Every real
  item's display name (and therefore everything matched against it in
  prose) was falling back to a garbled, uncapitalized filename guess
  instead. Now name: is read (title: still works too, for a sheet that
  uses that word instead).

- build_editor_job()'s fast path skipped straight to an unformatted
  run whenever there were no grammar/spelling issues and no active
  search — without checking whether there was a Story Bible reference
  to highlight. A name with no spelling issue of its own (which is
  most of them) never got its purple background, and with it no visible
  way to find the hover card that depends on it.

Both were invisible in the unit tests added last session because they
exercised find_references() directly against a hand-built index, never
through StoryBibleIndex::build() against real files, and the manual
smoke test happened to use a name ("Bixby") that the spell checker
flagged anyway — which incidentally kept the fast path from short-
circuiting. Added a disk-built-index test and a fast-path regression
test so both stay caught.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 11:32:56 -05:00
parent 0da52c3054
commit 229e2413c4
7 changed files with 134 additions and 18 deletions
+24 -12
View File
@@ -412,35 +412,47 @@ it shows:
The Story Bible window indexes all Story Bible items from your project's character,
location, lore, and other reference directories. It supports:
* Automatic indexing from directories like `03-Characters`, `02-Story Bible`,
`Characters`, `Locations`, `Lore`, etc.
* Two reference syntaxes in your draft text:
* Automatic indexing from the first directory found: `03-Story-Bible` (the
bundled template's own folder), then `03-Characters`, `02-Story Bible`,
`Characters`, `Locations`, `Lore`, and so on.
* **Automatic linking in the draft — no markup required.** A name spelled and
capitalized the same way as an item's `name:` or an `aliases:` entry is
matched wherever it appears in ordinary prose ("**Bixby** stood at the
door"). Two explicit syntaxes still work too, and win any overlap with an
automatic match:
- Wiki-style: `[[Character Name]]` or `[[John Doe]]`
- Mention-style: `@CharacterName` or `@John`
* **Purple background highlighting** of Story Bible references in the editor
* **Purple background highlighting** of every match — automatic or explicit —
in the editor. Hovering one shows a card with the item's name, type, and a
summary (see below), and a link to open its full entry; the card stays put
while you move the pointer onto it to click that link.
* Click items in the Story Bible window to see all references to them in the current file
* Click reference buttons to jump directly to that location in the editor
* Metadata extraction from YAML frontmatter (id, title, type, **aliases** fields) or from filenames
* Metadata extraction from YAML frontmatter (id, name, type, **aliases**,
**summary** fields) or from filenames
* Case-insensitive search and lookup
* **Aliases support**: References match item IDs, names, **and aliases** for flexible linking
Character sheets in the `Characters` folder are automatically indexed, and any
markdown file with YAML frontmatter containing `id:` and `title:` fields will be
included in the index. You can also add an `aliases:` field with alternative names
for a character or item:
markdown file with YAML frontmatter containing `id:` and `name:` fields will be
included in the index (`title:` is read too, if a sheet uses that word instead).
You can also add `aliases:` for alternative names, and `summary:` for the one-line
hover card:
```yaml
---
id: john_smith
title: "John Smith"
name: "John Smith"
type: character
aliases: ["Johnny", "JS"]
summary: "A retired locksmith dragged back for one last job."
---
```
With aliases defined, references like `[[Johnny]]` or `@JS` will match the "John Smith"
character entry. References in your draft text that match Story Bible items
by ID, name, or alias are highlighted and clickable.
With aliases defined, references like `[[Johnny]]`, `@JS`, or a bare "Johnny" in
prose will all match the "John Smith" character entry. Every reference in your
draft that matches a Story Bible item — by ID, name, or alias — is highlighted
and clickable, whether or not you typed any markup to get it there.
### Story Bible Editor (Edit ▸ Story Bible…)