panatgithub_AnkiHeadingSync/docs/qa-group-mapping-parser-decisions.md
Dusk 8357992ee3 feat(sync): refine QA mappings and cloze output
中文: 优化问答题多级列表字段映射与解析,移除填空题兼容性误判,并调整填空题正文分隔符和设置页展示。

English: Refine QA group field mapping and parser behavior, remove stale cloze compatibility assumptions, and update cloze body separator plus settings UI copy.
2026-04-26 16:55:31 +08:00

1.9 KiB

QA Group Mapping / Parser Decisions

Mapping Authority

  • Concrete saved slots remain the runtime sync authority.
  • Derivation metadata is settings-time metadata, not a runtime replacement for saved slots.

First-Pair Derivation

  • QA Group mappings now optionally persist:
    • titleField
    • derivation.mode = "first-pair"
    • derivation.firstQuestionField
    • derivation.firstAnswerField
  • When both selected first fields contain a numeric segment:
    • use the last numeric segment in each field name
    • require both fields to start at the same index
    • require the first selected pair to start at 1
    • preserve numeric width when generating later fields
    • stop at the first missing complete pair
  • When one or both selected first fields have no numeric segment:
    • keep exactly one configured pair
    • do not try to auto-extend further pairs

Refresh Behavior

  • If a saved QA Group mapping has derivation metadata, reading fields from Anki regenerates slots from the stored first pair.
  • If a saved QA Group mapping does not have derivation metadata, reading fields from Anki only refreshes loadedFieldNames and preserves the saved explicit slots.

Parser Behavior

  • QA Group answers now use the entire child block under each first-level item.
  • The parser dedents the child block before storing it as answer markdown.
  • If the child block is exactly one direct child list item, the parser unwraps that outer bullet so existing simple answers stay stable.
  • If the child block contains multiple child bullets, paragraphs, nested lists, or fences, the parser keeps the markdown structure.

Cloze Cleanup

  • Removed NoteModelDetails.isCloze because sync no longer depends on Cloze-compatibility metadata.
  • Kept CreateAnkiModelInput.isCloze because model creation still needs the AnkiConnect createModel contract.
  • Removed the dead clozeIncompatible i18n message because no code path still emits it.