'Add Notes…' dialogue: replace selected text with (e.g.) all underscores?

These hints are redundant. Remove them with “Find & Replace” (Treat input as regular expression):

image

Find: \{\{c(\d+)::([^{]+)::.[^{]*}}
Replace: {{c$1::$2}}

Then, add this script to your front template:

<script>
  setTimeout(() => {
    /**
    * Anki script: Replace clozes with blanks
    * For this to work, append <div id="clozeText" hidden>{{Text}}</div>
    * to your front template.
    * 
    * @author Matthias Metelka | @kleinerpirat
    */
    const cardIdx = parseInt(document.body.className.match(/card(\d+)/)[1]);
    const clozeWords = Array.from(
      document
        .getElementById("clozeText")
        .innerText.matchAll(new RegExp(`\{\{c${cardIdx}::([^{]+)}}`, "g")),
      (match) => match[1]
    );
    [...document.getElementsByClassName("cloze")].forEach((cloze, i) => {
      cloze.innerHTML = `${clozeWords[i].replace(/[^\s]/g, "_")}`;
    });
  });
</script>

If you also want to use actual hints sometimes, ask me and I’ll update the script to support that.

2 Likes