benwr / ankdown Goto Github PK
View Code? Open in Web Editor NEWEasily make Anki flash cards in markdown
License: MIT License
Easily make Anki flash cards in markdown
License: MIT License
Hi Ben:
I just added cloze feature, would you like to add into your project?
Thank you
Houcheng Lin
I haven't found a way to disable this. But than again, this might be intentional.
I can't change my vscode plugin (Markdown All in One) to work with the Math separator syntax which the script is using. In my opinion it should be possible to have a option that ankdown also works with $
and $$
by substitute it later in the process to \( \)
and \[ \]
with a regular expression.
When I have the time I would do a pull request. Would be nice to get your opinion about it.
Thank you for your work.
I am using a lot of mnemonics for my flash cards and audio files. Does ankdown support them? And if yes, how would I add them to my flash cards?
Switching to MathJax or KaTeX, since ankdown's math display mode is really pretty bad.
I've started this on the mathjax branch; using this blogpost as a guide.
When importing the some flashcards with utf8 formatting this error occurs:
Traceback (most recent call last):
File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 389, in main
cards_to_apkg(card_iterator, pkg_arg)
File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 340, in cards_to_apkg
for card in cards:
File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 328, in cards_from_dir
for card in produce_cards(os.path.join(parent_dir, fn)):
File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 301, in produce_cards
for line in f:
File "C:\Python36\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3504: character maps to <undefined>
Changing line 297 in ankdown.py to
with open(filename, "r", encoding="utf8") as f:
helps.
I thought though, that the default import in python is utf8. Should I do a pull request for this little bug?
First of all, thanks for this addon and your help with my image issue. PDF -> Markdown -> Anki is sooo much more fun to work with.
As I am often iterating on my cards, I have to reimport the decks multiple times (because I want to keep all the cards managed by ankdown and not risk overwriting changes done in anki itself).
However, everytime I reimport the decks, it overwrites my CSS changes to the Ankdown Card Type (I changed the font-size and the font itself as it was not really readable on my computer).
Is this a known issue?
Currently I just copy the affected CSS back into the card template once I reloaded the decks.
Somehow we're now creating invalid apkgs when there are images. One problem is the relative paths change, but there's some deeper problem, because even when that's fixed we produce invalid archives.
Hi,
it's a little bit unusual request but I recently found the project ankidown. It can work with more difficult templates but has maybe some problems in parsing the markdown that ankdown doesn't have. Would be great if we could join forces between all who want to have a great tool for importing markdown into Anki. Please check it out. Hope you don't take it offensive.
From @jay-pee in #7 , copying here as it's a slightly different issue
When putting images in subfolders an error occurs:
Traceback (most recent call last): File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 389, in main cards_to_apkg(card_iterator, pkg_arg) File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 343, in cards_to_apkg copyfile(abspath, newpath) # This is inefficient but definitely works on all platforms. File "C:\Python36\lib\shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: 'assets/images/philly-magic-garden.jpg'
Maybe we have to create the folder before putting the image there with copyfile(abspath, newpath).
Or change the newpath variable.
There are a bunch of things that one might want to configure about this tool: custom CSS and math separators are two that have gotten pull requests recently, but I suspect there are others.
It would probably be nice if these options could be placed into configuration files. But I think you might also want to have different configurations for different decks, or even different files. So it might also be nice if all the configuration options could be passed as command line flags. I don't want to overengineer this, but there's probably a reasonably nice, future-proof solution in design space somewhere.
I should write some tests or something if I want anyone else to use this ever.
Is there a way to control the order of cards that are added?
I currently use Markdown to write my lecture notes and then arrange them for the import. However, especially in math-heavy courses the ordering of the cards is quite important.
I just tested two md files with 2 cards each (1Test.md and 2Test.md). The order that the cards were added was random, first one card of md file 1, then two cards of file 2 and then the second card of file 1.
My Anki Setup is configured to ask the cards in the order they were added.
I made a test deck to look if ankdown is converting everything properly.
After fixing the error in issue #24 and #7 it did work! :)
Actually not fully :P
My last card is about github flavored markdown:
# Github Flavored
%
**Syntax Higlighting**
```javascript
function fancyAlert(arg) {
if(arg) {
$.facebox({div:'#foo'})
}
}
```
**Task List**
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item
**Tables**
| test | test2 | test3 | test4 | test5 |
|------|-------|-------|-------|-------|
| test | test2 | test3 | test4 | test5 |
| test | test2 | test3 | test4 | test5 |
| test | test2 | test3 | test4 | test5 |
**Strike through**
~~this~~
Ankdown doesn't support this fully. Her is a picture of the rendered version:
Would be nice to have this feature :)
hi,this is great!,can i use visual studio code with plugin markdown-preview-enhanced to create deck/cards?
Preserving card identity across edits is difficult: You can force the user to give each card a unique ID, or you can try to infer one, based either on card position, or on card contents. I wonder if you could do better by incorporating information from your existing anki decks (e.g. by interfacing with an anki plugin, or by reading the database directly). This is one of my major pain points with ankdown at the moment.
Hi,
I've followed the instructions
but i still see:
MacBook-Pro:~ Documents$ ankdown
-bash: ankdown: command not found
after running the pip3 install...
The anki addon also won't work
Need to thread the file path through to the package constructor function to get this to work properly.
This project uses a PyYAML version that has a code execution vulnerability. Since the user is here assumed to be in complete control of any yaml input, I don't actually consider this a vulnerability in the project, but it should probably be dealt with anyway.
Hi there,
I've modified your code to allow for 11 fields, this is my basic card type (I don't have that many fields which I actually use for text, some work as toggles). Since it's quite hard to see which of the 11 % symbols belongs to which of the 11 fields it would be nice to put some text after the % symbol.
For instance:
Front
% Back:
Back
% Field 3:
Content of field 3.
etc.
Would there be a simple way to implement this?
#20 pointed out that the README doesn't mention that this tool creates .apkg files; this should be fixed.
I follow the method A to create a package.
An error occurs when importing the package with the Anki import tool:
Selected file was not in UTF-8 format. Please see the importing section of the manual.
The directory specified after -r
has only one file which is a copy-paste of the cards example from README.
Tried out on Anki 2.1.11-1 and Anki 2.1.13 (dev).
Is ankdown
supposed to produce files in UTF-8 format? When I run file -i package
I can see charset=binary
, so the output I get from ankdown
isn't UTF-8.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.