Anki Forums

How insert code snippets in cards nicely formatted?

Good day!

As many developers I study development using Anki.
But how could I insert code snippets?

Copy-paste insert unformatted code.
So I want this

I get this in card (usually on 1 line, no formatted):
let greeting = “say Hi”;
if (true) {
let greeting = “say Hello instead”;
console.log(greeting);//“say Hello instead”
}
console.log(greeting);//“say Hi”

or like this:
let greeting = “say Hi”; if (true) { let greeting = “say Hello instead”; console.log(greeting);//“say Hello instead” } console.log(greeting);//“say Hi”

Could u please clarify how could I insert code snippets in cards?

Yes I saw in menu “change HTML” but it opens small window, I copy code inside this window and get it in card - like this:
let greeting = “say Hi”; if (true) { let greeting = “say Hello instead”; console.log(greeting);//“say Hello instead” } console.log(greeting);//"say Hi"

Please. Im going crazy about it. I need to format code manually on each card, but what if i need more than 1000 pieces?
Please help

you can use this add-on

2 Likes

Thank u very much! U make my day! Im so happy!
:heart_eyes: :smiling_face_with_three_hearts: :star_struck: :kissing_heart:

You’re welcome :smiley: