Release RuneStone 0.1.3 and expand plugin plans

This commit is contained in:
Knotty Wyvern
2026-10-03 04:23:45 -07:00
parent 43106ed9c7
commit 0268c5c9f0
44 changed files with 247 additions and 53 deletions
+4 -22
View File
@@ -2,8 +2,9 @@
import { untrack } from "svelte";
import { Compartment, EditorState } from "@codemirror/state";
import { EditorView, drawSelection, keymap } from "@codemirror/view";
import { defaultKeymap, history, historyField, historyKeymap, isolateHistory } from "@codemirror/commands";
import { defaultKeymap, history, historyField, historyKeymap, indentWithTab, isolateHistory } from "@codemirror/commands";
import { markdown, markdownLanguage } from "@codemirror/lang-markdown";
import { noteFormats } from "./noteFormats";
import { searchKeymap } from "@codemirror/search";
import { writerSearch } from "./writerSearch";
import type { OpenBuffer } from "$lib/workspace/types";
@@ -135,26 +136,7 @@
model.pushStackElement();
const extensions = [
EditorState.lineSeparator.of(model.getEOL()),
markdown({ base: markdownLanguage, extensions: [{
defineNodes: ["NoteHighlight", "NoteMath", "NoteComment", "NoteFormatMark"],
parseInline: [{ name: "NoteFormats", before: "Emphasis", parse(context, next, position) {
const marker = next === 61 ? "==" : next === 37 ? "%%" : next === 36 ? "$" : "";
if (!marker || context.slice(position, position + marker.length) !== marker) return -1;
if (marker === "$" && (context.char(position + 1) === 36 || context.char(position - 1) === 36)) return -1;
let end = position + marker.length;
for (; end < context.end; end++) {
if (context.char(end) === 92) { end++; continue; }
if (context.slice(end, end + marker.length) === marker) break;
}
if (end >= context.end || end === position + marker.length) return -1;
const kind = marker === "==" ? "NoteHighlight" : marker === "$" ? "NoteMath" : "NoteComment";
const children = marker === "==" ? context.parser.parseInline(context.slice(position + marker.length, end), position + marker.length) : [];
return context.addElement(context.elt(kind, position, end + marker.length, [
context.elt("NoteFormatMark", position, position + marker.length), ...children,
context.elt("NoteFormatMark", end, end + marker.length),
]));
} }],
}] }),
markdown({ base: markdownLanguage, extensions: [noteFormats] }),
// Rich cell serialization can change delimiters away from the caret.
// Keep a burst of typing together even when those source edits aren't adjacent.
history({ joinToEvent: (transaction, adjacent) => adjacent || transaction.isUserEvent("input.type.table") }), drawSelection(),
@@ -164,7 +146,7 @@
keymap.of([{ key: "Escape", run: view => {
if (!view.state.field(imageSource)) return false;
view.dispatch({ effects: editImageSource.of(null) }); return true;
} }, ...searchKeymap, ...historyKeymap, ...defaultKeymap]), EditorView.lineWrapping,
} }, indentWithTab, ...searchKeymap, ...historyKeymap, ...defaultKeymap]), EditorView.lineWrapping,
liveMarkdown(urls, untrack(() => tableActions), {
open: image => onOpenLink?.(image.dataset.mdKind === "wiki" ? "wiki" : "md", image.dataset.mdSrc || ""),
reveal: async image => {