1
0

Auto add closing `

This commit is contained in:
Zef Hemel 2023-07-12 11:15:28 +02:00
parent b615ccdff7
commit 77af9e0257

View File

@ -136,6 +136,7 @@ import { syncSyscalls } from "./syscalls/sync.ts";
import { FilteredSpacePrimitives } from "../common/spaces/filtered_space_primitives.ts"; import { FilteredSpacePrimitives } from "../common/spaces/filtered_space_primitives.ts";
import { run } from "../plug-api/plugos-syscall/shell.ts"; import { run } from "../plug-api/plugos-syscall/shell.ts";
import { isValidPageName } from "$sb/lib/page.ts"; import { isValidPageName } from "$sb/lib/page.ts";
import { markdownLanguage } from "https://esm.sh/v128/@codemirror/lang-markdown@6.1.1/X-ZS9AY29kZW1pcnJvci9sYW5nLWh0bWwsQGNvZGVtaXJyb3IvbGFuZ3VhZ2UsQGNvZGVtaXJyb3Ivc3RhdGUsQGNvZGVtaXJyb3IvdmlldyxAbGV6ZXIvY29tbW9uLEBsZXplci9oaWdobGlnaHQsQGxlemVyL21hcmtkb3du/dist/index.js";
const frontMatterRegex = /^---\n(([^\n]|\n)*?)---\n/; const frontMatterRegex = /^---\n(([^\n]|\n)*?)---\n/;
@ -728,6 +729,8 @@ export class Editor {
const editor = this; const editor = this;
let touchCount = 0; let touchCount = 0;
const markdownLanguage = buildMarkdown(this.mdExtensions);
return EditorState.create({ return EditorState.create({
doc: text, doc: text,
extensions: [ extensions: [
@ -742,7 +745,7 @@ export class Editor {
], ],
// The uber markdown mode // The uber markdown mode
markdown({ markdown({
base: buildMarkdown(this.mdExtensions), base: markdownLanguage,
codeLanguages: [ codeLanguages: [
LanguageDescription.of({ LanguageDescription.of({
name: "yaml", name: "yaml",
@ -878,6 +881,9 @@ export class Editor {
], ],
addKeymap: true, addKeymap: true,
}), }),
markdownLanguage.data.of({
closeBrackets: { brackets: ["(", "{", "[", "`"] },
}),
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)), syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
autocompletion({ autocompletion({
override: [ override: [