ashlinchak / mdanki Goto Github PK
View Code? Open in Web Editor NEWMarkdown to Anki converter
Markdown to Anki converter
This isn't necessarily an issue with mdanki
, I am just curious how you manage duplicates.
For example, I add cards to my repo frequently. Once I am done adding some cards, I run mdanki
. After this is done, if I just import the file directly I get duplicates in Anki. If I delete the deck and then add the new one, I lose all progress.
What does your workflow look like?
I was testing if [latex]
blocks would be supported, and indeed they work, except I needed to write \\[
to get \[
in the source, but still it works! e.g.
## [latex]\\[\sin^2\theta + \cos^2\theta = \\][/latex]
[latex]\\[\sin^2\theta + \cos^2\theta = 1\\][/latex]
produces
(Need to have LaTeX installed)
Now onto the issue, since I tried to follow the README and produce a multi-line front of card:
## A
[latex]\\[e^x -1 = 3\\][/latex]
%
a text [latex]$e^x -1 = 3$[/latex]
Expected: front of card with A and one equation, back of card another equation
It seems the %
separator doesn't get recognized correctly when the card contains [latex]
.
Hey great Project!
I wrote a little script that allows me to use your project on Joplin!
https://github.com/quantumfate/utilityscripts/tree/main/Mdtoanki
It is a script for personal use so you would have to change variables according to your system yourself. The advantage is that you can call the script without having to provide long paths with every call.
There are some requirements and workarounds that I have explained in the Readme.md. The script replaces Joplin's internal Image linking with the paths to actual images so they can appear in the anki flash cards
Payments to your donation link are broken until you select a payment method with buymeacoffee.com. Nobody can give you money :)
Is it possible to use audio file in resources ? I tried adding it as inlined image. I see that mp3 gets added to final .apkg but it's not playable in Anki app.
What am I missing ?
Thanks for publishing this! In case you'd like to make your repo more findable, you could add that topic ;-) Thank you!
After generating an apkg with the same markdown file, I import it, then I found a new note type naming with a hash id suffix will appear, and the totally same notes will be imported.
For example,
markdown A -> A.apkg -> [notyType, notes]
markdown A -> A.apkg -> [notyType-1acd2, notes]
I think the common way in markdown for edit mathematical formulas is using "$", in my editor this the only way to display the mathematical formulas.
Like:
[latex]\[e^x -1 = 3\][/latex] (does't work)
But the thing is anki and mdanki can't identify the second way.
I used to use another Tex editor and screenshot then paste to md editor.
But sometimes it's really time-consuming.
So how about support '$' input type.
Hi ashlinchak,
Output works! You can close the issue if you like.
mdanki /folderxxx/history.md /folderxxx/output/123.apkg
writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!
The deck "007 history" has been generated in /Users/lisa/Desktop/output/123.apkg
When trying to install with npm install -g mdanki
:
npm WARN deprecated [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
When you convert a markdown file, the front of the card has something like this (when looking at the raw html):
<h2 id="front"><span style="font-weight: normal;">Front</span></h2>
Which results in the text of front of a card being bigger than I would like it (because it is a h2).
I would like to be able to have the raw html of the front of the card just be plain text. I do not like how it is left-align, the text being bigger and bold can be dealt with at a later time. Plus, I am not very familiar with JavaScript. I would, however, be willing to learn more and produce a solution.
So, if anyone could point me in the direction where the contents of the html of the front of the card (or the back for that matter) are defined, that would suffice. Thank you!
Getting an warning message when building anki files on mdanki 1.0.2.
The built anki files work by the way.
## Test
test
npx mdanki example.md example.apkg
writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!
The deck "mdanki" has been generated in /home/u/markdown_to_anki/example.apkg
The deck "mdanki" has been generated in /home/u/markdown_to_anki/example.apkg
Wild guess but maybe the message comes from an old copy of sql.js that anki-apkg-export 4.0.3
is using.
Related links:
Hello, thanks for making this project! :-)
In my usage of Anki, I found that I tend to make as many cards as possible with cloze deletion, as opposed to the standard front/rear cards. At least myself, I find them more powerful.
Quoting the Anki documentation:
Cloze deletion is the process of hiding one or more words in a sentence. For example, if you have the sentence:
Canberra was founded in 1913.
…and you create a cloze deletion on “1913”, then the sentence would become:
Canberra was founded in [...].
(there is more to it, and the link above gives the full details)
Would you consider adding support for them in mdanki ? Thanks.
I would like to only generate cards with content inside level 2 headings.
For example this:
## heading 2
text inside
# heading 1
text inside
Would currently translate to a card like this:
[front]:
heading 2
[back]:
text inside
# heading 1
text inside
I would expect the card to not have level 1 heading and it's contents inside:
[front]:
heading 2
[back]:
text inside
So basically I would expect mdanki
to ignore level 1 headings that are in the middle of the documents. Would this be possible? Or maybe there already is some way to have text in a markdown document that doesn't get included in the card?
When the filename of an image contains spaces, mdanki doesn't recognize the file.
A solution would be to use "%20" in the link and decodeUriComponent
in MediaParser
data = fs.readFileSync(decodeURIComponent(filePath));
Hi, thank you for this cool tool.
I have tried to convert a markdown file whose size is 302 KB.
And I also tried to split the large file into several files with lower 7KB, and it still failed.
It's ok to handle a small markdown file. So I guess it needs a lot of memory to fill before construct a .apkg
file?
Here is error msg:
mdanki ./md/ dst.apkg
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents
some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents
some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
mdanki <source> <target>
Convert Markdown file into anki's apkg file for importing.
Options:
--help Show help [boolean]
--version Show version number [boolean]
--config Configuration file location [string]
--deck Deck name [string]
abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but pr
events some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ") at Error
at Ra (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:32:124)
at Qa (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:32:22)
at p (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:488:103)
at Function.ba [as Gb] (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:12:164)
at Ia (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:397:297)
at _Q (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:465:135615)
at Iu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:26931)
at sO (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:465:55965)
at _f (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:459:91456)
at Gu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:26226)
at Fu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:24948)
at Cu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:23165)
at Bu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:21949)
at qu (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:468:16949)
at cs (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:462:94725)
at sg (/usr/local/lib/node_modules/mdanki/node_modules/sql.js/js/sql.js:459:113005)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
I am used to automatically generating a piece of json information in the md file, using ---
as a separator, in order to use mdanki, I have to write a modification program to remove this json information, can I directly add this function in mdanki?
Really nice work on this project! Been enjoying using it so far.
As a casual obsidian user, I have some projects where my markdown files are atomic (the name of the file is the key word, and the file content is the definition) instead of a long file with a lot of keywords and definitions. This would map nicely with ANKI and this tool if we could pass in another strategy as a CLI paramater or something that would handle this case.
I've started to hack this together locally and have it partially working, although it is nowhere near as clean as the rest of the project.
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.