chalk-talk 0.7.0 → 0.9.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/README.md +16 -1
- package/assets/player.html +120 -101
- package/embed-mermaid.d.ts +3 -0
- package/embed-mermaid.js +181 -0
- package/embed.d.ts +26 -0
- package/embed.js +127 -0
- package/package.json +47 -7
- package/player.js +127 -108
- package/scripts/build.mjs +42 -11
- package/scripts/contract.mjs +1 -1
- package/scripts/mermaid.mjs +48 -48
package/README.md
CHANGED
|
@@ -10,18 +10,33 @@ Hand-drawn lessons that draw themselves, from a small JSON **recipe** — the pl
|
|
|
10
10
|
<meta charset="utf-8">
|
|
11
11
|
<title>My lesson</title>
|
|
12
12
|
<script type="application/json" id="chalk-recipe">{ "id": "my-lesson", "title": "…", "width": 900, "height": 560, "steps": [ … ] }</script>
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/chalk-talk@0.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/chalk-talk@0.9.0/player.js"></script>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The player builds the page around the recipe — chapters, Next / Back, values to move, the check, downloads — and needs
|
|
17
17
|
nothing else. A course is `{ "course": "Title", "lessons": [recipe, recipe, …] }`, each lesson opened with
|
|
18
18
|
`?lesson=n`.
|
|
19
19
|
|
|
20
|
+
## Inside an element (a note, a docs page, an app)
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { mountLesson, readRecipe } from 'chalk-talk/embed'
|
|
24
|
+
|
|
25
|
+
const lesson = await mountLesson(element, readRecipe(text), { compact: true })
|
|
26
|
+
// … later: lesson.destroy()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`readRecipe` takes the text syntax or JSON (a mistake in the text says its line: `ChalkTextError`). `compact` is the
|
|
30
|
+
lesson for a note: chapters, Values and Expand on top, the bar below, opening on chapter 1 drawn and still. Several
|
|
31
|
+
lessons can share a page. A Mermaid flowchart: `readMermaid(text)` from `chalk-talk/embed-mermaid` (apart, as it carries
|
|
32
|
+
Mermaid).
|
|
33
|
+
|
|
20
34
|
## From the command line
|
|
21
35
|
|
|
22
36
|
```
|
|
23
37
|
npx chalk-talk lesson.json # checks the recipe and writes lesson.html
|
|
24
38
|
npx chalk-talk one.json two.json --out course.html --title "The course"
|
|
39
|
+
npx chalk-talk lesson.chalk --svg # an SVG that draws itself, for a README on GitHub
|
|
25
40
|
```
|
|
26
41
|
|
|
27
42
|
It checks the recipe contract, builds one HTML file that opens offline and, when Chrome, Chromium or Edge is
|