From 01659dbe1cc730a6c1de9811e7632ad95f1065b3 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 18 Mar 2025 07:17:25 -0500 Subject: [PATCH 1/2] Run `nix flake update` --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index df8554e..0b7c20b 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724395761, - "narHash": "sha256-zRkDV/nbrnp3Y8oCADf5ETl1sDrdmAW6/bBVJ8EbIdQ=", + "lastModified": 1742206328, + "narHash": "sha256-q+AQ///oMnyyFzzF4H9ShSRENt3Zsx37jTiRkLkXXE0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ae815cee91b417be55d43781eb4b73ae1ecc396c", + "rev": "096478927c360bc18ea80c8274f013709cf7bdcd", "type": "github" }, "original": { From a5bb17067b3b78430493f9e53757eee2a802563e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 18 Mar 2025 07:23:00 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bef0e7b..264b535 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,10 @@ add-on config page in Anki. ## Implementation Details -This add-on is implemented as a monkey patch replacing -`Collection.compare_answer` (Anki 2.1.56+) or `Reviewer.correct` (up to Anki -2.1.54), which are responsible for generating the differences. Since it replaces -these functions, it is not guaranteed to work in future updates. I have tested -it in Anki 2.1.40 through Anki 24.06.3. +For Anki 25.03+, this add-on is implemented using the +`reviewer_will_compare_answer` and `reviewer_will_render_compared_answer` hooks. +In older versions of Anki, it is implemented using monkey patching instead since +these hooks were not implemented yet. The diffs between "given" and "correct" answer choices are rendered using a modified version of the [Longest Common Subsequence][LCS], with a preference for @@ -96,6 +95,10 @@ next closest, and so on until there are no more pairs. ## Changelog +2025-03-18: + +* Use newly-created hooks to avoid monkey patching for Anki 25.03+. (@chel-ou) + 2024-10-05: * Fix add-on to work with latest beta version of Anki.