Comments (7)
I did my own dirty version of the fetch function.
# in shell
deno run --allow-net anki.ts "*"
# or
deno run --allow-net anki.ts "Deckname::subdeckname"
# in emacs evil mode
:read !deno run --allow-net anki.ts "*"
https://gist.github.com/adelin-b/362a04fb29dd7ee618952fe2fe5e2417
However it seems that anki-editor is auto escaping html elements so they end up visible when the cards are pushed back into anki. How can we avoid this ?
from anki-editor.
It is a nice addition to have and is trivial to implement for plain text fields I think.
The chanllenge is that not only do we need a converter to translate Anki HTML back to Org, but we also requires the converter to be able to produce the exact same Org elements as the original one.
Org has so many constructs, for some of them, when converted to HTML, lots of information is lost, for which reason I don't even think it's possible to produce the identical Org contents to the original one from HTML, examples I could think of right now:
- Ordered lists. How do we know if a
<ol>
was1.
or1)
? - Unordered lists. How do we know if a
<li>
was+
or*
or-
? - Code and verbatim. How do we know if a
<code>
was~
or=
? - Embeded HTML. How do we know if an HTML fragment was embeded in Org with
#+BEGIN_EXPORT html
?
In additional, there're elements in HTML that are not available in Org, e.g. styling (colors, alignments), these would be lost when converted back to Org and we are not able to detect and warn the user of the lost.
from anki-editor.
I agree. Some information would definitely be lost if the original information was in HTML form. However, the first step would be to apply this to the cards created via anki-editor-mode, for which there should exist a reversible transformation. We also pick a convention and inform the users that for certain information, where there are multiple options, one option will be chosen by default - for example code will always be surrounded by =.
from anki-editor.
As an alternative what about utilizing the :ANKI_NOTE_ID:
field, and something like this anki addon and some more code to trigger opening to the position of the anki card subheader in its org-file for editing when pressing the edit key in Anki itself?
We still won't gain editing in ankidroid, but at least this way we can continue managing cards in org-mode and make use of Emacs/evil keys for editing - potentially making the editing process less painful.
from anki-editor.
The fetch function would be a very welcome addition. Implementing some sort of reversible transformation as mentioned above would certainly be nice for notes created by anki-editor
, but falling back to fetching HTML content as is or something equivalent would still be very useful to "import" notes into an org files, which we can treat as the master to sync subsequent edits. It is unfortunate that Anki mutates input for presentation and doesn't appear to provide a way to work on the source...
from anki-editor.
For now I think using an html-to-org like pandoc on each text field would be good enough for a first version. Im looking up this package for a year now and I cannot use it as I need double sync / importing from anki to an orgfile
For later I think it should be keeping the original html tags and non-org styles in hidens property that would get their text content replaced by template .
Or write the raw html in orgmode in a html code block
from anki-editor.
I've also had (partial) success with writing a fetch function, this was originally intended for merging into anki-editor, but is now finally published here: https://github.com/orgtre/ankiorg. Also org-anki recently added the function org-anki-import-deck
which might be a useful alternative.
from anki-editor.
Related Issues (20)
- Match org headings escaped with a `,` (needed within org source blocks) HOT 1
- Status of this package and a way ahead HOT 15
- Pushing cloze fails with unknown reason HOT 10
- Is there a recommended workflow for deleting a card (or set of cards)? HOT 2
- Is anyone still developing this project? I find it very useful HOT 2
- ANKI_NOTE_ID not updated after push HOT 1
- Provide a keymap for the anki-editor-mode HOT 1
- Custom faces for Anki's cloze syntax HOT 1
- Question: Does the sync work in both directions? HOT 1
- Number Cloze deletions with consecutive IDs automatically HOT 1
- Can't push notes on WSL2 HOT 2
- Wrong type argument: integer-or-marker-p, nil (develop branch) HOT 2
- Any way to avoid "cannot create note because it is a duplicate"? HOT 1
- AnkiDroid doesn't support wrapping each lines of display equations in <div>
- pushing tree broke HOT 2
- anki-editor-push-notes creates "two" cards HOT 1
- Superscript issues HOT 2
- Add syntax highlighting to src blocks HOT 9
- Per file properties do not work HOT 1
- SRC block exported even if :exports results is set HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anki-editor.