yanki 0.2.4 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yanki",
3
- "version": "0.2.4",
3
+ "version": "0.3.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": {
@@ -64,6 +64,8 @@
64
64
  "@shikijs/rehype": "^1.6.4",
65
65
  "bumpp": "^9.4.1",
66
66
  "deepmerge-ts": "^7.0.3",
67
+ "filenamify": "^6.0.0",
68
+ "nanoid": "^5.0.7",
67
69
  "path-browserify-esm": "^1.0.4",
68
70
  "pkgroll": "^2.1.1",
69
71
  "plur": "^5.1.0",
@@ -82,14 +84,14 @@
82
84
  "remark-wiki-link": "^2.0.1",
83
85
  "sort-keys": "^5.0.0",
84
86
  "string-strip-html": "^13.4.8",
85
- "tsx": "^4.15.3",
87
+ "tsx": "^4.15.4",
86
88
  "type-fest": "^4.20.0",
87
89
  "typescript": "^5.4.5",
88
90
  "unified": "^11.0.4",
89
91
  "unist-builder": "^4.0.0",
90
92
  "unist-util-visit": "^5.0.0",
91
93
  "untildify": "^5.0.0",
92
- "vite": "^5.2.13",
94
+ "vite": "^5.3.0",
93
95
  "vitest": "^1.6.0",
94
96
  "yaml": "^2.4.5",
95
97
  "yanki-connect": "^1.0.4"
package/readme.md CHANGED
@@ -127,6 +127,14 @@ An extended palette of markdown syntax is available out of the box:
127
127
 
128
128
  Yanki uses Anki's built-in CSS stylesheet to style cards by default, but it makes it simple to set a custom stylesheet for all of your Yanki-managed notes without having to go on a click-quest in the Anki user interface.
129
129
 
130
+ ### Filename management
131
+
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
+
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
+
136
+ Edge cases are carefully managed to ensure that there's always _some kind_ of best-effort semantically valuable file name assigned.
137
+
130
138
  ## Markdown note types
131
139
 
132
140
  Yanki automatically infers the _type_ of Note you'd like to create in Anki based on the presence or absence of certain element in your Markdown files.
@@ -300,17 +308,19 @@ yanki sync <directory> [options]
300
308
  | ------------------- | ------------------------------------------------------------------------ | -------- |
301
309
  | `directory` | The path to the local directory of Markdown files to sync. _(Required.)_ | `string` |
302
310
 
303
- | Option | Alias | Description | Type | Default |
304
- | -------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------- |
305
- | `--dry-run` | `-d` | Run without making any changes to the Anki database. See a report of what would have been done. | `boolean` | `false` |
306
- | `--namespace` | `-n` | Advanced option for managing multiple Yanki synchronization groups. Case insensitive. See the readme for more information. | `string` | `"Yanki"` |
307
- | `--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"` |
308
- | `--anki-auto-launch` | `-l` | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
309
- | `--anki-web` | `-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` |
310
- | `--json` | | Output the sync report as JSON. | `boolean` | `false` |
311
- | `--verbose` | | Enable verbose logging. | `boolean` | `false` |
312
- | `--help` | `-h` | Show help | `boolean` | |
313
- | `--version` | `-v` | Show version number | `boolean` | |
311
+ | Option | Alias | Argument | Description | Type | Default |
312
+ | ----------------------- | ----- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------- |
313
+ | `--dry-run` | `-d` | | Run without making any changes to the Anki database. See a report of what would have been done. | `boolean` | `false` |
314
+ | `--namespace` | `-n` | | Advanced option for managing multiple Yanki synchronization groups. Case insensitive. See the readme for more information. | `string` | `"Yanki"` |
315
+ | `--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"` |
316
+ | `--anki-auto-launch` | `-l` | | Attempt to open the Anki desktop app if it's not already running. (Experimental, macOS only.) | `boolean` | `false` |
317
+ | `--anki-web` | `-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` |
318
+ | `--manage-filenames` | `-m` | | Rename local note files to match their content. Useful if you want to feel 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. | `string` | `"off"` |
319
+ | `--max-filename-length` | | `[number]` | If `manage-filenames` is enabled, this option specifies the maximum length of the filename in characters. | | `60` |
320
+ | `--json` | | | Output the sync report as JSON. | `boolean` | `false` |
321
+ | `--verbose` | | | Enable verbose logging. | `boolean` | `false` |
322
+ | `--help` | `-h` | | Show help | `boolean` | |
323
+ | `--version` | `-v` | | Show version number | `boolean` | |
314
324
 
315
325
  #### Subcommand: `yanki list`
316
326