brno
1
Hi. I’m trying to create a type of Anki note that displays the name of the deck at the top of the card, followed by the name of the subdeck below.
For example:
English
Subjects
and then the card information would come below.
I researched and found that I should use {{Deck}} and {{Subdeck}}, but it didn’t work as I expected. The result at the top of the card was:
English::Subjects
Subjects
I would like to know if it’s possible to remove the “::Subjects” from the deck name, and only display the name of the main deck. Is that possible?
jcznk
2
As far as I know, there is no built-in way to achieve that.
But maybe you could use some regex. For example:
<div id="deck_input" hidden>{{Deck}}</div>
<div id="deck_output"></div>
<script>
var original_name = document.getElementById("deck_input").innerHTML;
var shortened_name = original_name.replace(/::(.*?)$/, "");
document.getElementById("deck_output").innerHTML = shortened_name;
</script>
2 Likes
system
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.