Remove Clozes — Cursor‑aware cloze remover

Remove Clozes — Cursor‑aware cloze remover

install via anki web

A small Anki editor enhancement that removes cloze formatting around the caret, correctly handling nested clozes and optional hints while preserving inline formatting and native undo support.

Features

  • Removes only the innermost cloze that contains the caret (or selection start).
  • Correctly skips over nested clozes to find the matching closing braces for the current cloze.
  • Treats the caret inside the opener {{cN:: as inside that cloze, not the parent.
  • Drops optional hint/comments (e.g., ::hint) at the current cloze level.
  • Preserves inline formatting inside the cloze’s main text.
  • Performs a single atomic edit using insertHTML so Ctrl+Z works as expected.

Usage

  • Place the caret anywhere inside the cloze to remove only that cloze; for nested clozes, the innermost one is removed first.
  • Default hotkey: Ctrl+Alt+Shift+R.
  • Works when the caret is placed on the opener token {{cN::, targeting that cloze instead of the parent.

Configuration

  • The default hotkey can be customized in config.json.
  • See config.md for the configuration key documentation.

Notes on behavior

  • Optional hints are recognized only at depth 1 of the currently targeted cloze, so {{c1::text::hint}} becomes text.
  • Nested clozes are preserved when removing an outer cloze that encloses them, and remain intact if the caret targets the outer cloze’s region.
  • The editor is notified of changes and native undo is supported via a single insertHTML operation.

Appropriate Legal Notices (Attribution)

Based on the Anki add‑on Cloze Overlapper by Glutanimate. Click here to support Glutanimate’s work.

License

This project is licensed under the GNU Affero General Public License v3, with Additional Terms under Section 7 as included in LICENSE.txt; when conveying this work, include the full license text and preserve all notices.
If you modify and convey this project, mark your changes with a prominent “modified by + date” notice in the modified source files and keep all legal notices and attributions intact.

Changelog

  • 2025‑11‑02: Implemented cursor‑aware, nested‑safe cloze removal with native undo; opener‑caret targets the correct cloze.

Acknowledgments

Original work and licensing by Glutanimate (see header in web/editor.js) and LICENSE.txt for AGPLv3 + Additional Terms.