Skip to content

v1.2.1 — Karaoke highlighting accuracy

Choose a tag to compare

@dta121 dta121 released this 30 May 01:32
· 13 commits to main since this release

A focused fix release for the karaoke-style in-place highlighting. A
number of sentences were narrated but never lit up on the page. The
highlighter matched each Whisper segment as a single contiguous run inside
one element and wrapped it with range.surroundContents(), which silently
dropped three classes of segment.

Fixed

  • Segments that begin with text not in the page body. The narration
    prepends the page title, and Whisper glues it onto the first body sentence;
    the title is rendered as the page heading (excluded chrome), so the combined
    text was never found — e.g. "Read this article and consider the following
    questions"
    stayed unhighlighted. A suffix fallback now drops leading
    words and matches the longest remaining run.
  • Segments that span an element boundary (a heading into a paragraph, one
    list item into the next, an inline <em>). These were found but
    surroundContents threw on the cross-element range and dropped them — the
    bulk of the misses. Matched runs are now wrapped as one <mark> per text
    node
    , all sharing the segment index and highlighting together.
  • Sentences that appear verbatim more than once (a body line restated in
    the summary). The search always resolved to the first copy, so the
    restatement never highlighted and the body copy was re-marked. A forward
    search cursor
    now resolves each segment to the correct occurrence.

Together these lift in-place highlight coverage substantially on
mixed-structure pages (headings, lists, summaries, callouts).

Notes

  • JavaScript-only change; version.php -> 1.2.1 rolls the JS revision so
    browsers fetch the rebuilt bundle. Empty upgrade savepoint, no schema change.
  • CI-verified green on Moodle 4.5 / 5.0 / 5.1 / 5.2 x PHP 8.1-8.4 x
    PostgreSQL / MariaDB.

Full changelog

See CHANGELOG.md. Compare: v1.2.0...v1.2.1