Giter Site home page Giter Site logo

Comments (7)

adelin-b avatar adelin-b commented on June 5, 2024 1

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.

louietan avatar louietan commented on June 5, 2024

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:

  1. Ordered lists. How do we know if a <ol> was 1. or 1)?
  2. Unordered lists. How do we know if a <li> was + or * or -?
  3. Code and verbatim. How do we know if a <code> was ~ or =?
  4. 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.

bibekpokharel avatar bibekpokharel commented on June 5, 2024

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.

nanjigen avatar nanjigen commented on June 5, 2024

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.

okomestudio avatar okomestudio commented on June 5, 2024

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.

adelin-b avatar adelin-b commented on June 5, 2024

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.

orgtre avatar orgtre commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.