clouder0 / ankiin Goto Github PK
View Code? Open in Web Editor NEWA python importer lib for Anki.
License: MIT License
A python importer lib for Anki.
License: MIT License
$ dollars
For now, it would probably crash AnkiLink as it would assume that the text includes a math formula but fail to find the right bracket.
This function should be configurable.
call the function once the process starts.
Create anki note type in the script automatically when started for the first time rather than import a test deck manually.
This has been deprecated as it requires that Anki is opened during initializing.
Now the model is created when a related exception occurred.
support numbering clozes, an example:
Cloze1 is **[1]something** and Cloze2 is **[1]something** like that.
Cloze1 is {{c1::something}} and Cloze2 is {{c1::something}} like that.
For now, it is hardcoded.
Test Case:
判断:向 $\ce{ZnS}$ 和 $\ce{NaS}$ 的悬浊液中滴加 $\ce{CuSO4}$ 溶液,有黑色沉淀生成,说明 $\ce{K_{sp}(CuS) < K_{sp}(ZnS)}$.
错误,考虑 $\ce{NaS}$ 使 $\ce{S^{2-}}$ 过量。
Sometimes a block shouldn't be recognized as a note.
Add syntax for block skipping.
In the past, I set the alignment to left
for proper list display style. However, I've found a method to set center-left alignment, so I'll switch back to center
.
It is notable that Choices will also be center-aligned.
To avoid a collision, the names of Note Types would be changed.
Use pure string parsing instead of regex to avoid errors.
Lines with only spaces should be recognized as blank lines.
$\ce{K_3[Fe(CN)_6]_3}$
is formatted as \(\ce{K<em>3[Fe(CN)</em>6]_3}\)
.
from helper.formatHelper import formatText
text = "$\ce{K_3[Fe(CN)_6]_3}$"
print(formatText(text))
It should be rendered as \(\ce{K_3[Fe(CN)_6]_3}\)
to adapt to LaTeX syntax.
directly render Markdown into Html for Anki support.
Support Multiple Line Questions in a more elegant way.
For now, you have to use <br>
inline HTML for multiple line questions.
Question1 <br> Question2
Answer.
I'd like to add a built-in note type for multiple-line questions.
!Question1
!Question2
Answer
Answer2
Maybe a !
prefix would be used.
Originally, the choices option field use <div>B something.</div>
to make a new line.
In the old versions, Anki will treat this kind of syntax as new lines and recognize it as an option.
options = options[0] + \
list2str(options[1:], "<div>", "</div>", keepsuffix=True)
However, in Anki 2.1.41 and later versions:
<br> tags will now be used by default instead of the previous <div> tags, which solves some issues with multiple lines in cloze deletions and MathJax (thanks to Henrik).
Now both <br>
and <div>
are supported thus I will still stick to the old method for backward compatibility.
However, after the new version is universally adapted, I'd change it to <br>
for better consistency.
Save the configuration in SiYuan block Inline Attribute List for config.
Use any syntax you like.
**test**
[test]
(test)
If the target deck doesn't exist, create it via anki connect.
Similar to import notes via Anki connect, but don't require its running.
It may be complicated to implement and is not a promised feature. I'd look further on it in the future.
Customize SiYuan Attribute Tag. Default is ankilink
.
Consider using logging.
Separate config system from system args parsing.
When importing a file for the second time, try to overwrite the duplicates rather than add another note.
This requires a method to recognize the original note.
Maybe an ID should be added to the markdown file, but it would pollute the text.
So I'd rather create an ID for a file and insert it into the ending of the file. Then add a property for cards generated by the file.
Each time a file is imported, do an O(n^2) fuzzy match to see which note belongs to which block, and updating notes would be rather easy.
I'd like to know your opinions about this function.
Embed config in markdown files so that anyone with the file can import without extra params.
A useful function when collaborating with others.
There should be file-level config, subtitle-level config, and block-level config.
This function may require parsing markdown syntax into a tree.
A test case to clarify what I want.
!!!Deck=Test!!!
!!!Tag=TestTag!!! #set tag to TestTag
Example Q
Example A
## SubTitle
!!!Deck=Test2!!! #overwrite deck
!!!Tag=tag2!!! #overwrite tag
Something like that...
hmm..
!!!Tag:+tag2!!! #add tag for block
This is a block.
No tag2 for this.
### SubSubTitle
Inherit parent config.
## Another SubTitle
Now Deck is Test and Tag is TestTag.
genanki is a python lib to generate Anki apkg files directly. No need to run Anki in the background anymore.
The tags are missing when exporting to an APKG file.
This may have something to do with Genanki I guess.
Since Deck is assigned in AnkiLink, the configuration in AnkiIn doesn't work.
Add a direct export method to support this config.
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.