RuneStone 1.0.0

This commit is contained in:
Knotty Wyvern
2026-11-03 00:23:07 -07:00
commit 5557443ed1
818 changed files with 239368 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import assert from "node:assert/strict";
import test from "node:test";
import { externalLinkText, workspaceLinkText } from "../../../src/lib/editor/linkCommands.ts";
import { linkCandidates } from "../../../src/lib/workspace/markdownLinks.ts";
test("external links prepare editable syntax with the cursor in the missing field", () => {
const empty = externalLinkText("", { from: 0, to: 0 });
assert.equal(empty.insert, "[]()");
assert.equal(empty.anchor, 1);
assert.equal(empty.head, 1);
const selected = externalLinkText("before [label] after", { from: 7, to: 14 });
assert.equal(selected.insert, "[\\[label\\]]()");
assert.equal(selected.anchor - selected.from, selected.insert.length - 1);
assert.equal(selected.anchor, selected.head);
});
test("workspace links retain the selected label and the exact workspace path", () => {
assert.equal(workspaceLinkText("", { from: 0, to: 0 }, "notes/Same name.md").insert, "[[/notes/Same%20name.md]]");
const edit = workspaceLinkText("before visible\nlabel after", { from: 7, to: 20 }, "nested/target.md");
assert.equal(edit.insert, "[[/nested/target.md|visible label]]");
assert.equal(edit.anchor, 7);
assert.equal(edit.head, 7 + edit.insert.length);
});
test("workspace link paths preserve spaces, brackets, hashes and literal percent signs", () => {
const path = "notes/Nested/[A] #50%.md";
const edit = workspaceLinkText("", { from: 0, to: 0 }, path);
const target = edit.insert.slice(2, -2);
assert.equal(target, "/notes/Nested/%5BA%5D%20%2350%25.md");
assert.deepEqual(linkCandidates("notes/current.md", target, "wiki"), [path]);
});