Go back to own version of markdown

pull/80/head
Zef Hemel 2022-09-14 08:48:14 +02:00
parent c80342417c
commit 2d51b2d4c2
7 changed files with 19 additions and 8 deletions

View File

@ -1,3 +1,6 @@
// Changes made to this file:
// - ignore language facet stuff, always assume markdown
import {
StateCommand,
Text,

View File

@ -1,3 +1,6 @@
// Local changes made to this file:
// * Disable HTML tags
import { Prec } from "@codemirror/state";
import { KeyBinding, keymap } from "@codemirror/view";
import {
@ -6,7 +9,7 @@ import {
LanguageDescription,
} from "@codemirror/language";
import { MarkdownExtension, MarkdownParser, parseCode } from "@lezer/markdown";
import { html } from "@codemirror/lang-html";
// import { html } from "@codemirror/lang-html";
import {
commonmarkLanguage,
markdownLanguage,
@ -30,7 +33,7 @@ export const markdownKeymap: readonly KeyBinding[] = [
{ key: "Backspace", run: deleteMarkupBackward },
];
const htmlNoMatch = html({ matchClosingTags: false });
// const htmlNoMatch = html({ matchClosingTags: false });
/// Markdown language support.
export function markdown(
@ -70,7 +73,8 @@ export function markdown(
"Base parser provided to `markdown` should be a Markdown parser"
);
let extensions = config.extensions ? [config.extensions] : [];
let support = [htmlNoMatch.support],
// let support = [htmlNoMatch.support],
let support = [],
defaultCode;
if (defaultCodeLanguage instanceof LanguageSupport) {
support.push(defaultCodeLanguage.support);
@ -83,7 +87,7 @@ export function markdown(
? getCodeParser(codeLanguages, defaultCode)
: undefined;
extensions.push(
parseCode({ codeParser, htmlParser: htmlNoMatch.language.parser })
parseCode({ codeParser }) //, htmlParser: htmlNoMatch.language.parser })
);
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
return new LanguageSupport(mkLang(parser.configure(extensions)), support);

View File

@ -8,7 +8,7 @@ import {
Table,
TaskList,
} from "@lezer/markdown";
import { markdown } from "@codemirror/lang-markdown";
import { markdown } from "./markdown";
import * as ct from "./customtags";
import {
Language,

View File

@ -1,5 +1,6 @@
import { SysCallMapping } from "@plugos/plugos/system";
import type { ExpressServer } from "../express_server";
import { version } from "../package.json";
export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
return {
@ -17,5 +18,8 @@ export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
"system.reloadPlugs": async () => {
return expressServer.reloadPlugs();
},
"system.getVersion": async () => {
return version;
},
};
}

View File

@ -28,7 +28,7 @@ import { CommandPalette } from "./components/command_palette";
import { PageNavigator } from "./components/page_navigator";
import { TopBar } from "./components/top_bar";
import { lineWrapper } from "./line_wrapper";
import { markdown } from "@codemirror/lang-markdown";
import { markdown } from "@silverbulletmd/common/markdown";
import { PathPageNavigator } from "./navigator";
import buildMarkdown from "@silverbulletmd/common/parser";
import reducer from "./reducer";
@ -414,7 +414,7 @@ export class Editor {
extensions: [
markdown({
base: buildMarkdown(this.mdExtensions),
addKeymap: true,
// addKeymap: true,
}),
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
autocompletion({

View File

@ -1,6 +1,6 @@
import { SysCallMapping } from "@plugos/plugos/system";
import type { Editor } from "../editor";
import { AppCommand, CommandDef } from "../hooks/command";
import { CommandDef } from "../hooks/command";
import { version } from "../package.json";
export function systemSyscalls(editor: Editor): SysCallMapping {