mirror of
https://github.com/kou029w/quot.git
synced 2025-01-31 06:18:01 +00:00
support code syntax
This commit is contained in:
parent
7fe752ea59
commit
ffffc8a506
4 changed files with 24 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
@top Document { heading line* }
|
||||
|
||||
heading { Heading? "\n" }
|
||||
line { Indent* ((AutoLink | word) space*)* "\n" }
|
||||
line { Indent* ((AutoLink | Code | word) space*)* "\n" }
|
||||
|
||||
@tokens {
|
||||
space { $[ \t] }
|
||||
|
@ -9,5 +9,6 @@ line { Indent* ((AutoLink | word) space*)* "\n" }
|
|||
Heading { ![\n]+ }
|
||||
Indent { space }
|
||||
AutoLink { ("http" | "https") "://" word }
|
||||
@precedence { AutoLink, word }
|
||||
Code { "`" ![`\n]+ "`" | ($[$%] " ") ![\n]+ }
|
||||
@precedence { AutoLink, Code, word }
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
import {LRParser} from "@lezer/lr"
|
||||
export const parser = LRParser.deserialize({
|
||||
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",
|
||||
stateData: "!w~OQQOZPO~OZSO~ORTOSVOZXO]VO~ORTOSVOZ^O]VO~O^_OSVXZVX]VX~OSVOZcO]VO~O^_OSVaZVa]Va~OS]~",
|
||||
goto: "!T]PPPPP^dkvP|P!PQZRRbZSURZR[USWRZQ]UTaW]Q`VRd`RROTYRZ",
|
||||
nodeNames: "⚠ Document Heading Indent AutoLink",
|
||||
maxTerm: 14,
|
||||
states: "#rOQOPOOOOOO'#Cg'#CgOYOPO'#CgQ_OQOOOOOO,59R,59ROO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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],
|
||||
topRules: {"Document":[0,1]},
|
||||
tokenPrec: 82
|
||||
tokenPrec: 97
|
||||
})
|
||||
|
|
|
@ -13,6 +13,7 @@ export const quotLanguage = LRLanguage.define({
|
|||
Heading: t.heading,
|
||||
Indent: t.separator,
|
||||
AutoLink: t.link,
|
||||
Code: t.monospace,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
@ -38,5 +39,9 @@ export const quotHighlighting = syntaxHighlighting(
|
|||
tag: t.link,
|
||||
class: "auto-link",
|
||||
},
|
||||
{
|
||||
tag: t.monospace,
|
||||
class: "code",
|
||||
},
|
||||
])
|
||||
);
|
||||
|
|
|
@ -35,3 +35,12 @@
|
|||
color: var(--nc-lk-2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editor .code {
|
||||
background: var(--nc-bg-3);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.2rem 0.4rem;
|
||||
font-size: 0.9rem;
|
||||
font-family: var(--nc-font-mono);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue