Skip to content

Remove [...] square brackets from cloze deletions #178

@badlydrawnrob

Description

@badlydrawnrob

This might be one of the rare occasions that javascript could be permitted (optionally) in Anki Flashcards ...
It looks more aesthetically pleasing to have helper.moveDown() rather than helper.[moveDown]()

Image

 

There's a hack to make this happen for a single cloze, but often we'll have multiple cloze tags in the one card. It might be possible with CSS using :first-letter or ::after but again, pretty hacky.

I'm not a javascript guy so could use a little help. I'm assuming something like:

const clozes = document.getElementsByClassName("cloze");

clozes.forEach(function(element) {
  // GET RID OF THE SQUARE BRACKETS SOMEHOW
}

There's substring(1, element.length -1) or slice(1,-1) or using regex (my preference would be slice()) for ease. This feels like it should work but does nothing:

clozes.forEach(function(element) {
  element.innerText = element.slice(1,-1);
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions