Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: I made Ankify that converts notes to Anki cards (krxiang.com)
180 points by kangruixiang on May 7, 2022 | hide | past | favorite | 62 comments
Backstory: I was in medical school and had to study a ton of materials in short period of time. I came across Anki but always had trouble with making cards. In my mind, making cards should be quick, seconds instead of minutes. My other problem is after making the cards, each card does not really relate to the other. When you study the individual card, your thought process is very random and not cohesive. I wanted to be able to still reference to my notes for big concepts and then use the cards to memorize the details but also for long term retention.

Ankify came out of that. At the time, I did not know any programming and paid someone to write a script in Python to convert the cards. Then, eventually I learned Python myself and expanded on the script. I also uploaded the markdown files online so I could view them anywhere (https://kangruixiang.github.io/wiki/).

I ran into a wall in making user interface for the program. It was difficult to make good looking cross platform user interface with Python. I gave up on making user interface for a year or two with end of med school and residency. After a while, I went back to see if anyone else had made anything similar. Despite many plugins/programs that makes it easy to make cards, none of them really focused on readability of the original notes. I decided to sit down and learn javascript to help with UI creation.

After about 3 years, everything finally came together after I learned Svelte, Tailwind, and Electron. I know Electron is not the most efficient program, but it's what works for me.

Also, it's also the feeling of being able to make whatever my mind can think of. It feels really refreshing and empowering. Even making the website for Ankify is a lot of fun. You have to think so much about the presentation, typography, logistics.




This looks great! I too have long been frustrated by the laborious process of making high-quality notes. I've approached the problem a bit differently, choosing to integrate with APIs and auto-generate notes from that structured information. I've found that when done carefully, this approach can solve especially well for the 'disconnected knowledge' problem.

I see your project uses import-from-csv to get cards into Anki -- you can make this significantly more user-friendly by utilizing the genanki Python package [0]. It spits out an apkg for you that you can just double-click on and import. The other side benefit is that you can keep a stable ID of the same cards over time, which means that if you want to eg update the structure or styling of already-exported notes, it is very easy to do so.

[0] https://github.com/kerrickstaley/genanki


I used to mess around with Anki many years ago while studying Japanese. The approach I took was to figure out the database structure, then write a bit of code to expand the information on cards. Just alter the database directly. Mostly for things like adding dictionary words to existing kanji decks. Looks like it would be a nice addition to genanki to be able to read/modify/save existing an existing apkg.


Yeah I evolve cards over time as well, it's interesting how even after 7 years of using SRS I still sometimes generate cards that end up being hard to review once I actually start using them. The way that I solve for the modify over time is to simply re-generate the whole set of cards -- on import, Anki will automatically update the older cards (if the generation time is greater than the last modified time within the Anki DB).


That's why I like my note taking first approach to making cards. If I just focus on making high quality notes, then the cards are automatically updated over time.


I've looked into Anki generating packages before. The problem I run into is that you have to specify the ID for the deck that might be different for different people. Especially if they want to import into existing deck. Then you'll have to figure out how to pull the deck information out of the database first and then import cards into it.

The current Ankify already adds ID for the cards so it'll update the contents on each conversion. The only problem is if you delete a card, you'll have to manually do that in Anki.


Thanks for sharing. I'm a big fan of Anki, but mostly I am using it for language learning these days.

Sometimes I branch into other uses. I was quite successful using Anki when studying for my amateur license exam.

I will consider using Ankify if I need to study from notes at some point in the future.

What I loved about your post is how you evolved with Ankify as you developed it, I think this is a great example for people starting on their own journeys of learning how to program, I always felt that having a project in mind from the beginning is the best way to keep moving forward, and your journey is a great example of that.

I am considering using Python for cross platform gui design. Could you expand on why you chose electron over other alternatives, for example Qt?

Also, could you share which resources you used to learn about gui development on Python?


Definitely, thank you. Ankify really was present in every step of me learning programming.

I think I just got caught at a bad time with Python. It was a few years ago, and Python was in the process of going from 2 to 3. Consequently, a lot of the things I tried ended up throwing error messages.

I tried few of Python's GUI makers but found that I end up having to learn so many new things that only apply to that one GUI program. Where as with Electron, I'm really using HTML/CSS/tailwind that I use every where else. I could essentially make Ankify web only and it would make minimal difference to the UI.

I was fond of PyAutoGUI. It seemed very intuitive for me at the time.


You could look into Python Eel. It's pretty useful to create a quick web based desktop GUI with Python. I'm currently working on a project with it that uses React for the GUI.


I also created a somewhat similar tool [1] for quickly making Anki cards when reading foreign language texts. It's not electron, but rather PyQt, so it conforms to your system theme if you are on Linux.

However, it comes with a number of downsides:

- Distributing the app is a pain and breaks every now and then when you add a dependency that may not behave correctly or require additional hacks with your packaging tool of choice (in my case, cx_freeze).

- The interface is without a doubt less customizable compared to using a Web-based framework. However, I like this because I believe the user should be able to decide what the app should look like based on their system Qt themes. I also simply don't enjoy front-end work too much.

[1] https://github.com/FreeLanguageTools/vocabsieve


Another thing that made me end up choosing Javascript is because I could define an user interface and then use it over and over.

For this project, I first defined how each component would look, then used the same UI for both the website and the app to have a coherent look: https://kangruixiang.github.io/snow-ui/


This is pretty neat, I've also encountered the same problem. Personally, I take my notes in emacs org-mode, and I've built up a workflow around anki-editor[0], some snippets and elisp.

[0] https://github.com/louietan/anki-editor


This is really cool as well! It's fun to see how different people have different solutions to the same problem.


Shameless plug: I made apy [0] that allows more or less the same functionality, and more, from the command line. Some things I like about apy that I never found from any alternative solutions:

* I communicate directly with the local Anki database - no need to keep Anki open and use any ankiconnect type plugin.

* I can sync the database before and after with "apy sync".

* I can easily add single cards from the command line. And I can add mulitple notes from a Markdown formatted file simultaneously.

* I can easily edit cards that I have marked to specifically change in some way (I find it useful to adjust cards).

[0]: https://github.com/lervag/apy


That's a really well written app. I'll look at it more. I briefly tried to work with the database but found it really confusing and would take a lot of time trying to work with


Thanks! I did spend some time to make it work well with Anki, and I do spend some time once in a while to keep it up to date with the changes to the Anki code. But once I got it working, I've never turned back.

One of the nice wins for me was that I could batch update ~200 geography notes that had some outdated numbers.


This is cool.

Is there a way in Ankify to export cards to any mobile apps?I always want to study Anki on mobile but in the mobile apps I know about, the experience of creating cards is too tedious.

It want to be able to create cards on desktop but usually study on mobile!

If you like building in Electron, you may like Ionic if you build a mobile app ;)

https://ionicframework.com/

I wish Anki mobile apps were just a nice simple view/study experience, with the create and edit features much better suited to desktop UI.


Check about AnkiDroid on Android or Anki app on Apple devices. The latter is a bit expensive but well worth the investment. The best part of Anki is that it has its own cloud service that works for free. With that you can have the exact workflow you described.


You can synchronize your Anki decks across devices by creating an account on https://ankiweb.net/


Yeah unfortunately this would only work on desktop. But you could make the cards on desktop and then sync to mobile.


Does anyone use/know of an alternative to Anki? Maybe I am just picky or I am simply not cut for SR systems but I find Anki clunky.


Yes ! Google Docs with 4 columns. - QnA - Score - Type - and ID

* 1 Question on one row, its Answer on the next row. I use text color same as background color to hide the answer (putting the cursor on the cell shows the answer text in the formula bar up top). I just open the sheet, keep hitting down key and review.

* score column is a range between 1 ( i remember this) and -1 (totally new question). I start with -1, once I get it right, then 0.9, then 0.5, then 0.1 then 1. Increment when I get it right, decrement if wrong. Being able to just sort questions by score is the most valuable part.

* Type is either "q" or "a" based on the type of the row. Useful to filter out question rows only.

* ID is for grouping question and answer rows. Q n A rows both get the same ID so I can sort and dont mix.

* One workbook per subject. One sheet per topic.

* Works on phone, desktop, work laptop, everywhere. Copy paste friendly. Super easy to share. Color coding helps, images are supported, search works, can export to PDF, never breaks, i can group related topics and questions, make cross references, focus is on the content not the tool.

I don't need Anki. Don't need anything else. Just putting it out there for frustrated souls.


Anki is very powerful, but indeed that makes it a bit complicated to start with.

However, once you get your note types created, which requires HTML notation, you mostly just have to create content. I mostly learned how to do that by downloading community decks and checking out how they did it, and combining the ideas myself.

I create all my cards using Libreoffice Calc and saving as a csv file, then importing to Anki. Each column of the csv has a corresponding field on the note type.

Sometimes I use Perl programs to generate huge csv files from source materials, automating most of the creation of decks, and I convinced my language tutor to give me example phrases in Excel format instead of Word to easily import on Anki.

I think one of the most used alternative to Anki is Mnemosine, you can check it out, maybe it fits you better.


Check out [RemNote](https://www.remnote.com/) sounds a lot like what OP is achieving using MarkDown and Anki, but combined into a note-taking app like Notion/Roam. I've used it a bit and enjoy it, last I checked the iOS app isn't great, but the Android app is fine.


I made Mochi[0] as an alternative to Anki, also tackling basically the same problem as OP. The app is based around markdown note/flash cards, but also has a lot of other features inspired by Anki and its various add-ons.

[0] https://mochi.cards/


Hey, I remember having seen your program months ago here. I played with it a little bit now and it certainly looks interesting.

A little bit of feedback if you dont mind:

- Allow to deactivate the notifications for reviewed cards and the info on pressing the space bar. They can get annoying pretty fast.

-At least for the desktop browser version put the preferences in a normal page, not a modal. It was a pain to scroll down since I use only a shitty trackpad,so no mouse-wheel.


I actually looked into Mochi as well. I really like the ability to make edits inside the program. For me though, I like having my notes in markdown files so I could move it to places, upload to websites, etc.


Cool.

Tangentially related, but I have a GitHub Action [1] -- which converts all the notes I write in my (oft-neglected) TIL site [2], and which may also be of interest. It's simple stuff but yeah bit of fun.

[1]: https://github.com/Julian/til/blob/1b9ae162625d20d3e4b6a3ffb... [2]: https://github.com/Julian/til/ [2b]: https://til.grayvines.com/


this is really cool. Does the cards get automatically added to the Anki database? What do you do if you want to add to different decks?


They get automatically added yeah -- right now it's a very straightforward thing I wrote via genanki [1] which is the real magic, but if I wanted them to go to different decks it'd be a pretty easy modification to do so based on whatever criteria (say, post tags or something).

[1]: https://github.com/kerrickstaley/genanki


Definitely going to check this out, especially as someone applying to medical school. Came upon the same problem with Anki, it's great for memorization but challenging to make a ton of cards.

An aside question: For incoming med students interested in tech, would it be worthwhile to learn programming? I know it would be great for research. But as someone who is unsure about becoming a clinician scientist, it might be a waste of time to learn programming concurrently during med school.


I agree with "automate the boring stuff with python." It's actually the first book I used to learn Python.

I think it would be good if you learn it prior to going in. You just won't have time to do any programming learning in med school. Med school is more than a full time job by itself.


You may have more time, once in practice. I recall a couple of decades ago, it seemed every doctor in the country was learning to program, so he could automate his office. But, it turned out that was taken over by large corporations (as usual!) capitalizing on the need to integrate patient records with big hospitals and insurance systems.


I have time now :), in residency! And I should have more time as I go further in training!


Interesting, I always thought that residency got busier than med school, I guess it depends on residency type (e.g., surgical, radiology(?), etc). As a resident, do you see any startup opportunities within medicine? For example, I've seen some companies being started around machine learning in say, rad onc or radiology. Wondering how often findings from academic university research laboratories get translated into companies. Of course, there is the occasional biotech startup from wet labs.


I have many friends who are doctors and the one thing nearly all of them agree on regardless of age, school, or specialty, is that you really don't have time to do anything in med school other than go to med school. Especially something that takes blocks of time as large as programming.


I've heard this as well. Even undergrad was kind of busy for me. Would definitely be better to learn programming before med school.


I would say some programming skill is useful for anyone in the modern world, but I would just learn some Python and data manipulation tools. Something like Automate the Boring Stuff with Python would be good.


Thanks for the reference.


I wonder if you could use ankify to update anki cards in a bi-directional way? Like I can modify one of my cards and my notes will reflect the change, and vice versa


Right now it's only one directional from note to cards. To be bidirectional I would have to interact with the database directly. Theoretically it's possible but would just take a long time to program.


Many thanks. This looks neat and I will check it out. I am heavy user of Anki and was in a similar situation. I ended up taking notes in Notion and using https://2anki.net/ to create cards. It does restrict the type of notes you can take. Your application looks comprehensive. Thanks.


Yeah let me know if you have any comments or suggestions!


You can tell the website is using sveltekit by the favicon but also by how seamless the navbar navigation is. Congrats on launching.


Thank you. Yeah the navigation is so well thought with sveltekit. It's like a natural extension of svelte.


I'm using this plugin for Obsidian and very happy so far https://github.com/st3v3nmw/obsidian-spaced-repetition

Essentially no need convert your notes to Anki cards, your notes litelarly became spaced repetition cards.


I tried it before. It has very strict formatting. Meaning to make a card I have to change the way the note looks. I just want to be able to add cards quickly without messing with the format. This way my notes still flow well if I just want to read


In short it doesn't let me do what I wanted. I just wanted to keep my notes as is and add cards if I need to. I don't want to change lines of notes and reformat things just to make a card.


It's worth mentioning that users of TiddlyWiki can use https://sobjornstad.github.io/TiddlyRemember/ to a similar effect. Nice seeing more initiatives in this space.


Linux version, when?

Also, any plans of an Android version?


In the future for Linux yeah. I don't think it'll be too much harder. I just need to make sure the directories are done correctly.


Thanks, this actually looks good and useful.

I will use it if it is available on Linux.


No way! I have a humongous list of “term - definition.” and was planning in writing a program to do exactly this! Never got around it due to laziness/lack of prioritisation and this might have just saved me some time and effort. Thank you!


Thanks! Let me know if there's any suggestions or problems!


Why not use YAML "front matter" instead of abusing XML comments, which may (I didn't spend much thought on it) break it for people, who also want to encode the Markdown into XML/HTML?


The XML comments are just my personal preference because it's fast. I have it bound to ",," so that with 2 taps, I could make a card in a few seconds. It's also supported automatically in different markdown programs like Typora/Obsidian. When I upload to the web, the comments also disappear, so the flow of the note isn't interrupted if I just want to read. For example, when you can look at my personal wiki here, you wouldn't know these are cards unless you see the original markdown files. https://kangruixiang.github.io/wiki/

You can also use anything else instead. In my example, you could use {{}} as the front of the card instead of comments. I just chose comments myself.


I've only looked into importing cards automatically briefly. My feeling was that keeping progress might be an issue if cards change (and thus get re-created). Do you deal with that?


Yes, Ankify adds an ID to the front of the card so that on re-import, cards are updated instead of re-added. I'm careful about making changes to the MD file. The ID are only added to the front of the card so that the content of the notes are minimally changed.

See more here: https://ankify.krxiang.com/docs/basic


Love the memory aids. Staph -> pharoah. Tetracycline -> bicycle. Haemophilus + pneumonia -> rusty chest plate.


Feedback: I read the entire website and I still had to separately google what an Anki card is


I think this is more for people who are already in the Anki ecosystem and use it extensively.

Anki can take a while to get used to. And there are a lot of articles/videos tutorials. I didn't think it was within the scope of my program to explain Anki cards haha.


Obsidian needs to acquire you guys asap


(Shameless plug) Only marginally similar (though I imagine you can adapt it to the same purpose), but I also created a GUI tool [1] for quickly making Anki cards when reading foreign language texts. It's also not electron, but rather PyQt, so it conforms to your system theme if you are on Linux.

[1] https://github.com/FreeLanguageTools/vocabsieve




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: