The Insert Field help shows deck and note type names as HTML
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
The bug is in the description builders SpecialFields.Deck.buildDescription and SpecialFields.NoteType.buildDescription, which the proposed tests in AnkiDroid/src/test/java/com/ichi2/anki/dialogs/InsertFieldDialogTest.kt call directly. Start by reading where the deck and note type names are placed into the description string and check whether they are passed through HTML parsing. Run InsertFieldDialogTest; done means both new tests pass and the names appear as literal text, such as & and tags, rather than as rendered HTML.
Written by the indexing model from the issue text.
Description
Assisted-by: Claude Opus 5.5
[EXISTING] The Insert Field help shows deck and note type names as HTML
Subject: [EXISTING] The Insert Field help shows deck and note type names as HTML
The special field help parses deck, note type and card type names as HTML, so deck "Math & Science" reads as "Math & Science".
⚠️ This issue existed before the PR and should likely be split off into a separate issue.
---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/InsertFieldDialogTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/InsertFieldDialogTest.kt
index eef650669b..b0ba179ba2 100644
--- a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/InsertFieldDialogTest.kt
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/InsertFieldDialogTest.kt
@@ -223,6 +223,24 @@ class InsertFieldDialogTest : RobolectricTest() {
)
}
+ @Test
+ fun `{{Deck}} description keeps HTML entities in the deck name`() {
+ val metadata = metadata.copy(deck = "Math & Science")
+ assertThat(
+ SpecialFields.Deck.buildDescription(metadata),
+ equalTo("The full deck of the card, including parent decks: ‘Math & Science’"),
+ )
+ }
+
+ @Test
+ fun `{{Type}} description keeps tags in the note type name`() {
+ val metadata = metadata.copy(noteTypeName = "<b>x</b> y")
+ assertThat(
+ SpecialFields.NoteType.buildDescription(metadata),
+ equalTo("The name of the note type: ‘<b>x</b> y’"),
+ )
+ }
+
@Test
fun `{{Subdeck}} description if not set`() {
val metadata = metadata.copy(deck = null)
Found while handling https://github.com/ankidroid/Anki-Android/pull/23697#pullrequestreview-6058429231
- Dominant language
- Kotlin
- Stars
- 12.3k
- Forks
- 3.1k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 320
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ankidroid/Anki-Android
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
ankidroid/Anki-Android#23798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ankidroid/Anki-Android#23797 ·
Maintainers usually reply within 1 day
-
code-scan
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23786 ·
Maintainers usually reply within 1 day
-
code-scan
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ankidroid/Anki-Android#23756 ·
Maintainers usually reply within 1 day
-
code-scan Needs Triage
Difficulty 2/5 Half a day Newbie friendliness 65/100
ankidroid/Anki-Android#23686 ·
Maintainers usually reply within 1 day
All issues in ankidroid/Anki-Android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sorsama/deepseek-harness-mobile#154 ·
Maintainers usually reply within 1 day
-
0. Needs triage enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Feature] 3D and AR on phones (Filament, ARCore, SceneView): current APIs instead of 2022-era codeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 4 days
-
unshaved-yak
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
accessibility agent-ready area:android bug fleet
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
level-98/mailcrane#412 · 1 comment ·
Maintainers usually reply within 1 day