mirror of
https://github.com/kou029w/quot.git
synced 2025-01-31 14:28:06 +00:00
Compare commits
8 commits
ad1e6ba9e4
...
85b02bf020
Author | SHA1 | Date | |
---|---|---|---|
85b02bf020 | |||
66a9f4b780 | |||
9de3c9ca98 | |||
ffffc8a506 | |||
7fe752ea59 | |||
e4463934ce | |||
3909e7d7be | |||
d1f107d2bf |
5 changed files with 40 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
@top Document { heading line* }
|
@top Document { heading line* }
|
||||||
|
|
||||||
heading { Heading? "\n" }
|
heading { Heading? "\n" }
|
||||||
line { Indent* ((AutoLink | word) space*)* "\n" }
|
line { Indent* ((AutoLink | Code | word) space*)* "\n" }
|
||||||
|
|
||||||
@tokens {
|
@tokens {
|
||||||
space { $[ \t] }
|
space { $[ \t] }
|
||||||
|
@ -9,5 +9,6 @@ line { Indent* ((AutoLink | word) space*)* "\n" }
|
||||||
Heading { ![\n]+ }
|
Heading { ![\n]+ }
|
||||||
Indent { space }
|
Indent { space }
|
||||||
AutoLink { ("http" | "https") "://" word }
|
AutoLink { ("http" | "https") "://" word }
|
||||||
@precedence { AutoLink, word }
|
Code { "`" ![`\n]+ "`" | ($[$%] " ") ![\n]+ }
|
||||||
|
@precedence { AutoLink, Code, word }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
import {LRParser} from "@lezer/lr"
|
import {LRParser} from "@lezer/lr"
|
||||||
export const parser = LRParser.deserialize({
|
export const parser = LRParser.deserialize({
|
||||||
version: 14,
|
version: 14,
|
||||||
states: "#rOQOPOOOOOO'#Cf'#CfOYOPO'#CfQ_OQOOOOOO,59Q,59QOOOO'#Cb'#CbOmOQO'#ChO{OSO'#CcOpOQO'#ChOOOO'#Ch'#ChOOOO'#Ca'#CaQ_OQOOOOOO-E6`-E6`O!ZOQO,59SOOOO,59S,59SOOOO'#Cd'#CdO!fOSO,58}OOOO-E6a-E6aOOOO-E6_-E6_OOOO1G.n1G.nOOOO-E6b-E6b",
|
states: "#rOQOPOOOOOO'#Cg'#CgOYOPO'#CgQ_OQOOOOOO,59R,59ROOOO'#Cc'#CcOpOQO'#CiO!ROSO'#CdOsOQO'#CiOOOO'#Ci'#CiOOOO'#Cb'#CbQ_OQOOOOOO-E6a-E6aO!dOQO,59TOOOO,59T,59TOOOO'#Ce'#CeO!rOSO,59OOOOO-E6b-E6bOOOO-E6`-E6`OOOO1G.o1G.oOOOO-E6c-E6c",
|
||||||
stateData: "!w~OQQOZPO~OZSO~ORTOSVOZXO]VO~ORTOSVOZ^O]VO~O^_OSVXZVX]VX~OSVOZcO]VO~O^_OSVaZVa]Va~OS]~",
|
stateData: "#Y~OQQO[PO~O[SO~ORTOSVOTVO[XO^VO~ORTOSVOTVO[^O^VO~O__OSWXTWX[WX^WX~OSVOTVO[cO^VO~O__OSWaTWa[Wa^Wa~OST^T~",
|
||||||
goto: "!T]PPPPP^dkvP|P!PQZRRbZSURZR[USWRZQ]UTaW]Q`VRd`RROTYRZ",
|
goto: "!U^PPPPPP_elwP}P!QQZRRbZSURZR[USWRZQ]UTaW]Q`VRd`RROTYRZ",
|
||||||
nodeNames: "⚠ Document Heading Indent AutoLink",
|
nodeNames: "⚠ Document Heading Indent AutoLink Code",
|
||||||
maxTerm: 14,
|
maxTerm: 15,
|
||||||
skippedNodes: [0],
|
skippedNodes: [0],
|
||||||
repeatNodeCount: 4,
|
repeatNodeCount: 4,
|
||||||
tokenData: "(U~RWOXkXY!^YZ!mZpkpq!^q#[k#[#]!r#]~kVrTQP]UOXkXY!RZpkpq!Rq~kP!WQQPOY!RZ~!RV!gQQPRQ^SOY!RZ~!R~!rOZ~V!yVQP]UOXkXY!RZpkpq!Rq#hk#h#i#`#i~kV#gVQP]UOXkXY!RZpkpq!Rq#hk#h#i#|#i~kV$TVQP]UOXkXY!RZpkpq!Rq#dk#d#e$j#e~kV$qXQP]UOXkXY!RZpkpq!Rq![k![!]%^!]#gk#g#h'h#h~kV%eVQP]UOXkXY!RZpkpq!Rq!Pk!P!Q%z!Q~kV&RVQP]UOXkXY!RZpkpq!Rq!Pk!P!Q&h!Q~kV&oTQP]UOX'OXY!RZp'Opq!Rq~'OV'XTQPSU]UOX'OXY!RZp'Opq!Rq~'OV'oVQP]UOXkXY!RZpkpq!Rq![k![!]%^!]~k",
|
tokenData: "+w~R]OXzXY!mYZ!|Zpzpq!mqtztu#Ruv#Rv#Sz#S#T$R#T#[z#[#]&e#]~zV!RTQP^UOXzXY!bZpzpq!bq~zP!gQQPOY!bZ~!bV!vQQPRQ_SOY!bZ~!b~#RO[~V#YTQP^UOXzXY!bZpzpq#iq~zV#nQQPOY#tZ~#tV#{QQPTUOY#tZ~#tV$YVQP^UOX$oXY%]Zp$opq%]q#S$o#S#Tz#T~$oV$vVQP^UOX$oXY%]Zp$opq%]q#S$o#S#T%{#T~$oV%bSQPOY%]Z#S%]#S#T%n#T~%]V%uQQPTUOY!bZ~!bV&UTQPTU^UOXzXY!bZpzpq!bq~zV&lVQP^UOXzXY!bZpzpq!bq#hz#h#i'R#i~zV'YVQP^UOXzXY!bZpzpq!bq#hz#h#i'o#i~zV'vVQP^UOXzXY!bZpzpq!bq#dz#d#e(]#e~zV(dXQP^UOXzXY!bZpzpq!bq![z![!])P!]#gz#g#h+Z#h~zV)WVQP^UOXzXY!bZpzpq!bq!Pz!P!Q)m!Q~zV)tVQP^UOXzXY!bZpzpq!bq!Pz!P!Q*Z!Q~zV*bTQP^UOX*qXY!bZp*qpq!bq~*qV*zTQPSU^UOX*qXY!bZp*qpq!bq~*qV+bVQP^UOXzXY!bZpzpq!bq![z![!])P!]~z",
|
||||||
tokenizers: [0, 1, 2],
|
tokenizers: [0, 1, 2],
|
||||||
topRules: {"Document":[0,1]},
|
topRules: {"Document":[0,1]},
|
||||||
tokenPrec: 82
|
tokenPrec: 97
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,7 @@ export const quotLanguage = LRLanguage.define({
|
||||||
Heading: t.heading,
|
Heading: t.heading,
|
||||||
Indent: t.separator,
|
Indent: t.separator,
|
||||||
AutoLink: t.link,
|
AutoLink: t.link,
|
||||||
|
Code: t.monospace,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -29,10 +30,22 @@ export const quotHighlighting = syntaxHighlighting(
|
||||||
{
|
{
|
||||||
tag: t.separator,
|
tag: t.separator,
|
||||||
letterSpacing: "1.5em",
|
letterSpacing: "1.5em",
|
||||||
|
"&:last-child:after": {
|
||||||
|
content: `"•"`,
|
||||||
|
marginInline: "-0.9em",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: t.link,
|
tag: t.link,
|
||||||
class: "auto-link",
|
class: "auto-link",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
tag: t.monospace,
|
||||||
|
background: "var(--nc-bg-3)",
|
||||||
|
borderRadius: "0.25em",
|
||||||
|
padding: "0.2em 0.4em",
|
||||||
|
fontSize: "0.9em",
|
||||||
|
fontFamily: "var(--nc-font-mono)",
|
||||||
|
},
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
--nc-ac-tx: var(--nc-tx-1);
|
--nc-ac-tx: var(--nc-tx-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--nc-lk-1: #66adff;
|
||||||
|
--nc-lk-2: #a8caf0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding-inline: 0.75rem;
|
padding-inline: 0.75rem;
|
||||||
max-inline-size: 80rem;
|
max-inline-size: 80rem;
|
||||||
|
@ -31,10 +38,13 @@ header h1 > :is(a, a:hover) {
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav > * {
|
header nav > * {
|
||||||
margin: 0.75rem;
|
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header nav > * + * {
|
||||||
|
margin-inline-start: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
a[href^="/"] {
|
a[href^="/"] {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { onCleanup, onMount } from "solid-js";
|
import { onCleanup, onMount } from "solid-js";
|
||||||
import { minimalSetup } from "codemirror";
|
import { minimalSetup } from "codemirror";
|
||||||
import { emacsStyleKeymap, indentWithTab } from "@codemirror/commands";
|
import { emacsStyleKeymap, indentWithTab } from "@codemirror/commands";
|
||||||
import { indentUnit } from "@codemirror/language";
|
import { indentService, indentUnit } from "@codemirror/language";
|
||||||
import { EditorView, keymap } from "@codemirror/view";
|
import { EditorView, keymap } from "@codemirror/view";
|
||||||
import type Pages from "../../protocol/pages";
|
import type Pages from "../../protocol/pages";
|
||||||
import "./editor.css";
|
import "./editor.css";
|
||||||
|
@ -37,6 +37,11 @@ export default (props: {
|
||||||
}),
|
}),
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
indentUnit.of(" "),
|
indentUnit.of(" "),
|
||||||
|
indentService.of((context, pos) => {
|
||||||
|
const previousLine = context.lineAt(pos, -1).text;
|
||||||
|
if (previousLine.trim() === "") return null;
|
||||||
|
return /^[ \t]*/.exec(previousLine)?.[0]?.length ?? null;
|
||||||
|
}),
|
||||||
keymap.of([indentWithTab, ...emacsStyleKeymap]),
|
keymap.of([indentWithTab, ...emacsStyleKeymap]),
|
||||||
minimalSetup,
|
minimalSetup,
|
||||||
quotLanguage,
|
quotLanguage,
|
||||||
|
|
Loading…
Add table
Reference in a new issue