Go back to own version of markdown
parent
c80342417c
commit
2d51b2d4c2
|
@ -1,3 +1,6 @@
|
||||||
|
// Changes made to this file:
|
||||||
|
// - ignore language facet stuff, always assume markdown
|
||||||
|
|
||||||
import {
|
import {
|
||||||
StateCommand,
|
StateCommand,
|
||||||
Text,
|
Text,
|
|
@ -1,3 +1,6 @@
|
||||||
|
// Local changes made to this file:
|
||||||
|
// * Disable HTML tags
|
||||||
|
|
||||||
import { Prec } from "@codemirror/state";
|
import { Prec } from "@codemirror/state";
|
||||||
import { KeyBinding, keymap } from "@codemirror/view";
|
import { KeyBinding, keymap } from "@codemirror/view";
|
||||||
import {
|
import {
|
||||||
|
@ -6,7 +9,7 @@ import {
|
||||||
LanguageDescription,
|
LanguageDescription,
|
||||||
} from "@codemirror/language";
|
} from "@codemirror/language";
|
||||||
import { MarkdownExtension, MarkdownParser, parseCode } from "@lezer/markdown";
|
import { MarkdownExtension, MarkdownParser, parseCode } from "@lezer/markdown";
|
||||||
import { html } from "@codemirror/lang-html";
|
// import { html } from "@codemirror/lang-html";
|
||||||
import {
|
import {
|
||||||
commonmarkLanguage,
|
commonmarkLanguage,
|
||||||
markdownLanguage,
|
markdownLanguage,
|
||||||
|
@ -30,7 +33,7 @@ export const markdownKeymap: readonly KeyBinding[] = [
|
||||||
{ key: "Backspace", run: deleteMarkupBackward },
|
{ key: "Backspace", run: deleteMarkupBackward },
|
||||||
];
|
];
|
||||||
|
|
||||||
const htmlNoMatch = html({ matchClosingTags: false });
|
// const htmlNoMatch = html({ matchClosingTags: false });
|
||||||
|
|
||||||
/// Markdown language support.
|
/// Markdown language support.
|
||||||
export function markdown(
|
export function markdown(
|
||||||
|
@ -70,7 +73,8 @@ export function markdown(
|
||||||
"Base parser provided to `markdown` should be a Markdown parser"
|
"Base parser provided to `markdown` should be a Markdown parser"
|
||||||
);
|
);
|
||||||
let extensions = config.extensions ? [config.extensions] : [];
|
let extensions = config.extensions ? [config.extensions] : [];
|
||||||
let support = [htmlNoMatch.support],
|
// let support = [htmlNoMatch.support],
|
||||||
|
let support = [],
|
||||||
defaultCode;
|
defaultCode;
|
||||||
if (defaultCodeLanguage instanceof LanguageSupport) {
|
if (defaultCodeLanguage instanceof LanguageSupport) {
|
||||||
support.push(defaultCodeLanguage.support);
|
support.push(defaultCodeLanguage.support);
|
||||||
|
@ -83,7 +87,7 @@ export function markdown(
|
||||||
? getCodeParser(codeLanguages, defaultCode)
|
? getCodeParser(codeLanguages, defaultCode)
|
||||||
: undefined;
|
: undefined;
|
||||||
extensions.push(
|
extensions.push(
|
||||||
parseCode({ codeParser, htmlParser: htmlNoMatch.language.parser })
|
parseCode({ codeParser }) //, htmlParser: htmlNoMatch.language.parser })
|
||||||
);
|
);
|
||||||
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
|
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
|
||||||
return new LanguageSupport(mkLang(parser.configure(extensions)), support);
|
return new LanguageSupport(mkLang(parser.configure(extensions)), support);
|
|
@ -8,7 +8,7 @@ import {
|
||||||
Table,
|
Table,
|
||||||
TaskList,
|
TaskList,
|
||||||
} from "@lezer/markdown";
|
} from "@lezer/markdown";
|
||||||
import { markdown } from "@codemirror/lang-markdown";
|
import { markdown } from "./markdown";
|
||||||
import * as ct from "./customtags";
|
import * as ct from "./customtags";
|
||||||
import {
|
import {
|
||||||
Language,
|
Language,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { SysCallMapping } from "@plugos/plugos/system";
|
import { SysCallMapping } from "@plugos/plugos/system";
|
||||||
import type { ExpressServer } from "../express_server";
|
import type { ExpressServer } from "../express_server";
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
|
export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
|
||||||
return {
|
return {
|
||||||
|
@ -17,5 +18,8 @@ export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
|
||||||
"system.reloadPlugs": async () => {
|
"system.reloadPlugs": async () => {
|
||||||
return expressServer.reloadPlugs();
|
return expressServer.reloadPlugs();
|
||||||
},
|
},
|
||||||
|
"system.getVersion": async () => {
|
||||||
|
return version;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { CommandPalette } from "./components/command_palette";
|
||||||
import { PageNavigator } from "./components/page_navigator";
|
import { PageNavigator } from "./components/page_navigator";
|
||||||
import { TopBar } from "./components/top_bar";
|
import { TopBar } from "./components/top_bar";
|
||||||
import { lineWrapper } from "./line_wrapper";
|
import { lineWrapper } from "./line_wrapper";
|
||||||
import { markdown } from "@codemirror/lang-markdown";
|
import { markdown } from "@silverbulletmd/common/markdown";
|
||||||
import { PathPageNavigator } from "./navigator";
|
import { PathPageNavigator } from "./navigator";
|
||||||
import buildMarkdown from "@silverbulletmd/common/parser";
|
import buildMarkdown from "@silverbulletmd/common/parser";
|
||||||
import reducer from "./reducer";
|
import reducer from "./reducer";
|
||||||
|
@ -414,7 +414,7 @@ export class Editor {
|
||||||
extensions: [
|
extensions: [
|
||||||
markdown({
|
markdown({
|
||||||
base: buildMarkdown(this.mdExtensions),
|
base: buildMarkdown(this.mdExtensions),
|
||||||
addKeymap: true,
|
// addKeymap: true,
|
||||||
}),
|
}),
|
||||||
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
|
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
|
||||||
autocompletion({
|
autocompletion({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { SysCallMapping } from "@plugos/plugos/system";
|
import { SysCallMapping } from "@plugos/plugos/system";
|
||||||
import type { Editor } from "../editor";
|
import type { Editor } from "../editor";
|
||||||
import { AppCommand, CommandDef } from "../hooks/command";
|
import { CommandDef } from "../hooks/command";
|
||||||
import { version } from "../package.json";
|
import { version } from "../package.json";
|
||||||
|
|
||||||
export function systemSyscalls(editor: Editor): SysCallMapping {
|
export function systemSyscalls(editor: Editor): SysCallMapping {
|
||||||
|
|
Loading…
Reference in New Issue