yanki 2.0.6 → 2.0.7
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 +52 -52
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +28 -19
- package/dist/standalone/index.d.ts +8 -8
- package/dist/standalone/index.js +75 -75
- package/package.json +3 -2
- package/readme.md +13 -13
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yanki",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "A CLI tool and TypeScript library to turn Markdown into Anki flashcards.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anki",
|
|
7
7
|
"flashcards",
|
|
8
8
|
"spaced-repetition",
|
|
9
9
|
"anki-connect",
|
|
10
|
+
"ankiconnect",
|
|
10
11
|
"markdown",
|
|
11
12
|
"cli",
|
|
12
13
|
"sync",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"unist-util-visit": "^5.1.0",
|
|
100
101
|
"untildify": "^6.0.0",
|
|
101
102
|
"yaml": "^2.9.0",
|
|
102
|
-
"yanki-connect": "^4.0.
|
|
103
|
+
"yanki-connect": "^4.0.4",
|
|
103
104
|
"yargs": "^18.0.0"
|
|
104
105
|
},
|
|
105
106
|
"devDependencies": {
|
package/readme.md
CHANGED
|
@@ -60,7 +60,7 @@ The "Y" prefix in "Yanki" is in the "Yet another" naming tradition; a nod to Ank
|
|
|
60
60
|
|
|
61
61
|
Install [Node.js](https://nodejs.org) if you haven't already. (Yanki requires Node 20.11 or newer.)
|
|
62
62
|
|
|
63
|
-
Assuming you have a folder of Markdown note files, the [Anki app](https://apps.ankiweb.net) is open and has the [
|
|
63
|
+
Assuming you have a folder of Markdown note files, the [Anki app](https://apps.ankiweb.net) is open and has the [AnkiConnect](https://ankiweb.net/shared/info/2055492159) add-on installed:
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
66
|
npx yanki ./folder-of-markdown
|
|
@@ -299,13 +299,13 @@ _Linux users should note that the Flatpak / Flathub version of Anki is not recom
|
|
|
299
299
|
#### Prerequisites:
|
|
300
300
|
|
|
301
301
|
- The [Anki desktop app](https://apps.ankiweb.net)
|
|
302
|
-
- The [
|
|
302
|
+
- The [AnkiConnect](https://ankiweb.net/shared/info/2055492159) add-on
|
|
303
303
|
|
|
304
|
-
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
|
|
304
|
+
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 AnkiConnect.
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
AnkiConnect may ask for your permission in the Anki application to allow the connection on the first sync.
|
|
307
307
|
|
|
308
|
-
If the automatic permission request fails, you might need to configure
|
|
308
|
+
If the automatic permission request fails, you might need to configure AnkiConnect to accept connections from your origin.
|
|
309
309
|
|
|
310
310
|
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.
|
|
311
311
|
|
|
@@ -337,7 +337,7 @@ npm install --save-dev yanki
|
|
|
337
337
|
|
|
338
338
|
Create a folder of Markdown files that you'd like to use as Anki notes. (See the [section on Markdown notes](#markdown-note-types) for details on how to structure your document to create different card types in Anki.)
|
|
339
339
|
|
|
340
|
-
Launch the Anki desktop app. Ensure that the [
|
|
340
|
+
Launch the Anki desktop app. Ensure that the [AnkiConnect](https://ankiweb.net/shared/info/2055492159) add-on is installed and set up.
|
|
341
341
|
|
|
342
342
|
#### Create
|
|
343
343
|
|
|
@@ -404,7 +404,7 @@ yanki sync <directory> [options]
|
|
|
404
404
|
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ------------------------- |
|
|
405
405
|
| `--dry-run`<br>`-d` | Run without making any changes to the Anki database. See a report of what would have been done. | `boolean` | `false` |
|
|
406
406
|
| `--namespace`<br>`-n` | Advanced option for managing multiple Yanki synchronization groups. Case insensitive. See the readme for more information. | `string` | `"Yanki"` |
|
|
407
|
-
| `--anki-connect` | Host and port of the
|
|
407
|
+
| `--anki-connect` | Host and port of the AnkiConnect server. The default is usually fine. See the AnkiConnect documentation for more information. | `string` | `"http://127.0.0.1:8765"` |
|
|
408
408
|
| `--anki-auto-launch`<br>`-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
|
|
409
409
|
| `--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` |
|
|
410
410
|
| `--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"` |
|
|
@@ -431,7 +431,7 @@ yanki list [options]
|
|
|
431
431
|
| Option | Description | Type | Default |
|
|
432
432
|
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------- |
|
|
433
433
|
| `--namespace`<br>`-n` | Advanced option to list notes in a specific namespace. Case insensitive. Notes from the default internal namespace are listed by default. Pass `'*'` to list all Yanki-created notes in the Anki database. | `string` | `"Yanki"` |
|
|
434
|
-
| `--anki-connect` | Host and port of the
|
|
434
|
+
| `--anki-connect` | Host and port of the AnkiConnect server. The default is usually fine. See the AnkiConnect documentation for more information. | `string` | `"http://127.0.0.1:8765"` |
|
|
435
435
|
| `--anki-auto-launch`<br>`-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
|
|
436
436
|
| `--json` | Output the list of notes as JSON to stdout. | `boolean` | `false` |
|
|
437
437
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
@@ -451,7 +451,7 @@ yanki delete [options]
|
|
|
451
451
|
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------- |
|
|
452
452
|
| `--dry-run`<br>`-d` | Run without making any changes to the Anki database. See a report of what would have been done. | `boolean` | `false` |
|
|
453
453
|
| `--namespace`<br>`-n` | Advanced option to list notes in a specific namespace. Case insensitive. Notes from the default internal namespace are listed by default. If you've synced notes to multiple namespaces, Pass `'*'` to delete all Yanki-created notes in the Anki database. | `string` | `"Yanki"` |
|
|
454
|
-
| `--anki-connect` | Host and port of the
|
|
454
|
+
| `--anki-connect` | Host and port of the AnkiConnect server. The default is usually fine. See the AnkiConnect documentation for more information. | `string` | `"http://127.0.0.1:8765"` |
|
|
455
455
|
| `--anki-auto-launch`<br>`-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
|
|
456
456
|
| `--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` |
|
|
457
457
|
| `--json` | Output the list of deleted notes as JSON to stdout. | `boolean` | `false` |
|
|
@@ -473,7 +473,7 @@ yanki style [options]
|
|
|
473
473
|
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------- |
|
|
474
474
|
| `--dry-run`<br>`-d` | Run without making any changes to the Anki database. See a report of what would have been done. | `boolean` | `false` |
|
|
475
475
|
| `--css`<br>`-c` | Path to the CSS stylesheet to set for all Yanki-created notes. If not provided, the default Anki stylesheet is used. | `string` | |
|
|
476
|
-
| `--anki-connect` | Host and port of the
|
|
476
|
+
| `--anki-connect` | Host and port of the AnkiConnect server. The default is usually fine. See the AnkiConnect documentation for more information. | `string` | `"http://127.0.0.1:8765"` |
|
|
477
477
|
| `--anki-auto-launch`<br>`-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
|
|
478
478
|
| `--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` |
|
|
479
479
|
| `--json` | Output the list of updated note types / models as JSON to stdout. | `boolean` | `false` |
|
|
@@ -621,9 +621,9 @@ The rest of the library should work fine in both contexts without special measur
|
|
|
621
621
|
|
|
622
622
|
The excellent [unified](https://unifiedjs.com) / [remark](https://remark.js.org) / [rehype](https://github.com/rehypejs/rehype) libraries are used extensively to traverse and render the underlying Markdown ASTs.
|
|
623
623
|
|
|
624
|
-
[
|
|
624
|
+
[AnkiConnect](https://ankiweb.net/shared/info/2055492159) provides access to Anki's database.
|
|
625
625
|
|
|
626
|
-
For type safety, access to
|
|
626
|
+
For type safety, access to AnkiConnect is managed through my wrapper library, [yanki-connect](https://github.com/kitschpatrol/yanki-connect).
|
|
627
627
|
|
|
628
628
|
Behind the scenes, Yanki creates new note type models to match the four default Anki types. It keeps track of the notes it has ownership of via a hidden `YankiNamespace` field in each note.
|
|
629
629
|
|
|
@@ -652,7 +652,7 @@ Linux testing was performed with Debian 12 and Ubuntu 22, both running on an arm
|
|
|
652
652
|
|
|
653
653
|
## Acknowledgments
|
|
654
654
|
|
|
655
|
-
Thanks to Alex Yatskov for creating [
|
|
655
|
+
Thanks to Alex Yatskov for creating [AnkiConnect](https://ankiweb.net/shared/info/2055492159).
|
|
656
656
|
|
|
657
657
|
Thanks to the [unified team](https://github.com/orgs/unifiedjs/people) for their superb ecosystem of AST tools.
|
|
658
658
|
|