yanki 2.0.1 → 2.0.3
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 +73 -73
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +44 -12
- package/dist/standalone/index.d.ts +1 -0
- package/dist/standalone/index.js +95 -95
- package/package.json +4 -4
- package/readme.md +8 -8
- package/dist/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yanki",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A CLI tool and TypeScript library to turn Markdown into Anki flashcards.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anki",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dist/*"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@shikijs/rehype": "^
|
|
51
|
+
"@shikijs/rehype": "^4.0.0",
|
|
52
52
|
"@sindresorhus/fnv1a": "^3.1.0",
|
|
53
53
|
"@sindresorhus/slugify": "^3.0.0",
|
|
54
54
|
"@stdlib/assert-is-absolute-path": "^0.2.3",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"execa": "^9.6.1",
|
|
109
109
|
"mdat-plugin-cli-help": "^1.0.7",
|
|
110
110
|
"playwright": "^1.58.2",
|
|
111
|
-
"publint": "^0.3.
|
|
111
|
+
"publint": "^0.3.18",
|
|
112
112
|
"tsdown": "^0.20.3",
|
|
113
113
|
"tsx": "^4.21.0",
|
|
114
114
|
"typescript": "~5.9.3",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"devEngines": {
|
|
121
121
|
"runtime": {
|
|
122
122
|
"name": "node",
|
|
123
|
-
"version": ">=
|
|
123
|
+
"version": ">=21.0.0"
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
"scripts": {
|
package/readme.md
CHANGED
|
@@ -289,7 +289,7 @@ _If you delete one of several implicitly numbered clozes (e.g. `~~hidden~~`) fro
|
|
|
289
289
|
|
|
290
290
|
### Dependencies
|
|
291
291
|
|
|
292
|
-
The `yanki` CLI tool requires Node
|
|
292
|
+
The `yanki` CLI tool requires Node 20.11+. 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.
|
|
293
293
|
|
|
294
294
|
The tool has been tested on Windows, macOS, and Linux.
|
|
295
295
|
|
|
@@ -302,7 +302,7 @@ _Linux users should note that the Flatpak / Flathub version of Anki is not recom
|
|
|
302
302
|
|
|
303
303
|
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.
|
|
304
304
|
|
|
305
|
-
Anki-Connect may ask for your permission in the Anki application to
|
|
305
|
+
Anki-Connect may ask for your permission in the Anki application to allow the connection on the first sync.
|
|
306
306
|
|
|
307
307
|
If the automatic permission request fails, you might need to configure Anki-Connect to accept connections from your origin.
|
|
308
308
|
|
|
@@ -406,7 +406,7 @@ yanki sync <directory> [options]
|
|
|
406
406
|
| `--anki-connect` | Host and port of the Anki-Connect server. The default is usually fine. See the Anki-Connect documentation for more information. | `string` | `"http://127.0.0.1:8765"` |
|
|
407
407
|
| `--anki-auto-launch`<br>`-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
|
|
408
408
|
| `--anki-web`<br>`-w` | Automatically sync any changes to AnkiWeb after Yanki has finished syncing locally. If false, only local Anki data is updated and you must manually invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync" button in the Anki app. | `boolean` | `true` |
|
|
409
|
-
| `--manage-filenames`<br>`-m` | Rename local note files to match their content. Useful if you want to
|
|
409
|
+
| `--manage-filenames`<br>`-m` | Rename local note files to match their content. Useful if you want to have semantically reasonable note file names without managing them by hand. The `"prompt"` option will attempt to create the filename based on the "front" of the card, while `"response"` will prioritize the "back", "Cloze", or "type in the answer" portions of the card. Truncation, sanitization, and deduplication are taken care of. | `"off"` `"prompt"` `"response"` | `"off"` |
|
|
410
410
|
| `--max-filename-length` | If `manage-filenames` is enabled, this option specifies the maximum length of the filename in characters. | `number` | `60` |
|
|
411
411
|
| `--sync-media`<br>`-s` | Sync image, video, and audio assets to Anki's media storage system. Clean up is managed automatically. The `all` argument will save both local and remote assets to Anki, while `local` will only save local assets, `remote` will only save remote assets, and `off` will not save any assets. | `"off"` `"all"` `"local"` `"remote"` | `"local"` |
|
|
412
412
|
| `--strict-matching` | Consider notes to be a "match" only if the local Markdown frontmatter `noteId` matches the remote Anki database `noteId` exactly. When disabled, Yanki will attempt to reuse existing Anki notes whose content matches a local Markdown note, even if the local and remote `noteId` differs. This helps preserve study progress in Anki if the local Markdown frontmatter is lost or corrupted. In Yanki 0.17.0 and earlier, `--strict-matching` was the default behavior. Starting with version 0.18.0, it is disabled by default. | `boolean` | `false` |
|
|
@@ -498,7 +498,7 @@ function getNoteFromMarkdown(
|
|
|
498
498
|
|
|
499
499
|
function syncNotes(
|
|
500
500
|
allLocalNotes: YankiNote[],
|
|
501
|
-
options?: PartialDeep<
|
|
501
|
+
options?: PartialDeep<SyncNotesOptions>,
|
|
502
502
|
): Promise<SyncNotesResult>
|
|
503
503
|
|
|
504
504
|
function syncFiles(
|
|
@@ -548,7 +548,7 @@ But in general, a better solution would be to give them a common parent director
|
|
|
548
548
|
|
|
549
549
|
```sh
|
|
550
550
|
# Move to a common parent
|
|
551
|
-
mv ./important-cards ~/cards/
|
|
551
|
+
mv ./important-cards ~/cards/important-cards
|
|
552
552
|
mv ./more-important-cards ~/cards/more-important-cards
|
|
553
553
|
|
|
554
554
|
# Sync the parent
|
|
@@ -608,9 +608,9 @@ The Yanki TypeScript / JavaScript library is isomorphic, so you can run it in a
|
|
|
608
608
|
|
|
609
609
|
There's one exception, the `syncFiles(...)` function, which by default relies on file system access to work.
|
|
610
610
|
|
|
611
|
-
To retain `syncFiles(...)`'s utility in a browser environment,
|
|
611
|
+
To retain `syncFiles(...)`'s utility in a browser environment, it accepts an optional `fileAdapter` argument providing implementations of `readFile`, `readFileBuffer`, `rename`, `stat`, and `writeFile`, which are implemented via `node:fs/promises` by default in Node environments.
|
|
612
612
|
|
|
613
|
-
Running Yanki in a browser environment requires implementing and passing
|
|
613
|
+
Running Yanki in a browser environment requires implementing and passing a `fileAdapter` with these five functions to `syncFiles(...)`, suited to your particular use case. (A warning will be provided if you neglect to do so.)
|
|
614
614
|
|
|
615
615
|
The rest of the library should work fine in both contexts without special measures.
|
|
616
616
|
|
|
@@ -641,7 +641,7 @@ Linux testing was performed with Debian 12 and Ubuntu 22, both running on an arm
|
|
|
641
641
|
|
|
642
642
|
- Intra-note links _do not update_ after automatic renaming, e.g. via the `--manage-filenames` flag, potentially resulting in broken links.
|
|
643
643
|
|
|
644
|
-
- Removing one
|
|
644
|
+
- Removing one or more clozes from a note with multiple clozes can result in empty cards after syncing. The only way around this is to run the "Tools → Empty Cards..." command from Anki desktop application menu bar.
|
|
645
645
|
|
|
646
646
|
- The Anki application lets you split the cards from a single note across multiple decks. (E.g. you might have a card with dozens of clozes, some of which you want to study under a different deck.) Yanki does _not_ support this scenario in the notes / cards it manages — it maintains a strict hierarchical relationship in which a note and its cards always live in a single deck. Notes may be deleted / recreated and study progress might be lost if this is attempted.
|
|
647
647
|
|
package/dist/.DS_Store
DELETED
|
Binary file
|