@riebeckite/plugin-flashcards 0.0.31 → 0.0.33
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/README.md +12 -3
- package/README_ja.md +18 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -3
- package/dist/src/remark.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -27,11 +27,11 @@ and replaces them with an interactive deck.
|
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
29
|
import { defineConfig } from "@riebeckite/core";
|
|
30
|
-
import {
|
|
30
|
+
import { flashcards } from "@riebeckite/plugin-flashcards";
|
|
31
31
|
|
|
32
32
|
export default defineConfig({
|
|
33
33
|
// ...
|
|
34
|
-
plugins: [
|
|
34
|
+
plugins: [flashcards()],
|
|
35
35
|
});
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -58,6 +58,15 @@ It stays readable without JavaScript.
|
|
|
58
58
|
A block with no cards, a card without `::`, or a card with an empty side is
|
|
59
59
|
reported as a diagnostic (`invalid-flashcards`) and left as a code block.
|
|
60
60
|
|
|
61
|
+
## Live example
|
|
62
|
+
|
|
63
|
+
~~~flashcards
|
|
64
|
+
What is Riebeckite? :: A tool that builds a static site from Markdown
|
|
65
|
+
What is the unit of publishing? :: A note
|
|
66
|
+
~~~
|
|
67
|
+
|
|
68
|
+
Without JavaScript the cards remain readable as a static list.
|
|
69
|
+
|
|
61
70
|
## Output
|
|
62
71
|
|
|
63
72
|
At build time the block becomes
|
|
@@ -106,7 +115,7 @@ untouched. No options are passed from the build to the client; the deck reads
|
|
|
106
115
|
|
|
107
116
|
## Exports
|
|
108
117
|
|
|
109
|
-
- `flashcards(options?)` / `
|
|
118
|
+
- `flashcards(options?)` / `flashcards(options?)` — plugin factory
|
|
110
119
|
- `initFlashcards(root?)` — client initializer
|
|
111
120
|
- `parseFlashcards(source)` — parse a block into cards
|
|
112
121
|
- `splitFlashcardGroups(source)` — split a block into card groups
|
package/README_ja.md
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated from docs/docs/plugins/flashcards.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
4
|
|
|
5
|
-
`flashcards`
|
|
5
|
+
`flashcards` コードブロックを学習用のカードデッキに変えるプラグインです。質問を表示し、カードをめくって答えを確認できます。前後の移動とシャッフルにも対応します。ビルド時には静的なリストを先に出力するため、JavaScript がなくても内容を読めます。
|
|
6
6
|
|
|
7
7
|
[English](./README.md)
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 設定
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
import { defineConfig } from "@riebeckite/core";
|
|
13
|
-
import {
|
|
13
|
+
import { flashcards } from "@riebeckite/plugin-flashcards";
|
|
14
14
|
|
|
15
15
|
export default defineConfig({
|
|
16
16
|
// ...
|
|
17
|
-
plugins: [
|
|
17
|
+
plugins: [flashcards()],
|
|
18
18
|
});
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -35,7 +35,16 @@ It stays readable without JavaScript.
|
|
|
35
35
|
```
|
|
36
36
|
````
|
|
37
37
|
|
|
38
|
-
カードが 1
|
|
38
|
+
カードが 1 枚もない場合や、`::` のないカード、どちらかの側が空のカードがある場合は、`invalid-flashcards` の診断を出してコードブロックのまま残します。
|
|
39
|
+
|
|
40
|
+
## 実行例
|
|
41
|
+
|
|
42
|
+
~~~flashcards
|
|
43
|
+
Riebeckite とは? :: Markdown から静的サイトを作るツール
|
|
44
|
+
公開の単位は? :: ノート
|
|
45
|
+
~~~
|
|
46
|
+
|
|
47
|
+
JavaScript がなくても、カードは静的なリストとして読めます。
|
|
39
48
|
|
|
40
49
|
## 出力
|
|
41
50
|
|
|
@@ -55,11 +64,11 @@ It stays readable without JavaScript.
|
|
|
55
64
|
</div>
|
|
56
65
|
```
|
|
57
66
|
|
|
58
|
-
|
|
67
|
+
ペイロードは実行されない JSON で、`<` `>` `&` はエスケープ済みです。カードの文言にこれらの文字が含まれていても script 要素を閉じることはできません。順序付きリストは JavaScript がない場合の代替表示です。
|
|
59
68
|
|
|
60
69
|
## クライアントの動作
|
|
61
70
|
|
|
62
|
-
`initFlashcards()` は各 `[data-flashcards]`
|
|
71
|
+
`initFlashcards()` は各 `[data-flashcards]` 要素のペイロードを読み、代替リストの上に操作できるデッキを組み立てます。対応している操作は次のとおりです。
|
|
63
72
|
|
|
64
73
|
- 答えの表示・非表示
|
|
65
74
|
- 前後のカードへの移動(端で折り返す)
|
|
@@ -67,7 +76,7 @@ payload は実行されない JSON で、`<` `>` `&` はエスケープ済みで
|
|
|
67
76
|
- カード位置の表示
|
|
68
77
|
- キーボード操作: `Space` で答えを表示、`ArrowLeft` / `ArrowRight` で移動
|
|
69
78
|
|
|
70
|
-
成功するとルートに `data-flashcards="ready"`
|
|
79
|
+
成功するとルートに `data-flashcards="ready"` が付き、静的なリストは非表示になります。ペイロードがない、または壊れている場合は代替表示をそのまま残します。ビルドからクライアントへオプションは渡しません。シャッフルの初期状態は `data-flashcards-shuffle` 属性で伝えます。
|
|
71
80
|
|
|
72
81
|
## オプション
|
|
73
82
|
|
|
@@ -80,7 +89,7 @@ payload は実行されない JSON で、`<` `>` `&` はエスケープ済みで
|
|
|
80
89
|
|
|
81
90
|
## 主なエクスポート
|
|
82
91
|
|
|
83
|
-
- `flashcards(options?)` / `
|
|
92
|
+
- `flashcards(options?)` / `flashcards(options?)`: プラグインを作成する
|
|
84
93
|
- `initFlashcards(root?)`: クライアント側を初期化する
|
|
85
94
|
- `parseFlashcards(source)`: ブロックをカードに分解する
|
|
86
95
|
- `splitFlashcardGroups(source)`: ブロックをカードのまとまりに分割する
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export type { FlashcardsRuntime } from "./src/runtime.js";
|
|
|
9
9
|
export { createFlashcardsRuntime } from "./src/runtime.js";
|
|
10
10
|
export type { FlashcardsCard, FlashcardsOptions, FlashcardsParseFailure, FlashcardsParseResult, FlashcardsParseSuccess, FlashcardsPayload, ResolvedFlashcardsOptions, } from "./src/types.js";
|
|
11
11
|
export declare function flashcards(options?: FlashcardsOptions): import("@riebeckite/core").RiebeckitePlugin<FlashcardsOptions>;
|
|
12
|
-
export declare const flashcardsPlugin: typeof flashcards;
|
package/dist/index.js
CHANGED
|
@@ -413,12 +413,14 @@ function flashcards(options = {}) {
|
|
|
413
413
|
createClientEntry(
|
|
414
414
|
"flashcards",
|
|
415
415
|
"@riebeckite/plugin-flashcards/client",
|
|
416
|
-
"initFlashcards"
|
|
416
|
+
"initFlashcards",
|
|
417
|
+
void 0,
|
|
418
|
+
void 0,
|
|
419
|
+
"root"
|
|
417
420
|
)
|
|
418
421
|
]
|
|
419
422
|
});
|
|
420
423
|
}
|
|
421
|
-
var flashcardsPlugin = flashcards;
|
|
422
424
|
function validateFlashcardsOptions(options) {
|
|
423
425
|
if (!options) return [];
|
|
424
426
|
const issues = [];
|
|
@@ -446,7 +448,6 @@ export {
|
|
|
446
448
|
decodeFlashcardsSource,
|
|
447
449
|
encodeFlashcardsSource,
|
|
448
450
|
flashcards,
|
|
449
|
-
flashcardsPlugin,
|
|
450
451
|
initFlashcards,
|
|
451
452
|
parseFlashcards,
|
|
452
453
|
remarkFlashcards,
|
package/dist/src/remark.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Root } from "mdast";
|
|
2
|
-
|
|
3
|
-
export type RemarkFlashcardsOptions = {
|
|
2
|
+
type RemarkFlashcardsOptions = {
|
|
4
3
|
language?: string;
|
|
5
4
|
};
|
|
6
5
|
export declare function remarkFlashcards(options?: RemarkFlashcardsOptions): (tree: Root, file?: unknown) => void;
|
|
6
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-flashcards",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@riebeckite/core": "0.0.33",
|
|
24
25
|
"@types/mdast": "^4.0.4",
|
|
25
|
-
"unist-util-visit": "^5.1.0"
|
|
26
|
-
"@riebeckite/core": "0.0.31"
|
|
26
|
+
"unist-util-visit": "^5.1.0"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|