chalk-talk 0.13.0 → 0.14.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 +1 -1
- package/assets/player.html +3 -3
- package/embed-mermaid.js +1 -1
- package/embed.js +5 -5
- package/kit/SKILL.template.md +55 -0
- package/kit/browser.mjs +181 -0
- package/kit/format.check.ts +22 -0
- package/kit/format.ts +37 -0
- package/kit/page.mjs +15 -0
- package/kit/tools/audit.mjs +42 -0
- package/kit/tools/checks.mjs +67 -0
- package/kit/tools/eval-metrics.mjs +70 -0
- package/kit/tools/gallery.mjs +30 -0
- package/kit/tools/linux-check.mjs +31 -0
- package/kit/tools/vendor.mjs +24 -0
- package/kit/tools/zip.mjs +14 -0
- package/markdown.js +1 -1
- package/mount.global.js +374 -374
- package/mount.js +1 -1
- package/package.json +4 -2
- package/player.js +4 -4
- package/scripts/browser.mjs +1 -1
- package/scripts/build.mjs +17 -5
- package/scripts/contract.mjs +1 -1
- package/scripts/mermaid.mjs +1 -1
- package/scripts/page.mjs +15 -0
package/scripts/page.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Making the one HTML file a skill delivers: a value as JSON that can sit inside a <script> tag, and a page template
|
|
2
|
+
// with its {{KEYS}} filled. Part of the skills kit (chalk-talk/kit): copied into each skill by its tools/assets.mjs.
|
|
3
|
+
|
|
4
|
+
/** `value` as JSON, with "<" escaped so no text in it can end the <script> tag it goes in. */
|
|
5
|
+
export const inline = (value) => JSON.stringify(value).replace(/</g, '\\u003c')
|
|
6
|
+
|
|
7
|
+
/** `template` with each {{KEY}} replaced by its value (a function replacer, so `$` in a value is kept as it is). */
|
|
8
|
+
export function fill(template, values) {
|
|
9
|
+
let page = template
|
|
10
|
+
for (const [key, value] of Object.entries(values)) {
|
|
11
|
+
if (!page.includes(`{{${key}}}`)) throw new Error(`The page has no {{${key}}} to fill.`)
|
|
12
|
+
page = page.replace(`{{${key}}}`, () => value)
|
|
13
|
+
}
|
|
14
|
+
return page
|
|
15
|
+
}
|