Dependency bump
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
"@codemirror/search": "^6.2.0",
|
||||
"@codemirror/state": "^6.1.1",
|
||||
"@codemirror/view": "^6.2.3",
|
||||
"@lezer/common": "1.0.1",
|
||||
"@lezer/highlight": "1.0.0",
|
||||
"@lezer/markdown": "1.0.1",
|
||||
"@lezer/common": "^1.0.1",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/markdown": "^1.0.1",
|
||||
"mime-types": "^2.1.35",
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Table,
|
||||
TaskList,
|
||||
} from "@lezer/markdown";
|
||||
import { commonmark, getCodeParser, mkLang } from "./markdown/markdown";
|
||||
import { markdown } from "@codemirror/lang-markdown";
|
||||
import * as ct from "./customtags";
|
||||
import {
|
||||
Language,
|
||||
@@ -108,8 +108,8 @@ export const Comment: MarkdownConfig = {
|
||||
};
|
||||
|
||||
export default function buildMarkdown(mdExtensions: MDExt[]): Language {
|
||||
return mkLang(
|
||||
commonmark.configure([
|
||||
return markdown({
|
||||
extensions: [
|
||||
WikiLink,
|
||||
TaskList,
|
||||
Comment,
|
||||
@@ -155,6 +155,6 @@ export default function buildMarkdown(mdExtensions: MDExt[]): Language {
|
||||
),
|
||||
],
|
||||
},
|
||||
])
|
||||
);
|
||||
],
|
||||
}).language;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export class EventedSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
|
||||
this.eventHook
|
||||
.dispatchEvent("page:saved")
|
||||
.dispatchEvent("page:saved", pageName)
|
||||
.then(() => {
|
||||
return this.eventHook.dispatchEvent("page:index_text", {
|
||||
name: pageName,
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function readSettings<T extends object>(settings: T): Promise<T> {
|
||||
/**
|
||||
* Convenience function to write a specific set of settings from the `SETTINGS` page.
|
||||
* If the SETTiNGS page doesn't exist it will create it.
|
||||
* @param settings
|
||||
* @param settings
|
||||
*/
|
||||
export async function writeSettings<T extends object>(settings: T) {
|
||||
let readSettings = {};
|
||||
@@ -49,9 +49,11 @@ export async function writeSettings<T extends object>(settings: T) {
|
||||
} catch (e: any) {
|
||||
await notifyUser("Creating a new SETTINGS page...", "info");
|
||||
}
|
||||
const writeSettings = {...readSettings, ...settings};
|
||||
const doc = new YAML.Document();
|
||||
doc.contents = writeSettings;
|
||||
const contents = `This page contains settings for configuring SilverBullet and its Plugs.\nAny changes outside of the yaml block will be overwritten.\n\`\`\`yaml\n${doc.toString()}\n\`\`\``; // might need \r\n for windows?
|
||||
await writePage(SETTINGS_PAGE, contents)
|
||||
}
|
||||
const writeSettings = { ...readSettings, ...settings };
|
||||
// const doc = new YAML.Document();
|
||||
// doc.contents = writeSettings;
|
||||
const contents = `This page contains settings for configuring SilverBullet and its Plugs.\nAny changes outside of the yaml block will be overwritten.\n\`\`\`yaml\n${YAML.stringify(
|
||||
writeSettings
|
||||
)}\n\`\`\``; // might need \r\n for windows?
|
||||
await writePage(SETTINGS_PAGE, contents);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"handlebars": "^4.7.7",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-task-lists": "^2.1.1",
|
||||
"yaml": "^2.0.0"
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/markdown-it": "^12.2.3"
|
||||
|
||||
@@ -419,7 +419,7 @@ function buildFsRouter(spacePrimitives: SpacePrimitives) {
|
||||
.route(/\/(.+)/)
|
||||
.get(async (req, res, next) => {
|
||||
let name = req.params[0];
|
||||
console.log("Getting", name);
|
||||
console.log("Loading file", name);
|
||||
try {
|
||||
let attachmentData = await spacePrimitives.readFile(
|
||||
name,
|
||||
|
||||
+17
-9
@@ -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 "@silverbulletmd/common/markdown";
|
||||
import { markdown } from "@codemirror/lang-markdown";
|
||||
import { PathPageNavigator } from "./navigator";
|
||||
import buildMarkdown from "@silverbulletmd/common/parser";
|
||||
import reducer from "./reducer";
|
||||
@@ -61,6 +61,7 @@ import sandboxSyscalls from "@plugos/plugos/syscalls/sandbox";
|
||||
import { eventSyscalls } from "@plugos/plugos/syscalls/event";
|
||||
import { storeSyscalls } from "./syscalls/store";
|
||||
import { inlineImagesPlugin } from "./inline_image";
|
||||
import { ConsoleLogger } from "@plugos/plugos/environments/custom_logger";
|
||||
|
||||
class PageState {
|
||||
constructor(
|
||||
@@ -73,6 +74,9 @@ const saveInterval = 1000;
|
||||
|
||||
// Monkey patching the languageDataAt, somehow the languageData facet is not set
|
||||
// properly, no idea why
|
||||
|
||||
let _languageFacetsCache: any;
|
||||
|
||||
// TODO: Remove at some point
|
||||
EditorState.prototype.languageDataAt = function (
|
||||
name: string,
|
||||
@@ -86,7 +90,11 @@ EditorState.prototype.languageDataAt = function (
|
||||
let providerResult = provider(this, pos, side);
|
||||
if (!providerResult) {
|
||||
// console.log("Empty provider result");
|
||||
continue;
|
||||
providerResult = _languageFacetsCache;
|
||||
// continue;
|
||||
} else {
|
||||
// console.log("Provider result", providerResult);
|
||||
_languageFacetsCache = providerResult.slice();
|
||||
}
|
||||
for (let result of providerResult) {
|
||||
if (Object.prototype.hasOwnProperty.call(result, name))
|
||||
@@ -204,7 +212,7 @@ export class Editor {
|
||||
this.focus();
|
||||
|
||||
this.pageNavigator.subscribe(async (pageName, pos: number | string) => {
|
||||
console.log("Now navigating to", pageName, pos);
|
||||
console.log("Now navigating to", pageName);
|
||||
|
||||
if (!this.editorView) {
|
||||
return;
|
||||
@@ -213,7 +221,7 @@ export class Editor {
|
||||
let stateRestored = await this.loadPage(pageName);
|
||||
if (pos) {
|
||||
if (typeof pos === "string") {
|
||||
console.log("Navigating to anchor", pos);
|
||||
// console.log("Navigating to anchor", pos);
|
||||
|
||||
// We're going to look up the anchor through a direct page store query...
|
||||
// TODO: This is a bit hacky, but it works for now
|
||||
@@ -408,11 +416,6 @@ export class Editor {
|
||||
base: buildMarkdown(this.mdExtensions),
|
||||
addKeymap: true,
|
||||
}),
|
||||
inlineImagesPlugin(),
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
drawSelection(),
|
||||
dropCursor(),
|
||||
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
|
||||
autocompletion({
|
||||
override: [
|
||||
@@ -422,6 +425,11 @@ export class Editor {
|
||||
),
|
||||
],
|
||||
}),
|
||||
inlineImagesPlugin(),
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
drawSelection(),
|
||||
dropCursor(),
|
||||
EditorView.lineWrapping,
|
||||
lineWrapper([
|
||||
{ selector: "ATXHeading1", class: "sb-line-h1" },
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
"@fortawesome/free-solid-svg-icons": "6.0.0",
|
||||
"@fortawesome/react-fontawesome": "0.1.17",
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@lezer/highlight": "1.0.0",
|
||||
"@lezer/markdown": "1.0.1",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/markdown": "^1.0.1",
|
||||
"fake-indexeddb": "^3.1.7",
|
||||
"fuzzysort": "^2.0.1",
|
||||
"jest": "^27.5.1",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { HighlightStyle } from "@codemirror/language";
|
||||
import { tags as t } from "@lezer/highlight";
|
||||
import { tagHighlighter, tags as t } from "@lezer/highlight";
|
||||
import * as ct from "@silverbulletmd/common/customtags";
|
||||
import { MDExt } from "@silverbulletmd/common/markdown_ext";
|
||||
|
||||
export default function highlightStyles(mdExtension: MDExt[]) {
|
||||
tagHighlighter;
|
||||
const hls = HighlightStyle.define([
|
||||
{ tag: t.heading1, class: "sb-h1" },
|
||||
{ tag: t.heading2, class: "sb-h2" },
|
||||
@@ -51,6 +52,7 @@ export default function highlightStyles(mdExtension: MDExt[]) {
|
||||
// Hack: https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320/16
|
||||
// @ts-ignore
|
||||
hls.style = (tags) => {
|
||||
// console.log("Tags", tags);
|
||||
return fn0(tags || []);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user