Ankify
Ankify copied to clipboard
Having difficulty running the Ankify script
Hello,
thank you for your work, I have been wanting to incorporate this into my workflow since December last year and I have adopted Obsidian as my markdown writer recently.
I wonder if you could walk me through how to run your script? I am using Windows and have downloaded the Ankify package.
I don't know how to run "npm install" and nor run "npm link".
In the next step to run the script, do I open the command prompt and type "ankify"?
Thanks in advance. Tom
Hello, so the script is run in node.js, which needs to be run from the command prompt. You can install both node.js and npm here. Afterwards, you should be able to open up command prompt and type in npm -v to see the version for installation confirmation.
To run the script, open up command prompt and navigate to the script folder. Then, you can type npm install
. This installs all of the dependencies for the script. Then, you can run npm link
. This links the script so you can run ankify
anywhere later on.
Thank you, that was really well explained and I think the script has been properly installed.
I have summarised the installation process so that perhaps novices like myself may be able to walk themselves through the installation a bit more efficiently than I did.
- The Ankify script needs some JavaScript software installed for it to run. Download and install node.js and npm via this website . Confirm correct installation by using the command prompt and typing
npm -v
andnode -v
- Download the Ankify zip, extract Ankify-master folder, and move it to a permanent location.
- Edit and rename the .sample-env file as described in the ReadMe.
- Next the Ankify script must be installed. Open the command prompt and navigate to the Ankify-master folder using the
cd
command (e.g.cd C:\Users\"User...."\....\Ankify-master
). Then typenpm install
. Then typenpm link
. This allows the script to be run from anywhere when you open the command prompt. - To import new flashcards, run the open command prompt and type
ankify
. The script will copy new media files into the selected Anki Profile media collection and an html file in your MarkDown directory is created/updated with the new flashcards which can then be imported into Anki (usingctrl + shift + i
).
Despite my successes above with installation, the script doesn't create any .html output file.
In the command line, I am getting a few errors. I wonder if you could take a look at it for me. How do you think I could troubleshoot this?
I have attached the env and script output as text files
Hey so I found fixed some of the code. It should work now in making the html code in the current folder. Also, for the anki profile folder, default is "Anki2\User 1\collection.media". You just change the User 1 part to your profile name.
Thanks for your support @kangruixiang. I will fix my anki profile name in .env
I unlinked and uninstalled the ankify script, and then re-downloaded and installed it.
It hasn't worked successfully yet, but perhaps we are closer?
I know this is just a hobby, but if you are able to please assist at your convenience, Best Tom :)
Hello, thanks for trying. I rewrote the entire script with a different parser that should work more robust with less problems. Before you redownload the script, run npm unlink
so you uninstall the previous version.
Let me know if this works or not. If not, we could set up a time for me to look at your screen. I've done that with 2 other people and helped them getting things to work. Otherwise, you can wait a few weeks for a version with interface to come out so you won't have to deal with command lines.
Hi @kangruixiang! Perhaps we are getting closer....?
Command line output is Creating Anki card
and it does 2 of the 3 things that your README file says it should do:
- copies all the images to anki media folder
- makes an html folder inside your markdown folder
- ~~converts all of the markdown files into one html file~~ No html file within the html folder :(
thanks
ps: I would be happy to do a screenshare session. I am available this weekend. My timezone is GMT+10, if that helps! How would you like to connect?
tom
That sounds like the script worked but didn't find any MD files. Yeah I'm eastern time. Email me [email protected], and we can setup a time tomorrow.
That sounds like the script worked but didn't find any MD files.
Yes, you're right I changed the ROOT_DIR to a folder which actually does contain a few MD files and it produced the Ankify html!
However, it is still not running properly. It doesn't recognise the MD files contained within deeper folders in the directory. You're doing well - almost there haha! Thanks :)
If you change line 68 of index.js
let files = glob.sync(path.resolve(rootDir, "*.md"));
to this:
let files = glob.sync(path.resolve(rootDir, "**/*.md"));
That should work.
Thanks, I have it working well, and I can feel the workflow will be quite quick when going through my existing notes.
It is important to remember to use the ~
sign when importing!
What Text Expander software do you use on Windows? thanks
Yeah once set up it's really fast. I don't have to tailor my notes to making cards. I just add cards when I feel it's useful. I've been using espanso. It requires some setup but is rather simple.