@zosmaai/pi-llm-wiki 0.12.0 → 0.12.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.
|
@@ -383,7 +383,14 @@ export function serializeKnowledgeDocument(document) {
|
|
|
383
383
|
const body = document.body.replace(/\r\n?/g, "\n").replace(/\n*$/, "");
|
|
384
384
|
return body ? `---\n${yaml}---\n\n${body}\n` : `---\n${yaml}---\n`;
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
const TABLE_ROW = /^\s*\|.*\|\s*$/;
|
|
387
|
+
/** Escape wikilink alias pipes only inside Markdown table rows.
|
|
388
|
+
*
|
|
389
|
+
* A bare `|` inside `[[target|alias]]` would be read as a table cell
|
|
390
|
+
* delimiter when the row renders, so table rows need the pipe escaped as
|
|
391
|
+
* `[[target\|alias]]`. Prose, lists, headings, and fenced code keep their
|
|
392
|
+
* pipes literal, so the written file stays valid for external readers
|
|
393
|
+
* (Obsidian, VS Code Wiki Links) that don't understand the escaped form. */
|
|
387
394
|
function escapeWikilinkAliasPipes(body) {
|
|
388
395
|
let inFence = false;
|
|
389
396
|
return body
|
|
@@ -395,7 +402,9 @@ function escapeWikilinkAliasPipes(body) {
|
|
|
395
402
|
}
|
|
396
403
|
if (inFence)
|
|
397
404
|
return line;
|
|
398
|
-
return
|
|
405
|
+
return TABLE_ROW.test(line)
|
|
406
|
+
? line.replace(/\[\[([^\]\n]*?)(?<!\\)\|([^\]\n]*?)\]\]/g, "[[$1\\|$2]]")
|
|
407
|
+
: line;
|
|
399
408
|
})
|
|
400
409
|
.join("\n");
|
|
401
410
|
}
|
|
@@ -589,7 +589,15 @@ export function serializeKnowledgeDocument(document: KnowledgeDocument): string
|
|
|
589
589
|
return body ? `---\n${yaml}---\n\n${body}\n` : `---\n${yaml}---\n`;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
|
|
592
|
+
const TABLE_ROW = /^\s*\|.*\|\s*$/;
|
|
593
|
+
|
|
594
|
+
/** Escape wikilink alias pipes only inside Markdown table rows.
|
|
595
|
+
*
|
|
596
|
+
* A bare `|` inside `[[target|alias]]` would be read as a table cell
|
|
597
|
+
* delimiter when the row renders, so table rows need the pipe escaped as
|
|
598
|
+
* `[[target\|alias]]`. Prose, lists, headings, and fenced code keep their
|
|
599
|
+
* pipes literal, so the written file stays valid for external readers
|
|
600
|
+
* (Obsidian, VS Code Wiki Links) that don't understand the escaped form. */
|
|
593
601
|
function escapeWikilinkAliasPipes(body: string): string {
|
|
594
602
|
let inFence = false;
|
|
595
603
|
return body
|
|
@@ -600,7 +608,9 @@ function escapeWikilinkAliasPipes(body: string): string {
|
|
|
600
608
|
return line;
|
|
601
609
|
}
|
|
602
610
|
if (inFence) return line;
|
|
603
|
-
return
|
|
611
|
+
return TABLE_ROW.test(line)
|
|
612
|
+
? line.replace(/\[\[([^\]\n]*?)(?<!\\)\|([^\]\n]*?)\]\]/g, "[[$1\\|$2]]")
|
|
613
|
+
: line;
|
|
604
614
|
})
|
|
605
615
|
.join("\n");
|
|
606
616
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zosmaai/pi-llm-wiki",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Self-maintaining LLM Wiki for Pi — Karpathy-pattern knowledge base with immutable source capture, automated ingestion, search, linting, and Obsidian-compatible vault. auto-updating personal & company wiki.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|