Tested it and working very well.
Keep with the great work!
UPDATE: v2.7.0 just released! This is an āautomation updateā for the script:
- There is now an option to have the script recursively scan subfolders
- If you supply the path to the Anki executable and the name of your profile, the script can automatically open Anki when run (if Anki isnāt running already)
UPDATE: v2.8.0 just released! This update adds more syntax for working with cloze notes, via CurlyCloze. Ankiās cloze syntax is now also supported when using CurlyCloze.
@Aonto The new url scheme in 0.9.0 will make this super easy, since I just need the file name, so Iāll wait until that goes public before adding the feature.
Thanks man
Edit:
That is why I want to use URL link to combine anki with obsidian:
UPDATE: v2.9.0 just released. v2.9 is focusing on adding some Obsidian integration. Currently, only a link to the file that generated the flashcard, but more features will likely come once the official plugin API is out. Iām likely to pause the development of the script until then.
@Aonto This should hopefully suit your needs! Itāll definitely make editing the cards easier if you have a link to the file that generated them.
It must be a strong tool for me to remember my notes and my ideas, thanks!
I want to thank @Pseudonium, @ryanjamurphy, @Klaas, and others for the terrific script. It has been useful already, but Iām wondering whether it might be possible to extend it such that it is useful for Zettelkasten.
For those of us who use Obsidian as a Zettelkasten system, one challenge we face as our list of āzettelā notes grows is how to review them over the course of weeks, months, and years. Anki seems like one way to accomplish that. By exporting the zettel notes, which can be one idea, an index of ideas, or MOCs per file, to Anki, Anki can be used for review, reminder, and serendipityāseeing connections between old notes and new.
My Obsidian vault contains over a thousand Research Notes and Literature Notes, and each note type is formatted just a little differently with Markdown on the basis of its purpose and how old it is (2-year old notes donāt look like Julyās notes, unforunately). The differences among the notes make it challenging to use the Obsidian to Anki script and its standard regex expressions. Iāve found a workaround to this problem that is 80% effective by cloning the vault and processing the cloned .md files through BBedit and various regex āsearch and replaceā actions. That process is labor-intensive and doesnāt resolve the 20% of odd cases in my vault.
So, my question: Can either the script be modified or a new regex be developed that strips line 1 of every file as the front of an Anki card and then strips every subsequent line, to the end of the file, for the back of the card regardless of what markdown characters appear on lines 2ā>EOF (e.g., #, ##, ā, *, \n, \n\n\n, etc.)? I have tried to develop a regex to accomplish this myself by modifying the Header Paragraph Style regex, but I havenāt had much luck, perhaps because the original script is intended to pull multiple Anki notes from a single file rather than one Anki note from one file.
Any thoughts on either the use case I imagine here or how it might be accomplished are welcome.
Grateful again for the work that has gone into the script since August.
@FrumpyMonk Sorry for the late reply, Iāve been pretty busy with university, so I havenāt had much time to work on the script! Your use case is interesting. I think this regex could work - ^(.+)\n([\s\S]+)
. That should make the first field the first line of the note, and the second field the rest of the file. Of course, if you already have formatted cards within the file, the matches would āoverlapā with this match, and so the script will not add this as a card. But for a new file, or one with no formatted cards, this should hopefully work fine.
I really like this script! But Iāve noticed that the clozed note feature hasnāt been working on my end.
I input it like this;
{C1::clozed}
I would really appreciate your input on whether Iāve made a mistake?
@Terry53 Sorry for the super late reply, Iāve been busy with uni! Hmm, I think itās just the use of the capital C, and the double colon. See if this works: {c1:clozed}
.
Not sure where the best place to post this would be, but I wanted a kind of survey from users of Obsidian_to_Anki.
Initially, I used the START END syntax to denote blocks of the text marked as flashcards - it was the first thing I could think of! And at that time I wasnāt too familiar with regular expressions.
Now though, the use of custom syntax via regular expressions makes my notes look clean - in fact, apart from testing, Iāve never actually used the standard START END syntax of the script in my own notes!
The START END syntax does also contribute to some confusion for new users I think - the fact that you have to specify the note type straight after, huge sections of the config file reserved just for āfield substitutionsā and ānote substitutionsā etc.
Iām hesitant to remove this functionality from the script, since I know some people do prefer it - though I might be able to whip up some sort of regex converter that converts a START END block into something like a question-answer block. I do feel like I could simplify both the actual code and the config file this way though.
However, seeing as the plugin API has now come out, I do feel like it might be worth having the script be purely custom-regex based as a plugin (Iām thinking I might have to rewrite it in Typescript or somethingā¦). What do people think of this? I donāt think I can carry over that huge config file into a āsettingsā part of the plugin! Though I could still just have a button for āopen config fileā on the settings.
tl;dr - Iām thinking of removing the START END functionality (and STARTI ENDI for inline notes) when I (eventually) make the script into a plugin, and possibly also remove it from the core python script itself (which will always be available, plugin or not). What do people think of this?
EDIT: Thank you @osgav, I figured out how to make a poll!
- Keep START END syntax in both script and eventual plugin
- Remove START END syntax from plugin, but keep it in the script
- Remove START END syntax completely
0 voters
Hello,
Really awesome script!
I was wondering if it would be possible to change my cloze REGEX to recognize a character other than { }. Specifically, I was hoping to change it to ## ##. I examined the REGEX provided for the config file but I honestly got a little lost with it.
If anyone has any thoughts on how to do this I would love to hear them!
First of all, thanks for the script.
I am using your script for a few weeks now, and I havenāt used the START END part in any of my notes, because it just doesnāt go well with the notes while reading.
I have modified the regex you had provided and created different card types for different use I may see.
e.g using your # styled notes, I made a small change (I dont know regex at all) and made it look for āDef:ā in the next line for definition type notes. Similarly I make it look for āMeaning:ā for word-meaning type notes.
I can have word meanings anywhere, I just have to write:
### Word
Meaning: Something I don't know
It makes my notes look good and at the same time pushes it to ANKI in a particuler card type that can be customized as per the need of the content type.
Though, I am struggling with cloze type notes. The script sends in the whole page into ANKI which is a huge blow for me. As I have raised an issue (rather a request) on Github too, I wanted to know if its a possibility that we can have some for of a break indicater. Like maybe two linebreaks to move the clozes in two paragraphs into two separate notes. It would make life easier. By a lot!
Thanks again
Hey, love the script! Iām studying for exams in my first semester of grad school and I couldnāt have discovered it at a better time.
I anticipate Iāll be frequently embedding images and I noticed that right now, obsidianās syntax of ![[attachment name]] doesnāt work. I glanced at Trello and was psyched to see that you have a medium term task to āAdd support for Obsidian style image embeds (need plugin API to do this)ā and that the API plugin has come out. Iām fine just pasting attachment file paths with regular Markdown syntax - ![figure name](file path) - but I was wondering if and when you plan on releasing that feature and if there is some kind of workaround that would make obsidianās file embedding syntax work?
Hi maybe you could temporary change in general Obsidian options how the images are pasted? (Uncheck āUse wikilinksā in the āFiles and Linksā settingsā)
Guys how do you deal with content structure that repeats and the missing context?
Let me explain better. I guess that there are pretty much two approaches when a similar structure is used across multiple notes.
Easiness of writing and reading
For example my approach when writing stuff and studying, Iāve found out that follows a repetitive structure. Something like:
# Title
## Assumption/Context #flashcard
Random text...
### Problem #flashcard
Random text...
#### Solutions #flashcard
Random text...
##### Solution 1 #flashcard
Random text...
###### Pros vs Cons #flashcard
Random text...
##### Solution 2 #flashcard
Random text...
This approach is amazing when writing. But there are two problems:
- the first is that if multiple files follows the same structure, then multiple cards will have the same question, and thatās a duplicate
- the second is that when reviewing you do not have a lot of context about it
Easiness for reviewing
# Title (with a thorough description)
Random text...
## Assumption/Context (with a thorough description) #flashcard
Random text...
### Problem (with a thorough description) #flashcard
Random text...
#### Solutions (with a thorough description) #flashcard
Random text...
##### Solution 1 (with a thorough description) #flashcard
Random text...
###### Pros vs Cons (with a thorough description) #flashcard
Random text...
##### Solution 2 (with a thorough description) #flashcard
Random text...
This approach works, but it does not help the writing. And a lot of us are here for this reason.
I guess, an optimal solution to the problem, would be to have both of the solution when generating a flashcard. And the idea, is to have the style of first way but providing even context when generating flashcards. Letās suppose I want to generate the flashcard about ### Solution 2, then the generated flashcard would be something like:
Q: Title > Assumption/Context > Problem > Solutions > Solution 2
A: Random textā¦ (that should be the answer to solution 2)
This pretty much it means that there should be a hierarchy. And of course, this can be applied to lists (ul, ol) too.
I generally use cloze deletetions for such cases. I simply put the contents inside the curly braces. it works well.
Even if there are multiple lines of solution:
# Title
## Pros and Cons
* {1| Some text}
* {2| other text}
Something like thatā¦
Thatās a good idea and I had high hopes when I tried it out, but I still got the error āNo such file or directory.ā Thanks for the suggestion!
Thatās a good idea and I had high hopes when I tried it out, but I still got the error āNo such file or directory.ā
How does the markdown link pasted by Obsidian differ from the one pasted by you by hand?