kangruixiang / Ankify

Ankify notes into anki cards
https://ankify.krxiang.com/
46 stars 2 forks source link

Having difficulty running the Ankify script #6

Closed DryIce1 closed 8 months ago

DryIce1 commented 4 years ago

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

kangruixiang commented 4 years ago

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.

DryIce1 commented 4 years ago

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.

DryIce1 commented 4 years ago

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

kangruixiang commented 4 years ago

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.

DryIce1 commented 4 years ago

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 :)

kangruixiang commented 4 years ago

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.

DryIce1 commented 4 years ago

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:

  1. copies all the images to anki media folder
  2. makes an html folder inside your markdown folder
  3. converts all of the markdown files into one html file No html file within the html folder :(

output.txt

thanks

DryIce1 commented 4 years ago

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

kangruixiang commented 4 years ago

That sounds like the script worked but didn't find any MD files. Yeah I'm eastern time. Email me kangruixiang@gmail.com, and we can setup a time tomorrow.

DryIce1 commented 4 years ago

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 :)

kangruixiang commented 4 years ago

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.

DryIce1 commented 4 years ago

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

kangruixiang commented 4 years ago

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.