-
-
Notifications
You must be signed in to change notification settings - Fork 35
Structure of this Plugin
debanjandhar12 edited this page Jan 23, 2022
·
2 revisions
- The plugin uses AnkiConnect API for connecting with Anki from Logseq.
- Each logseq graph is represented as a note type (model) in Anki. The model name is usually given as
${graphName}Model
. - Each logseq anki sync card type (multiline cards, clozes) is represented as a note in Anki. The tuple of (uuid of the logseq block which makes the note, note type) is used as unique identification for a note.
- Each note in Anki is responsible for displaying one or more cards.
- The plugin can use the unique identification to decide whether to create, update or delete a note based on the data in respective logseq graph.
-
Anki requires cards content to be in HTML.
-
The above means that md/org needs to be converted to HTML. This is done by mldoc. This is the same parser over which logseq renderer is build.
NB: The logseq renderer builds over mldocs using mldocs's json output as a base. However, logseq anki sync plugin uses mldocs's export function as base along with hacky tricks to generate output html.
-
The files
logseq_anki_sync_back.css
,logseq_anki_sync_back.js
,logseq_anki_sync_front.css
,logseq_anki_sync_front.js
,logseq_anki_sync_back.css
,logseq_anki_sync_back.js
are overwritten with every sync operation.
- New logseq anki sync card type can be added by extending Block class.
- The
logseq_anki_sync.css
,logseq_anki_sync.js
is included with all cards in Anki. Thelogseq_anki_sync_back.css
,logseq_anki_sync_back.js
is included in back side of cards in Anki. Thelogseq_anki_sync_front.css
,logseq_anki_sync_front.js
is included in front side of cards in Anki.