Skip to content

feat: parser - multiple correct answers, all tick variants and option prefix formats #26

Description

@ummaraali2

Problem

The parser has several edge cases where correct answers
are not detected and question options are not recognized,
causing "No correct answer marked" warnings on valid
questions.

Part 1 — Multiple correct answers via Answer line

Currently only single letter answers work via the Answer
line. Teachers with checkbox questions write:

Answer: A, C → fails ❌
Answer: A, B, D → fails ❌
Answer: 1, 3 → fails ❌
Answer: a and c → fails ❌
Answer: A,B,C → fails ❌

Expected behavior:

  • Detect comma-separated, space-separated or
    "and"-separated letters/numbers in the Answer line
  • Mark all of them as correct
  • Automatically switch question type to CHECKBOX when
    multiple answers are found

Also normalize these variants:

  • Answer: B, D, F
  • Answers: 2, 4
  • Key: a, c, e
  • Correct: A and C

Part 2 — Tick/checkmark variants

Currently only ✓ and ✔ are detected. Teachers copy
from different sources and use many variants:

Should work:
✓ (U+2713) ✅ already works
✔ (U+2714) ✅ already works
✅ white heavy check mark emoji ❌
☑ ballot box with check ❌
** double asterisk ❌
[correct] bracket notation ❌

Should NOT be treated as correct:
✗ — means wrong, not correct

Positioning edge cases:
b) Paris ✓ — tick at end ✅ works
b) ✓ Paris — tick at start ❌ fails
b) Paris✓ — no space before tick ❌ may fail
b) Paris ✓ (city) — tick in middle ❌ fails

Part 3 — Option prefix variations

Currently supported:
a) ✅ a. ✅ A) ✅ A. ✅ 1) ✅ 1. ✅

Should also support:
(a) — bracket prefix ❌
[a] — square bracket prefix ❌
a - — dash separator ❌
a: — colon separator ❌

Part 4 — Whitespace and casing edge cases

a)Paris — no space after ) ❌ may fail
ANSWER: B — uppercase may fail ❌
Answer : B — space before colon ❌

Fix location

parseQuestions() in index.html:

  • Answer line resolution section → Part 1
  • Tick detection regex → Part 2
  • Option prefix regex → Part 3
  • Whitespace trimming → Part 4

Related issues

  • fix: handle * bullet points in question body
  • fix: support multiline question text in parser

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions