deno fmt
parent
5ad804da1c
commit
53bf098579
|
@ -1,8 +1,6 @@
|
|||
import { path, expandGlobSync, flags } from "./plugos/deps.ts";
|
||||
import { bundleRun } from "./plugos/bin/plugos-bundle.ts"
|
||||
import {
|
||||
esbuild,
|
||||
} from "./plugos/compile.ts";
|
||||
import { expandGlobSync, flags, path } from "./plugos/deps.ts";
|
||||
import { bundleRun } from "./plugos/bin/plugos-bundle.ts";
|
||||
import { esbuild } from "./plugos/compile.ts";
|
||||
|
||||
if (import.meta.main) {
|
||||
const args = flags.parse(Deno.args, {
|
||||
|
@ -15,10 +13,10 @@ if (import.meta.main) {
|
|||
args.dist = path.resolve(path.join("dist_bundle", "_plug"));
|
||||
}
|
||||
|
||||
const manifests : string[] = [];
|
||||
const pattern : string = path.join("plugs", "*", "*.plug.yaml");
|
||||
const manifests: string[] = [];
|
||||
const pattern: string = path.join("plugs", "*", "*.plug.yaml");
|
||||
for (const file of expandGlobSync(pattern)) {
|
||||
manifests.push(file.path);
|
||||
manifests.push(file.path);
|
||||
}
|
||||
|
||||
await bundleRun(
|
||||
|
|
|
@ -94,8 +94,8 @@ export {
|
|||
|
||||
export { yaml as yamlLanguage } from "https://esm.sh/@codemirror/legacy-modes@6.3.1/mode/yaml?external=@codemirror/language";
|
||||
export {
|
||||
standardSQL as sqlLanguage,
|
||||
pgSQL as postgresqlLanguage,
|
||||
standardSQL as sqlLanguage,
|
||||
} from "https://esm.sh/@codemirror/legacy-modes@6.3.1/mode/sql?external=@codemirror/language";
|
||||
export { rust as rustLanguage } from "https://esm.sh/@codemirror/legacy-modes@6.3.1/mode/rust?external=@codemirror/language";
|
||||
export { css as cssLanguage } from "https://esm.sh/@codemirror/legacy-modes@6.3.1/mode/css?external=@codemirror/language";
|
||||
|
@ -109,13 +109,13 @@ export { json as jsonLanguage } from "https://esm.sh/@codemirror/legacy-modes@6.
|
|||
export {
|
||||
c as cLanguage,
|
||||
cpp as cppLanguage,
|
||||
java as javaLanguage,
|
||||
csharp as csharpLanguage,
|
||||
scala as scalaLanguage,
|
||||
dart as dartLanguage,
|
||||
java as javaLanguage,
|
||||
kotlin as kotlinLanguage,
|
||||
objectiveC as objectiveCLanguage,
|
||||
objectiveCpp as objectiveCppLanguage,
|
||||
dart as dartLanguage,
|
||||
scala as scalaLanguage,
|
||||
} from "https://esm.sh/@codemirror/legacy-modes@6.3.1/mode/clike?external=@codemirror/language";
|
||||
|
||||
export {
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
import {LRParser} from "@lezer/lr"
|
||||
import { LRParser } from "@lezer/lr";
|
||||
export const parser = LRParser.deserialize({
|
||||
version: 14,
|
||||
states: "&`OVQPOOOmQQO'#C^QOQPOOOtQPO'#C`OyQPO'#ClO!OQPO'#CnO!TQPO'#CqO!YQPO'#CsOOQO'#Cv'#CvO!bQQO,58xO!iQQO'#CcO#WQQO'#CbOOQO,58z,58zOOQO,59W,59WO#oQQO,59YO$ZQQO'#D`OOQO,59],59]OOQO,59_,59_OOQO-E6t-E6tO$rQQO,58}OtQPO'#CxO%ZQQO,58|OOQO'#Cp'#CpOOQO1G.t1G.tO%rQPO'#CyO%wQQO,59zOOQO'#Cg'#CgO$rQQO'#CjOOQO'#Cd'#CdOOQO1G.i1G.iOOQO,59d,59dOOQO-E6v-E6vOOQO,59e,59eOOQO-E6w-E6wO&`QPO'#DRO&hQPO,59UO$rQQO'#CwO&mQPO,59mOOQO1G.p1G.pOOQO,59c,59cOOQO-E6u-E6u",
|
||||
stateData: "&u~OpOS~ORPO~OTROaSOcTOfUOhVO~OnQX~P[ORYO~OX]O~OR^O~OR_O~OYaOiaO~OnQa~P[OqcOxcOycOzcO{cO|cO}cO!OcO!PcO~O_dOTUXaUXcUXfUXhUXnUX~O!QfO!RfOTbaabacbafbahbanba~OvhOT!SXa!SXc!SXf!SXh!SXn!SX~OXlOYlO[lO]lOrjOsjOtkO~O_dOTUaaUacUafUahUanUa~ORpO~OvhOT!Saa!Sac!Saf!Sah!San!Sa~OvtOwuX~OwvO~OvtOwua~O",
|
||||
goto: "#g!TPP!UP!XP!]!`!fPP!oPP!oP!XP!XP!t!XP!XPP!w!}#T#ZPPPPPPP#aPPPPPPPPPPPP#dRQOTWPXR[RQZRRndQmcQrkRwtVlcktRg^QXPRbXQurRxuQeZRoeQi_RqiRskR`U",
|
||||
nodeNames: "⚠ Program Query Name WhereClause Where LogicalExpr FilterExpr Value Number String Bool Regex Null List And LimitClause Limit OrderClause Order OrderDirection SelectClause Select RenderClause Render PageRef",
|
||||
states:
|
||||
"&`OVQPOOOmQQO'#C^QOQPOOOtQPO'#C`OyQPO'#ClO!OQPO'#CnO!TQPO'#CqO!YQPO'#CsOOQO'#Cv'#CvO!bQQO,58xO!iQQO'#CcO#WQQO'#CbOOQO,58z,58zOOQO,59W,59WO#oQQO,59YO$ZQQO'#D`OOQO,59],59]OOQO,59_,59_OOQO-E6t-E6tO$rQQO,58}OtQPO'#CxO%ZQQO,58|OOQO'#Cp'#CpOOQO1G.t1G.tO%rQPO'#CyO%wQQO,59zOOQO'#Cg'#CgO$rQQO'#CjOOQO'#Cd'#CdOOQO1G.i1G.iOOQO,59d,59dOOQO-E6v-E6vOOQO,59e,59eOOQO-E6w-E6wO&`QPO'#DRO&hQPO,59UO$rQQO'#CwO&mQPO,59mOOQO1G.p1G.pOOQO,59c,59cOOQO-E6u-E6u",
|
||||
stateData:
|
||||
"&u~OpOS~ORPO~OTROaSOcTOfUOhVO~OnQX~P[ORYO~OX]O~OR^O~OR_O~OYaOiaO~OnQa~P[OqcOxcOycOzcO{cO|cO}cO!OcO!PcO~O_dOTUXaUXcUXfUXhUXnUX~O!QfO!RfOTbaabacbafbahbanba~OvhOT!SXa!SXc!SXf!SXh!SXn!SX~OXlOYlO[lO]lOrjOsjOtkO~O_dOTUaaUacUafUahUanUa~ORpO~OvhOT!Saa!Sac!Saf!Sah!San!Sa~OvtOwuX~OwvO~OvtOwua~O",
|
||||
goto:
|
||||
"#g!TPP!UP!XP!]!`!fPP!oPP!oP!XP!XP!t!XP!XPP!w!}#T#ZPPPPPPP#aPPPPPPPPPPPP#dRQOTWPXR[RQZRRndQmcQrkRwtVlcktRg^QXPRbXQurRxuQeZRoeQi_RqiRskR`U",
|
||||
nodeNames:
|
||||
"⚠ Program Query Name WhereClause Where LogicalExpr FilterExpr Value Number String Bool Regex Null List And LimitClause Limit OrderClause Order OrderDirection SelectClause Select RenderClause Render PageRef",
|
||||
maxTerm: 50,
|
||||
skippedNodes: [0],
|
||||
repeatNodeCount: 4,
|
||||
tokenData: "Ao~R|X^#{pq#{qr$prs%T|}%o}!O%t!P!Q&V!Q![&|!^!_'U!_!`'c!`!a'p!c!}%t!}#O'}#P#Q(n#R#S%t#T#U(s#U#W%t#W#X+Y#X#Y%t#Y#Z-U#Z#]%t#]#^/f#^#`%t#`#a0b#a#b%t#b#c2u#c#d4q#d#f%t#f#g7h#g#h:d#h#i=`#i#k%t#k#l?[#l#o%t#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$Ip$Iq%T$Iq$Ir%T$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{~$QYp~X^#{pq#{#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{~$sP!_!`$v~${Pz~#r#s%O~%TO!O~~%WUOr%Trs%js$Ip%T$Ip$Iq%j$Iq$Ir%j$Ir~%T~%oOY~~%tOv~P%ySRP}!O%t!c!}%t#R#S%t#T#o%t~&[V[~OY&VZ]&V^!P&V!P!Q&q!Q#O&V#O#P&v#P~&V~&vO[~~&yPO~&V~'RPX~!Q![&|~'ZPq~!_!`'^~'cOx~~'hPy~#r#s'k~'pO}~~'uP|~!_!`'x~'}O{~R(SPtQ!}#O(VP(YRO#P(V#P#Q(c#Q~(VP(fP#P#Q(iP(nOiP~(sOw~R(xWRP}!O%t!c!}%t#R#S%t#T#b%t#b#c)b#c#g%t#g#h*^#h#o%tR)gURP}!O%t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#T#`%t#`#a;d#a#o%tR;iURP}!O%t!c!}%t#R#S%t#T#X%t#X#Y;{#Y#o%tR<QURP}!O%t!c!}%t#R#S%t#T#V%t#V#W<d#W#o%tR<iURP}!O%t!c!}%t#R#S%t#T#h%t#h#i<{#i#o%tR=SSRPfQ}!O%t!c!}%t#R#S%t#T#o%tR=eURP}!O%t!c!}%t#R#S%t#T#f%t#f#g=w#g#o%tR=|URP}!O%t!c!}%t#R#S%t#T#i%t#i#j>`#j#o%tR>eURP}!O%t!c!}%t#R#S%t#T#X%t#X#Y>w#Y#o%tR?OSrQRP}!O%t!c!}%t#R#S%t#T#o%tR?aURP}!O%t!c!}%t#R#S%t#T#[%t#[#]?s#]#o%tR?xURP}!O%t!c!}%t#R#S%t#T#X%t#X#Y@[#Y#o%tR@aURP}!O%t!c!}%t#R#S%t#T#f%t#f#g@s#g#o%tR@xURP}!O%t!c!}%t#R#S%t#T#X%t#X#YA[#Y#o%tRAcSRPTQ}!O%t!c!}%t#R#S%t#T#o%t",
|
||||
tokenizers: [0, 1],
|
||||
topRules: {"Program":[0,1]},
|
||||
tokenPrec: 0
|
||||
})
|
||||
topRules: { "Program": [0, 1] },
|
||||
tokenPrec: 0,
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
export const
|
||||
Program = 1,
|
||||
export const Program = 1,
|
||||
Query = 2,
|
||||
Name = 3,
|
||||
WhereClause = 4,
|
||||
|
@ -24,4 +23,4 @@ export const
|
|||
Select = 22,
|
||||
RenderClause = 23,
|
||||
Render = 24,
|
||||
PageRef = 25
|
||||
PageRef = 25;
|
||||
|
|
|
@ -54,10 +54,14 @@
|
|||
"exclude": [
|
||||
"dist",
|
||||
"dist_bundle",
|
||||
"desktop",
|
||||
"mobile",
|
||||
"pages",
|
||||
"website",
|
||||
"website_build",
|
||||
"test_space",
|
||||
"plugos/environments/worker_bundle.json"
|
||||
"plugos/environments/worker_bundle.json",
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,10 @@ export async function compile(
|
|||
inFile,
|
||||
`import {${functionName}} from "file://${
|
||||
// Replacaing \ with / for Windows
|
||||
path.resolve(filePath).replaceAll("\\", "\\\\")
|
||||
}";export default ${functionName};`,
|
||||
path.resolve(filePath).replaceAll(
|
||||
"\\",
|
||||
"\\\\",
|
||||
)}";export default ${functionName};`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ import { urlToPathname } from "./util.ts";
|
|||
const __dirname = urlToPathname(new URL(".", import.meta.url));
|
||||
|
||||
Deno.test("Preload dependencies", async () => {
|
||||
|
||||
const globalModules = await plugOsBundle(
|
||||
`${__dirname}../plugs/global.plug.yaml`,
|
||||
);
|
||||
|
|
|
@ -7,7 +7,9 @@ import { urlToPathname } from "../util.ts";
|
|||
const fakeCtx = {} as any;
|
||||
|
||||
Deno.test("Test FS operations", async () => {
|
||||
const thisFolder = path.resolve(path.dirname(urlToPathname(new URL(import.meta.url))));
|
||||
const thisFolder = path.resolve(
|
||||
path.dirname(urlToPathname(new URL(import.meta.url))),
|
||||
);
|
||||
const syscalls = fileSystemSyscalls(thisFolder);
|
||||
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
|
||||
fakeCtx,
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import {
|
||||
editor,
|
||||
space,
|
||||
} from "$sb/silverbullet-syscall/mod.ts";
|
||||
import { editor, space } from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
export async function extractToPage() {
|
||||
const newName = await editor.prompt(`New page title:`, 'new page');
|
||||
const newName = await editor.prompt(`New page title:`, "new page");
|
||||
if (!newName) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ export async function listifySelection() {
|
|||
|
||||
//if very first of doc, just add a bullet and end
|
||||
if (selection.to == 0 && selection.from == 0) {
|
||||
await editor.insertAtCursor("* ")
|
||||
return
|
||||
await editor.insertAtCursor("* ");
|
||||
return;
|
||||
}
|
||||
|
||||
let from = selection.from;
|
||||
if (text[from] == "\n") {
|
||||
//end of line, need to find previous line break
|
||||
from--
|
||||
from--;
|
||||
}
|
||||
while (from >= 0 && text[from] !== "\n") {
|
||||
from--;
|
||||
|
@ -53,11 +53,12 @@ export async function numberListifySelection() {
|
|||
from++;
|
||||
text = text.slice(from, selection.to);
|
||||
let counter = 1;
|
||||
text = `1. ${text.replaceAll(/\n(?!\n)/g, () => {
|
||||
counter++;
|
||||
return `\n${counter}. `;
|
||||
})
|
||||
}`;
|
||||
text = `1. ${
|
||||
text.replaceAll(/\n(?!\n)/g, () => {
|
||||
counter++;
|
||||
return `\n${counter}. `;
|
||||
})
|
||||
}`;
|
||||
await editor.replaceRange(from, selection.to, text);
|
||||
}
|
||||
|
||||
|
|
|
@ -2630,14 +2630,20 @@
|
|||
["🧑🏻🤝🧑🏿", "people_holding_hands_light_skin_tone_dark_skin_tone"],
|
||||
["🧑🏼🤝🧑🏻", "people_holding_hands_medium_light_skin_tone_light_skin_tone"],
|
||||
["🧑🏼🤝🧑🏼", "people_holding_hands_medium_light_skin_tone"],
|
||||
["🧑🏼🤝🧑🏽", "people_holding_hands_medium_light_skin_tone_medium_skin_tone"],
|
||||
[
|
||||
"🧑🏼🤝🧑🏽",
|
||||
"people_holding_hands_medium_light_skin_tone_medium_skin_tone"
|
||||
],
|
||||
[
|
||||
"🧑🏼🤝🧑🏾",
|
||||
"people_holding_hands_medium_light_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["🧑🏼🤝🧑🏿", "people_holding_hands_medium_light_skin_tone_dark_skin_tone"],
|
||||
["🧑🏽🤝🧑🏻", "people_holding_hands_medium_skin_tone_light_skin_tone"],
|
||||
["🧑🏽🤝🧑🏼", "people_holding_hands_medium_skin_tone_medium_light_skin_tone"],
|
||||
[
|
||||
"🧑🏽🤝🧑🏼",
|
||||
"people_holding_hands_medium_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
["🧑🏽🤝🧑🏽", "people_holding_hands_medium_skin_tone"],
|
||||
["🧑🏽🤝🧑🏾", "people_holding_hands_medium_skin_tone_medium_dark_skin_tone"],
|
||||
["🧑🏽🤝🧑🏿", "people_holding_hands_medium_skin_tone_dark_skin_tone"],
|
||||
|
@ -2692,7 +2698,10 @@
|
|||
"👩🏻🤝👨🏼",
|
||||
"woman_and_man_holding_hands_light_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
["👩🏻🤝👨🏽", "woman_and_man_holding_hands_light_skin_tone_medium_skin_tone"],
|
||||
[
|
||||
"👩🏻🤝👨🏽",
|
||||
"woman_and_man_holding_hands_light_skin_tone_medium_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏻🤝👨🏾",
|
||||
"woman_and_man_holding_hands_light_skin_tone_medium_dark_skin_tone"
|
||||
|
@ -2715,7 +2724,10 @@
|
|||
"👩🏼🤝👨🏿",
|
||||
"woman_and_man_holding_hands_medium_light_skin_tone_dark_skin_tone"
|
||||
],
|
||||
["👩🏽🤝👨🏻", "woman_and_man_holding_hands_medium_skin_tone_light_skin_tone"],
|
||||
[
|
||||
"👩🏽🤝👨🏻",
|
||||
"woman_and_man_holding_hands_medium_skin_tone_light_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏽🤝👨🏼",
|
||||
"woman_and_man_holding_hands_medium_skin_tone_medium_light_skin_tone"
|
||||
|
@ -2763,7 +2775,10 @@
|
|||
["👨🏼🤝👨🏻", "men_holding_hands_medium_light_skin_tone_light_skin_tone"],
|
||||
["👬🏼", "men_holding_hands_medium_light_skin_tone"],
|
||||
["👨🏼🤝👨🏽", "men_holding_hands_medium_light_skin_tone_medium_skin_tone"],
|
||||
["👨🏼🤝👨🏾", "men_holding_hands_medium_light_skin_tone_medium_dark_skin_tone"],
|
||||
[
|
||||
"👨🏼🤝👨🏾",
|
||||
"men_holding_hands_medium_light_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["👨🏼🤝👨🏿", "men_holding_hands_medium_light_skin_tone_dark_skin_tone"],
|
||||
["👨🏽🤝👨🏻", "men_holding_hands_medium_skin_tone_light_skin_tone"],
|
||||
["👨🏽🤝👨🏼", "men_holding_hands_medium_skin_tone_medium_light_skin_tone"],
|
||||
|
@ -2771,7 +2786,10 @@
|
|||
["👨🏽🤝👨🏾", "men_holding_hands_medium_skin_tone_medium_dark_skin_tone"],
|
||||
["👨🏽🤝👨🏿", "men_holding_hands_medium_skin_tone_dark_skin_tone"],
|
||||
["👨🏾🤝👨🏻", "men_holding_hands_medium_dark_skin_tone_light_skin_tone"],
|
||||
["👨🏾🤝👨🏼", "men_holding_hands_medium_dark_skin_tone_medium_light_skin_tone"],
|
||||
[
|
||||
"👨🏾🤝👨🏼",
|
||||
"men_holding_hands_medium_dark_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
["👨🏾🤝👨🏽", "men_holding_hands_medium_dark_skin_tone_medium_skin_tone"],
|
||||
["👬🏾", "men_holding_hands_medium_dark_skin_tone"],
|
||||
["👨🏾🤝👨🏿", "men_holding_hands_medium_dark_skin_tone_dark_skin_tone"],
|
||||
|
@ -2856,8 +2874,14 @@
|
|||
["👩🏼❤💋👨🏼", "kiss_woman_man_medium_light_skin_tone"],
|
||||
["👩🏼❤️💋👨🏽", "kiss_woman_man_medium_light_skin_tone_medium_skin_tone"],
|
||||
["👩🏼❤💋👨🏽", "kiss_woman_man_medium_light_skin_tone_medium_skin_tone"],
|
||||
["👩🏼❤️💋👨🏾", "kiss_woman_man_medium_light_skin_tone_medium_dark_skin_tone"],
|
||||
["👩🏼❤💋👨🏾", "kiss_woman_man_medium_light_skin_tone_medium_dark_skin_tone"],
|
||||
[
|
||||
"👩🏼❤️💋👨🏾",
|
||||
"kiss_woman_man_medium_light_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏼❤💋👨🏾",
|
||||
"kiss_woman_man_medium_light_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["👩🏼❤️💋👨🏿", "kiss_woman_man_medium_light_skin_tone_dark_skin_tone"],
|
||||
["👩🏼❤💋👨🏿", "kiss_woman_man_medium_light_skin_tone_dark_skin_tone"],
|
||||
["👩🏽❤️💋👨🏻", "kiss_woman_man_medium_skin_tone_light_skin_tone"],
|
||||
|
@ -2872,8 +2896,14 @@
|
|||
["👩🏽❤💋👨🏿", "kiss_woman_man_medium_skin_tone_dark_skin_tone"],
|
||||
["👩🏾❤️💋👨🏻", "kiss_woman_man_medium_dark_skin_tone_light_skin_tone"],
|
||||
["👩🏾❤💋👨🏻", "kiss_woman_man_medium_dark_skin_tone_light_skin_tone"],
|
||||
["👩🏾❤️💋👨🏼", "kiss_woman_man_medium_dark_skin_tone_medium_light_skin_tone"],
|
||||
["👩🏾❤💋👨🏼", "kiss_woman_man_medium_dark_skin_tone_medium_light_skin_tone"],
|
||||
[
|
||||
"👩🏾❤️💋👨🏼",
|
||||
"kiss_woman_man_medium_dark_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏾❤💋👨🏼",
|
||||
"kiss_woman_man_medium_dark_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
["👩🏾❤️💋👨🏽", "kiss_woman_man_medium_dark_skin_tone_medium_skin_tone"],
|
||||
["👩🏾❤💋👨🏽", "kiss_woman_man_medium_dark_skin_tone_medium_skin_tone"],
|
||||
["👩🏾❤️💋👨🏾", "kiss_woman_man_medium_dark_skin_tone"],
|
||||
|
@ -3040,7 +3070,10 @@
|
|||
"🧑🏻❤️🧑🏿",
|
||||
"couple_with_heart_person_person_light_skin_tone_dark_skin_tone"
|
||||
],
|
||||
["🧑🏻❤🧑🏿", "couple_with_heart_person_person_light_skin_tone_dark_skin_tone"],
|
||||
[
|
||||
"🧑🏻❤🧑🏿",
|
||||
"couple_with_heart_person_person_light_skin_tone_dark_skin_tone"
|
||||
],
|
||||
[
|
||||
"🧑🏼❤️🧑🏻",
|
||||
"couple_with_heart_person_person_medium_light_skin_tone_light_skin_tone"
|
||||
|
@ -3141,7 +3174,10 @@
|
|||
"🧑🏿❤️🧑🏻",
|
||||
"couple_with_heart_person_person_dark_skin_tone_light_skin_tone"
|
||||
],
|
||||
["🧑🏿❤🧑🏻", "couple_with_heart_person_person_dark_skin_tone_light_skin_tone"],
|
||||
[
|
||||
"🧑🏿❤🧑🏻",
|
||||
"couple_with_heart_person_person_dark_skin_tone_light_skin_tone"
|
||||
],
|
||||
[
|
||||
"🧑🏿❤️🧑🏼",
|
||||
"couple_with_heart_person_person_dark_skin_tone_medium_light_skin_tone"
|
||||
|
@ -3412,7 +3448,10 @@
|
|||
"👨🏾❤️👨🏿",
|
||||
"couple_with_heart_man_man_medium_dark_skin_tone_dark_skin_tone"
|
||||
],
|
||||
["👨🏾❤👨🏿", "couple_with_heart_man_man_medium_dark_skin_tone_dark_skin_tone"],
|
||||
[
|
||||
"👨🏾❤👨🏿",
|
||||
"couple_with_heart_man_man_medium_dark_skin_tone_dark_skin_tone"
|
||||
],
|
||||
["👨🏿❤️👨🏻", "couple_with_heart_man_man_dark_skin_tone_light_skin_tone"],
|
||||
["👨🏿❤👨🏻", "couple_with_heart_man_man_dark_skin_tone_light_skin_tone"],
|
||||
[
|
||||
|
@ -3429,7 +3468,10 @@
|
|||
"👨🏿❤️👨🏾",
|
||||
"couple_with_heart_man_man_dark_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["👨🏿❤👨🏾", "couple_with_heart_man_man_dark_skin_tone_medium_dark_skin_tone"],
|
||||
[
|
||||
"👨🏿❤👨🏾",
|
||||
"couple_with_heart_man_man_dark_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["👨🏿❤️👨🏿", "couple_with_heart_man_man_dark_skin_tone"],
|
||||
["👨🏿❤👨🏿", "couple_with_heart_man_man_dark_skin_tone"],
|
||||
["👩❤️👩", "couple_with_heart_woman_woman"],
|
||||
|
@ -3448,7 +3490,10 @@
|
|||
"👩🏻❤️👩🏽",
|
||||
"couple_with_heart_woman_woman_light_skin_tone_medium_skin_tone"
|
||||
],
|
||||
["👩🏻❤👩🏽", "couple_with_heart_woman_woman_light_skin_tone_medium_skin_tone"],
|
||||
[
|
||||
"👩🏻❤👩🏽",
|
||||
"couple_with_heart_woman_woman_light_skin_tone_medium_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏻❤️👩🏾",
|
||||
"couple_with_heart_woman_woman_light_skin_tone_medium_dark_skin_tone"
|
||||
|
@ -3497,7 +3542,10 @@
|
|||
"👩🏽❤️👩🏻",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_light_skin_tone"
|
||||
],
|
||||
["👩🏽❤👩🏻", "couple_with_heart_woman_woman_medium_skin_tone_light_skin_tone"],
|
||||
[
|
||||
"👩🏽❤👩🏻",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_light_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏽❤️👩🏼",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_medium_light_skin_tone"
|
||||
|
@ -3516,8 +3564,14 @@
|
|||
"👩🏽❤👩🏾",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_medium_dark_skin_tone"
|
||||
],
|
||||
["👩🏽❤️👩🏿", "couple_with_heart_woman_woman_medium_skin_tone_dark_skin_tone"],
|
||||
["👩🏽❤👩🏿", "couple_with_heart_woman_woman_medium_skin_tone_dark_skin_tone"],
|
||||
[
|
||||
"👩🏽❤️👩🏿",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_dark_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏽❤👩🏿",
|
||||
"couple_with_heart_woman_woman_medium_skin_tone_dark_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏾❤️👩🏻",
|
||||
"couple_with_heart_woman_woman_medium_dark_skin_tone_light_skin_tone"
|
||||
|
@ -3562,8 +3616,14 @@
|
|||
"👩🏿❤👩🏼",
|
||||
"couple_with_heart_woman_woman_dark_skin_tone_medium_light_skin_tone"
|
||||
],
|
||||
["👩🏿❤️👩🏽", "couple_with_heart_woman_woman_dark_skin_tone_medium_skin_tone"],
|
||||
["👩🏿❤👩🏽", "couple_with_heart_woman_woman_dark_skin_tone_medium_skin_tone"],
|
||||
[
|
||||
"👩🏿❤️👩🏽",
|
||||
"couple_with_heart_woman_woman_dark_skin_tone_medium_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏿❤👩🏽",
|
||||
"couple_with_heart_woman_woman_dark_skin_tone_medium_skin_tone"
|
||||
],
|
||||
[
|
||||
"👩🏿❤️👩🏾",
|
||||
"couple_with_heart_woman_woman_dark_skin_tone_medium_dark_skin_tone"
|
||||
|
|
|
@ -9,7 +9,7 @@ document.getElementById("root").addEventListener("click", (e) => {
|
|||
syscall(
|
||||
"event.dispatch",
|
||||
"preview:click",
|
||||
JSON.stringify(["pos", dataSet["pos"]])
|
||||
JSON.stringify(["pos", dataSet["pos"]]),
|
||||
).catch((e) => console.log("Error", e));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
---
|
||||
name: Sup
|
||||
---
|
||||
# Hello world
|
||||
This is **bold** and _italic_, or *italic*. And a **_mix_**. And ==highlight==!
|
||||
|
||||
This is one line
|
||||
and this another.
|
||||
# Hello world
|
||||
|
||||
This is **bold** and _italic_, or _italic_. And a **_mix_**. And ==highlight==!
|
||||
|
||||
This is one line and this another.
|
||||
|
||||
Lists:
|
||||
* This
|
||||
* Is a
|
||||
* list
|
||||
* And here we go nested
|
||||
|
||||
- This
|
||||
- Is a
|
||||
- list
|
||||
- And here we go nested
|
||||
1. This is a numbered
|
||||
2. Two
|
||||
* And different
|
||||
* Bla
|
||||
* More bla
|
||||
- And different
|
||||
- Bla
|
||||
- More bla
|
||||
|
||||
And:
|
||||
|
||||
|
@ -42,22 +44,18 @@ And like this:
|
|||
|
||||
And a blockquote:
|
||||
|
||||
> Sup yo
|
||||
> Empty line
|
||||
> Sup yo Empty line\
|
||||
> Second part
|
||||
|
||||
<!-- this is a comment -->
|
||||
|
||||
And more custom stuff
|
||||
[[Page link]]
|
||||
And more custom stuff [[Page link]]
|
||||
|
||||
{[Command button]}
|
||||
|
||||
* [ ] #next Task
|
||||
* [x] #next Task 2
|
||||
* [ ] Task with dealine 📅 2022-05-06 fef
|
||||
|
||||
|
||||
- [ ] #next Task
|
||||
- [x] #next Task 2
|
||||
- [ ] Task with dealine 📅 2022-05-06 fef
|
||||
|
||||
https://community.mattermost.com
|
||||
|
||||
|
@ -67,11 +65,10 @@ $anchor
|
|||
|
||||
## Tables
|
||||
|
||||
|type |actor_login|created_at |payload_ref |
|
||||
|---------|--------|--------------------|----------------------|
|
||||
|PushEvent|avb|2022-10-27T08:27:48Z|refs/heads/master |
|
||||
|PushEvent|avb|2022-10-27T04:31:27Z|refs/heads/jitterSched|
|
||||
|
||||
| type | actor_login | created_at | payload_ref |
|
||||
| --------- | ----------- | -------------------- | ---------------------- |
|
||||
| PushEvent | avb | 2022-10-27T08:27:48Z | refs/heads/master |
|
||||
| PushEvent | avb | 2022-10-27T04:31:27Z | refs/heads/jitterSched |
|
||||
|
||||
Here is something
|
||||
|
||||
|
@ -83,4 +80,5 @@ A new thing.
|
|||
|
||||
## Weird stuff
|
||||
|
||||
* [{{#if done}}x{{else}} {{/if}}] [[{{page}}@{{pos}}]] {{name}} {{#if deadline}}📅 {{deadline}}{{/if}} {{#each tags}}{{.}} {{/each}}
|
||||
- [{{#if done}}x{{else}} {{/if}}] [[{{page}}@{{pos}}]] {{name}} {{#if
|
||||
deadline}}📅 {{deadline}}{{/if}} {{#each tags}}{{.}} {{/each}}
|
||||
|
|
|
@ -116,7 +116,7 @@ async function toggleTaskMarker(node: ParseTree, moveToPos: number) {
|
|||
const ref = wikiLink.children![0].text!;
|
||||
if (ref.includes("@")) {
|
||||
const [page, pos] = ref.split("@");
|
||||
let text = (await space.readPage(page));
|
||||
let text = await space.readPage(page);
|
||||
|
||||
const referenceMdTree = await markdown.parseMarkdown(text);
|
||||
// Adding +1 to immediately hit the task marker
|
||||
|
|
|
@ -11,7 +11,8 @@ import { decoratorStateField, isCursorInRange } from "./util.ts";
|
|||
|
||||
type AdmonitionType = "note" | "warning";
|
||||
|
||||
const ADMONITION_REGEX = /^>( *)\*{2}(Note|Warning)\*{2}( *)(.*)(?:\n([\s\S]*))?/im;
|
||||
const ADMONITION_REGEX =
|
||||
/^>( *)\*{2}(Note|Warning)\*{2}( *)(.*)(?:\n([\s\S]*))?/im;
|
||||
const ADMONITION_LINE_SPLIT_REGEX = /\n>/gm;
|
||||
|
||||
class AdmonitionIconWidget extends WidgetType {
|
||||
|
@ -36,10 +37,16 @@ class AdmonitionIconWidget extends WidgetType {
|
|||
|
||||
switch (this.type) {
|
||||
case "note":
|
||||
outerDiv.insertAdjacentHTML("beforeend", '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>');
|
||||
outerDiv.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>',
|
||||
);
|
||||
break;
|
||||
case "warning":
|
||||
outerDiv.insertAdjacentHTML("beforeend", '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>');
|
||||
outerDiv.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',
|
||||
);
|
||||
break;
|
||||
default:
|
||||
//
|
||||
|
@ -72,13 +79,19 @@ function extractAdmonitionFields(rawText: string): AdmonitionFields | null {
|
|||
const regexResults = rawText.match(ADMONITION_REGEX);
|
||||
|
||||
if (regexResults) {
|
||||
const preSpaces = regexResults[1] || '';
|
||||
const preSpaces = regexResults[1] || "";
|
||||
const admonitionType = regexResults[2].toLowerCase() as AdmonitionType;
|
||||
const postSpaces = regexResults[3] || '';
|
||||
const admonitionTitle: string = regexResults[4] || '';
|
||||
const admonitionContent: string = regexResults[5] || '';
|
||||
const postSpaces = regexResults[3] || "";
|
||||
const admonitionTitle: string = regexResults[4] || "";
|
||||
const admonitionContent: string = regexResults[5] || "";
|
||||
|
||||
return { preSpaces, admonitionType, postSpaces, admonitionTitle, admonitionContent };
|
||||
return {
|
||||
preSpaces,
|
||||
admonitionType,
|
||||
postSpaces,
|
||||
admonitionTitle,
|
||||
admonitionContent,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -112,7 +125,7 @@ export function admonitionPlugin(editor: Editor) {
|
|||
const fromOffsets: number[] = [];
|
||||
const lines = rawText.slice(1).split(ADMONITION_LINE_SPLIT_REGEX);
|
||||
let accum = from;
|
||||
lines.forEach(line => {
|
||||
lines.forEach((line) => {
|
||||
fromOffsets.push(accum);
|
||||
accum += line.length + 2;
|
||||
});
|
||||
|
@ -121,15 +134,16 @@ export function admonitionPlugin(editor: Editor) {
|
|||
// icon further down.
|
||||
const iconRange = {
|
||||
from: from + 1,
|
||||
to: from + preSpaces.length + 2 + admonitionType.length + 2 + postSpaces.length + 1,
|
||||
to: from + preSpaces.length + 2 + admonitionType.length + 2 +
|
||||
postSpaces.length + 1,
|
||||
};
|
||||
|
||||
const classes = ["sb-admonition"];
|
||||
switch (admonitionType) {
|
||||
case 'note':
|
||||
case "note":
|
||||
classes.push("sb-admonition-note");
|
||||
break;
|
||||
case 'warning':
|
||||
case "warning":
|
||||
classes.push("sb-admonition-warning");
|
||||
break;
|
||||
default:
|
||||
|
@ -138,12 +152,19 @@ export function admonitionPlugin(editor: Editor) {
|
|||
|
||||
// The first div is the title, attach relevant css classes
|
||||
widgets.push(
|
||||
Decoration.line({ class: "sb-admonition-title " + classes.join(" ") }).range(fromOffsets[0]),
|
||||
Decoration.line({
|
||||
class: "sb-admonition-title " + classes.join(" "),
|
||||
}).range(fromOffsets[0]),
|
||||
);
|
||||
|
||||
// If cursor is not within the first line, replace the **note|warning** text
|
||||
// with the correct icon
|
||||
if (!isCursorInRange(state, [from, fromOffsets.length > 1 ? fromOffsets[1] : to])) {
|
||||
if (
|
||||
!isCursorInRange(state, [
|
||||
from,
|
||||
fromOffsets.length > 1 ? fromOffsets[1] : to,
|
||||
])
|
||||
) {
|
||||
widgets.push(
|
||||
Decoration.replace({
|
||||
widget: new AdmonitionIconWidget(
|
||||
|
@ -152,13 +173,13 @@ export function admonitionPlugin(editor: Editor) {
|
|||
editor.editorView!,
|
||||
),
|
||||
inclusive: true,
|
||||
}).range(iconRange.from, iconRange.to)
|
||||
}).range(iconRange.from, iconRange.to),
|
||||
);
|
||||
}
|
||||
|
||||
// Each line of the blockquote is spread across separate divs, attach
|
||||
// relevant css classes here.
|
||||
fromOffsets.slice(1).forEach(fromOffset => {
|
||||
fromOffsets.slice(1).forEach((fromOffset) => {
|
||||
widgets.push(
|
||||
Decoration.line({ class: classes.join(" ") }).range(fromOffset),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue