dsh-deeptutor 0.2.0 → 0.2.1
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.
|
@@ -360,13 +360,22 @@ function main() {
|
|
|
360
360
|
fail(`template.html not found (looked in: ${templateCandidates.join(", ")})`);
|
|
361
361
|
}
|
|
362
362
|
let template = fs.readFileSync(templatePath, "utf8");
|
|
363
|
-
template
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
363
|
+
// One pass over the template with a replacer function: the inserted text is
|
|
364
|
+
// used verbatim (a replacement *string* would expand `$$`, `$&`, `` $` ``,
|
|
365
|
+
// `$'`), and text already inserted (e.g. a literal `{{TOC}}` in the body)
|
|
366
|
+
// is never scanned for placeholders again.
|
|
367
|
+
const values = {
|
|
368
|
+
TITLE: esc(title),
|
|
369
|
+
BODY: html,
|
|
370
|
+
TOC: tocHtml,
|
|
371
|
+
THEME: opts.theme,
|
|
372
|
+
LANG: opts.lang,
|
|
373
|
+
GENERATED: generated,
|
|
374
|
+
};
|
|
375
|
+
template = template.replace(
|
|
376
|
+
/\{\{(TITLE|BODY|TOC|THEME|LANG|GENERATED)\}\}/g,
|
|
377
|
+
(_, key) => values[key],
|
|
378
|
+
);
|
|
370
379
|
|
|
371
380
|
if (opts.out) {
|
|
372
381
|
fs.writeFileSync(opts.out, template, "utf8");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-deeptutor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Learning assistant extension for DeepSeek Harness (dsh): DeepTutor tutoring for your agent — deep explanations, self-test questions, learning paths, personal knowledge-base search (RAG), and note archiving (drives the DeepTutor CLI locally or over SSH).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
package/scripts/md-to-html.js
CHANGED
|
@@ -360,13 +360,22 @@ function main() {
|
|
|
360
360
|
fail(`template.html not found (looked in: ${templateCandidates.join(", ")})`);
|
|
361
361
|
}
|
|
362
362
|
let template = fs.readFileSync(templatePath, "utf8");
|
|
363
|
-
template
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
363
|
+
// One pass over the template with a replacer function: the inserted text is
|
|
364
|
+
// used verbatim (a replacement *string* would expand `$$`, `$&`, `` $` ``,
|
|
365
|
+
// `$'`), and text already inserted (e.g. a literal `{{TOC}}` in the body)
|
|
366
|
+
// is never scanned for placeholders again.
|
|
367
|
+
const values = {
|
|
368
|
+
TITLE: esc(title),
|
|
369
|
+
BODY: html,
|
|
370
|
+
TOC: tocHtml,
|
|
371
|
+
THEME: opts.theme,
|
|
372
|
+
LANG: opts.lang,
|
|
373
|
+
GENERATED: generated,
|
|
374
|
+
};
|
|
375
|
+
template = template.replace(
|
|
376
|
+
/\{\{(TITLE|BODY|TOC|THEME|LANG|GENERATED)\}\}/g,
|
|
377
|
+
(_, key) => values[key],
|
|
378
|
+
);
|
|
370
379
|
|
|
371
380
|
if (opts.out) {
|
|
372
381
|
fs.writeFileSync(opts.out, template, "utf8");
|