Field sintax to override the type of case

Example: Let’s say I have the field “verb”. If a note has “paddle” in it, and another has “Row”, I would like to display the field with a consistent case, like “Paddle” and “Row”, or “paddle” and “row”, without having to edit every field.

The syntax could be something like {{verb:uppercase}}, {{verb:lowercase}}, {{verb:camelcase}} etc

Some use cases include:

  • A student that imports a deck but they have some reading disability and they understand upper case better
  • Desire to use upper case in a card type, and lower case in another one

You can achieve that with some JavaScript. E.g.

<div class="upper">{{verb}}</div>
<div class="lower">{{verb}}</div>

<script>
var uppers = document.getElementsByClassName("upper");
for(let el of uppers) {
	el.textContent = el.textContent[0].toUpperCase() + el.textContent.substring(1);
}
var lowers = document.getElementsByClassName("lower");
for(let el of lowers) {
	el.textContent = el.textContent[0].toLowerCase() + el.textContent.substring(1);
}
</script>
4 Likes

It can even be done with CSS:

.my-class {
  text-transform: capitalize;
}
5 Likes

Thanks! It works wonderfully

1 Like