WIP
parent
8ef9e955ba
commit
8ddd61f029
16
mod.ts
16
mod.ts
|
@ -1,5 +1,3 @@
|
|||
import React from "https://esm.sh/v96/@types/react@~17.0/index.d.ts";
|
||||
|
||||
export {
|
||||
autocompletion,
|
||||
completionKeymap,
|
||||
|
@ -7,6 +5,7 @@ export {
|
|||
|
||||
export {
|
||||
defaultHighlightStyle,
|
||||
Language,
|
||||
syntaxHighlighting,
|
||||
syntaxTree,
|
||||
} from "https://esm.sh/@codemirror/language@6.2.1?external=@codemirror/state";
|
||||
|
@ -22,6 +21,19 @@ export {
|
|||
closeBracketsKeymap,
|
||||
} from "https://esm.sh/@codemirror/autocomplete@6.3.0?external=@codemirror/state";
|
||||
|
||||
export { styleTags, Tag, tags } from "https://esm.sh/@lezer/highlight";
|
||||
|
||||
export type {
|
||||
BlockContext,
|
||||
LeafBlock,
|
||||
LeafBlockParser,
|
||||
MarkdownConfig,
|
||||
Table,
|
||||
TaskList,
|
||||
} from "https://esm.sh/@lezer/markdown";
|
||||
|
||||
export type { SyntaxNode } from "https://esm.sh/@lezer/common";
|
||||
|
||||
export {
|
||||
searchKeymap,
|
||||
} from "https://esm.sh/@codemirror/search?external=@codemirror/state";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Tag } from "@lezer/highlight";
|
||||
import { Tag } from "../../mod.ts";
|
||||
|
||||
export const WikiLinkTag = Tag.define();
|
||||
export const WikiLinkPageTag = Tag.define();
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
import * as plugos from "@plugos/plugos/types";
|
||||
import { EndpointHookT } from "@plugos/plugos/hooks/endpoint";
|
||||
import { CronHookT } from "@plugos/plugos/hooks/node_cron";
|
||||
import { EventHookT } from "@plugos/plugos/hooks/event";
|
||||
import { CommandHookT } from "@silverbulletmd/web/hooks/command";
|
||||
import { SlashCommandHookT } from "@silverbulletmd/web/hooks/slash_command";
|
||||
import { PageNamespaceHookT } from "../server/hooks/page_namespace";
|
||||
import * as plugos from "../plugos/types.ts";
|
||||
import { EndpointHookT } from "../plugos/hooks/endpoint.ts";
|
||||
import { CronHookT } from "../plugos/hooks/node_cron.ts";
|
||||
import { EventHookT } from "../plugos/hooks/event.ts";
|
||||
import { CommandHookT } from "../web/hooks/command.ts";
|
||||
import { SlashCommandHookT } from "../web/hooks/slash_command.ts";
|
||||
import { PageNamespaceHookT } from "../server/hooks/page_namespace.ts";
|
||||
|
||||
export type SilverBulletHooks = CommandHookT &
|
||||
SlashCommandHookT &
|
||||
EndpointHookT &
|
||||
CronHookT &
|
||||
EventHookT &
|
||||
PageNamespaceHookT;
|
||||
export type SilverBulletHooks =
|
||||
& CommandHookT
|
||||
& SlashCommandHookT
|
||||
& EndpointHookT
|
||||
& CronHookT
|
||||
& EventHookT
|
||||
& PageNamespaceHookT;
|
||||
|
||||
export type SyntaxExtensions = {
|
||||
syntax?: { [key: string]: NodeDef };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Tag } from "@lezer/highlight";
|
||||
import type { MarkdownConfig } from "@lezer/markdown";
|
||||
import { System } from "@plugos/plugos/system";
|
||||
import { Manifest } from "@silverbulletmd/common/manifest";
|
||||
import { Tag } from "../../mod.ts";
|
||||
import type { MarkdownConfig } from "../../mod.ts";
|
||||
import { System } from "../plugos/system.ts";
|
||||
import { Manifest } from "./manifest.ts";
|
||||
|
||||
export type MDExt = {
|
||||
// unicode char code for efficiency .charCodeAt(0)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { SyntaxNode } from "@lezer/common";
|
||||
import type { Language } from "@codemirror/language";
|
||||
import { ParseTree } from "./tree";
|
||||
import type { SyntaxNode } from "../../mod.ts";
|
||||
import type { Language } from "../../mod.ts";
|
||||
import { ParseTree } from "./tree.ts";
|
||||
|
||||
export function lezerToParseTree(
|
||||
text: string,
|
||||
n: SyntaxNode,
|
||||
offset = 0
|
||||
offset = 0,
|
||||
): ParseTree {
|
||||
let children: ParseTree[] = [];
|
||||
let nodeText: string | undefined;
|
||||
|
|
|
@ -1,31 +1,20 @@
|
|||
import { styleTags, tags as t } from "@lezer/highlight";
|
||||
import { styleTags, tags as t } from "../../mod.ts";
|
||||
import {
|
||||
BlockContext,
|
||||
LeafBlock,
|
||||
LeafBlockParser,
|
||||
MarkdownConfig,
|
||||
parseCode,
|
||||
Table,
|
||||
TaskList,
|
||||
} from "@lezer/markdown";
|
||||
import { markdown } from "./markdown";
|
||||
import * as ct from "./customtags";
|
||||
import {
|
||||
Language,
|
||||
LanguageDescription,
|
||||
LanguageSupport,
|
||||
} from "@codemirror/language";
|
||||
import { StreamLanguage } from "@codemirror/language";
|
||||
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
|
||||
import {
|
||||
javascriptLanguage,
|
||||
typescriptLanguage,
|
||||
} from "@codemirror/lang-javascript";
|
||||
} from "../../mod.ts";
|
||||
import { markdown } from "./markdown/index.ts";
|
||||
import * as ct from "./customtags.ts";
|
||||
import { Language } from "../../mod.ts";
|
||||
import {
|
||||
MDExt,
|
||||
mdExtensionStyleTags,
|
||||
mdExtensionSyntaxConfig,
|
||||
} from "./markdown_ext";
|
||||
} from "./markdown_ext.ts";
|
||||
|
||||
export const pageLinkRegex = /^\[\[([^\]]+)\]\]/;
|
||||
|
||||
|
@ -45,7 +34,7 @@ const WikiLink: MarkdownConfig = {
|
|||
return cx.addElement(
|
||||
cx.elt("WikiLink", pos, pos + match[0].length, [
|
||||
cx.elt("WikiLinkPage", pos + 2, pos + match[0].length - 2),
|
||||
])
|
||||
]),
|
||||
);
|
||||
},
|
||||
after: "Emphasis",
|
||||
|
@ -89,7 +78,7 @@ class CommentParser implements LeafBlockParser {
|
|||
cx.elt("Comment", leaf.start, leaf.start + leaf.content.length, [
|
||||
// cx.elt("CommentMarker", leaf.start, leaf.start + 3),
|
||||
...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3),
|
||||
])
|
||||
]),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue