yanki 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/sync-CNwtrBlB.js +222 -0
- package/package.json +3 -2
- package/readme.md +15 -4
- package/dist/sync-4dSh1bTq.js +0 -304
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yanki",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An ultra-simple CLI tool and TypeScript library for syncing Markdown to Anki flashcards.",
|
|
6
6
|
"repository": {
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"chalk": "^5.3.0",
|
|
58
58
|
"globby": "^14.0.1",
|
|
59
59
|
"rehype-mathjax": "^6.0.0",
|
|
60
|
+
"rehype-parse": "^9.0.0",
|
|
60
61
|
"yargs": "^17.7.2"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"bumpp": "^9.4.1",
|
|
66
67
|
"deepmerge-ts": "^7.0.3",
|
|
67
68
|
"filenamify": "^6.0.0",
|
|
69
|
+
"hast-util-to-text": "^4.0.2",
|
|
68
70
|
"nanoid": "^5.0.7",
|
|
69
71
|
"path-browserify-esm": "^1.0.4",
|
|
70
72
|
"pkgroll": "^2.1.1",
|
|
@@ -83,7 +85,6 @@
|
|
|
83
85
|
"remark-remove-comments": "^1.0.1",
|
|
84
86
|
"remark-wiki-link": "^2.0.1",
|
|
85
87
|
"sort-keys": "^5.0.0",
|
|
86
|
-
"string-strip-html": "^13.4.8",
|
|
87
88
|
"tsx": "^4.15.4",
|
|
88
89
|
"type-fest": "^4.20.0",
|
|
89
90
|
"typescript": "^5.4.5",
|
package/readme.md
CHANGED
|
@@ -131,7 +131,7 @@ Yanki uses Anki's built-in CSS stylesheet to style cards by default, but it make
|
|
|
131
131
|
|
|
132
132
|
The "one Markdown file = one Anki note" can make for a lot of individual files, and thinking up and renaming files as content is revised can be tedious. So, if you want, Yanki can manage the names of your note files based on their content.
|
|
133
133
|
|
|
134
|
-
Yanki looks inside each note, and extracts either the text of the prompt (e.g. the front of the card in most cases), or the "response" (e.g. the back of the card in most cases) to use as the filename. Truncation, deduplication, and sanitization are all taken care of.
|
|
134
|
+
Yanki looks inside each note, and extracts either the text of the "prompt" (e.g. the front of the card in most cases), or the "response" (e.g. the back of the card in most cases) to use as the filename. Truncation, deduplication, and sanitization are all taken care of.
|
|
135
135
|
|
|
136
136
|
Edge cases are carefully managed to ensure that there's always _some kind_ of best-effort semantically valuable file name assigned.
|
|
137
137
|
|
|
@@ -215,7 +215,18 @@ Clozing a block element is not currently supported.
|
|
|
215
215
|
|
|
216
216
|
The `yanki` CLI tool requires Node 18+. The exported TypeScript / JavaScript APIs are isomorphic, and can run in both browser-based and Node runtime environments. The Yanki library is ESM-only, is implemented in TypeScript, and bundles a complete set of type definitions.
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
#### Prerequisites:
|
|
219
|
+
|
|
220
|
+
- The [Anki desktop app](https://apps.ankiweb.net)
|
|
221
|
+
- The [Anki-Connect](https://foosoft.net/projects/anki-connect/) add-on
|
|
222
|
+
|
|
223
|
+
If you need to install it, select _Tools → Add-ons_ from the menu, click _Get Add-ons..._, and then enter the code `2055492159` in the field to get Anki-Connect.
|
|
224
|
+
|
|
225
|
+
Anki-Connect may ask for your permission in the Anki application to connect to Obsidian on the first sync.
|
|
226
|
+
|
|
227
|
+
If the automatic permission request fails, you might need to configure Anki-Connect to accept connections from your origin.
|
|
228
|
+
|
|
229
|
+
In Anki, select _Tools → Add-ons_ from the menu, then select _AnkiConnect_ from the list, and click the _Config_ button in the lower right. In the ensuing modal, add the host and port from which you're attempting to connect to to the `webCorsOriginList` array.
|
|
219
230
|
|
|
220
231
|
### Installation
|
|
221
232
|
|
|
@@ -496,9 +507,9 @@ The Yanki TypeScript / JavaScript library is idempotent, so you can run it in a
|
|
|
496
507
|
|
|
497
508
|
There's one exception, the `syncFiles(...)` function, which by default relies on file system access to work.
|
|
498
509
|
|
|
499
|
-
To retain `syncFiles(...)`'s utility in a browser environment, has the optional arguments `readFile` and `
|
|
510
|
+
To retain `syncFiles(...)`'s utility in a browser environment, has the optional arguments `readFile`, `writeFile`, and `rename`, which are implemented by `node:fs/promises` by default in Node environments.
|
|
500
511
|
|
|
501
|
-
Running Yanki in a browser environment
|
|
512
|
+
Running Yanki in a browser environment requires implementing and passing `readFile`, `writeFile`, and `rename` implementations to `syncFiles(...)` that are suited to your particular use case. (A warning will be provided if you neglect to do so.)
|
|
502
513
|
|
|
503
514
|
The rest of the library should work fine in both contexts without special measures.
|
|
504
515
|
|