package lexers
import (
. "github.com/alecthomas/chroma/v2"
)
var Markless = Register (MustNewLexer (
&Config {
Name : "Markless" ,
Aliases : []string {"mess" },
Filenames : []string {"*.mess" , "*.markless" },
MimeTypes : []string {"text/x-markless" },
},
marklessRules ,
))
func marklessRules() Rules {
return Rules {
"root" : {
Include ("block" ),
},
"block" : {
Include ("header" ),
Include ("ordered-list" ),
Include ("unordered-list" ),
Include ("code-block" ),
Include ("blockquote" ),
Include ("blockquote-header" ),
Include ("align" ),
Include ("comment" ),
Include ("instruction" ),
Include ("embed" ),
Include ("footnote" ),
Include ("horizontal-rule" ),
Include ("paragraph" ),
},
"header" : {
{`(# )(.*)$` , ByGroups (Keyword , GenericHeading ), Push ("inline" )},
{`(##+)(.*)$` , ByGroups (Keyword , GenericSubheading ), Push ("inline" )},
},
"ordered-list" : {
{`([0-9]+\.)` , Keyword , nil },
},
"unordered-list" : {
{`(- )` , Keyword , nil },
},
"code-block" : {
{`(::+)( *)(\w*)([^\n]*)(\n)([\w\W]*?)(^\1$)` , UsingByGroup (3 , 6 , Keyword , TextWhitespace , NameFunction , String , TextWhitespace , Text , Keyword ), nil },
},
"blockquote" : {
{`(\| )(.*)$` , ByGroups (Keyword , GenericInserted ), nil },
},
"blockquote-header" : {
{`(~ )([^|\n]+)(\| )(.*?\n)` , ByGroups (Keyword , NameEntity , Keyword , GenericInserted ), Push ("inline-blockquote" )},
{`(~ )(.*)$` , ByGroups (Keyword , NameEntity ), nil },
},
"inline-blockquote" : {
{`^( +)(\| )(.*$)` , ByGroups (TextWhitespace , Keyword , GenericInserted ), nil },
Default (Pop (1 )),
},
"align" : {
{`(\|\|)|(\|<)|(\|>)|(><)` , Keyword , nil },
},
"comment" : {
{`(;[; ]).*?$` , CommentSingle , nil },
},
"instruction" : {
{`(! )([^ ]+)(.+?)$` , ByGroups (Keyword , NameFunction , NameVariable ), nil },
},
"embed" : {
{`(\[ )([^ ]+)( )([^,\]\n]+)` , ByGroups (Keyword , NameFunction , TextWhitespace , String ), Push ("embed-options" )},
},
"embed-options" : {
{`\\.` , Text , nil },
{`,` , Punctuation , nil },
{`\]?$` , Keyword , Pop (1 )},
{`( *)([^, \]\n]+)([^,\]\n]+)?` , ByGroups (TextWhitespace , NameFunction , String ), nil },
{`.` , Text , nil },
},
"footnote" : {
{`(\[)([0-9]+)(\])` , ByGroups (Keyword , NameVariable , Keyword ), Push ("inline" )},
},
"horizontal-rule" : {
{`(==+)$` , LiteralOther , nil },
},
"paragraph" : {
{` *` , TextWhitespace , Push ("inline" )},
},
"inline" : {
Include ("escapes" ),
Include ("dashes" ),
Include ("newline" ),
Include ("italic" ),
Include ("underline" ),
Include ("bold" ),
Include ("strikethrough" ),
Include ("code" ),
Include ("compound" ),
Include ("footnote-reference" ),
Include ("subtext" ),
Include ("subtext" ),
Include ("url" ),
{`.` , Text , nil },
{`\n` , TextWhitespace , Pop (1 )},
},
"escapes" : {
{`\\.` , Text , nil },
},
"dashes" : {
{`-{2,3}` , TextPunctuation , nil },
},
"newline" : {
{`-/-` , TextWhitespace , nil },
},
"italic" : {
{`(//)(.*?)(\1)` , ByGroups (Keyword , GenericEmph , Keyword ), nil },
},
"underline" : {
{`(__)(.*?)(\1)` , ByGroups (Keyword , GenericUnderline , Keyword ), nil },
},
"bold" : {
{`(\*\*)(.*?)(\1)` , ByGroups (Keyword , GenericStrong , Keyword ), nil },
},
"strikethrough" : {
{`(<-)(.*?)(->)` , ByGroups (Keyword , GenericDeleted , Keyword ), nil },
},
"code" : {
{"(``+)(.*?)(\\1)" , ByGroups (Keyword , LiteralStringBacktick , Keyword ), nil },
},
"compound" : {
{`(''+)(.*?)(''\()` , ByGroups (Keyword , UsingSelf ("inline" ), Keyword ), Push ("compound-options" )},
},
"compound-options" : {
{`\\.` , Text , nil },
{`,` , Punctuation , nil },
{`\)` , Keyword , Pop (1 )},
{` *#[0-9A-Fa-f]{3,6} *` , LiteralNumberHex , nil },
{` *(indian-red|light-coral|salmon|dark-salmon|light-salmon|crimson|red|firebrick|dark-red|pink|light-pink|hot-pink|deep-pink|medium-violet-red|pale-violet-red|coral|tomato|orange-red|dark-orange|orange|gold|yellow|light-yellow|lemon-chiffon|light-goldenrod-yellow|papayawhip|moccasin|peachpuff|pale-goldenrod|khaki|dark-khaki|lavender|thistle|plum|violet|orchid|fuchsia|magenta|medium-orchid|medium-purple|rebecca-purple|blue-violet|dark-violet|dark-orchid|dark-magenta|purple|indigo|slate-blue|dark-slate-blue|medium-slate-blue|green-yellow|chartreuse|lawn-green|lime|lime-green|pale-green|light-green|medium-spring-green|spring-green|medium-sea-green|sea-green|forest-green|green|dark-green|yellow-green|olive-drab|olive|dark-olive-green|medium-aquamarine|dark-sea-green|light-sea-green|dark-cyan|teal|aqua|cyan|light-cyan|pale-turquoise|aquamarine|turquoise|medium-turquoise|dark-turquoise|cadet-blue|steel-blue|light-steel-blue|powder-blue|light-blue|sky-blue|light-sky-blue|deep-sky-blue|dodger-blue|cornflower-blue|royal-blue|blue|medium-blue|dark-blue|navy|midnight-blue|cornsilk|blanched-almond|bisque|navajo-white|wheat|burlywood|tan|rosy-brown|sandy-brown|goldenrod|dark-goldenrod|peru|chocolate|saddle-brown|sienna|brown|maroon|white|snow|honeydew|mintcream|azure|alice-blue|ghost-white|white-smoke|seashell|beige|oldlace|floral-white|ivory|antique-white|linen|lavenderblush|mistyrose|gainsboro|light-gray|silver|dark-gray|gray|dim-gray|light-slate-gray|slate-gray|dark-slate-gray) *` , LiteralOther , nil },
{` *(microscopic|tiny|small|normal|big|large|huge|gigantic) *` , NameTag , nil },
{` *(bold|italic|underline|strikethrough|subtext|supertext|spoiler) *` , NameBuiltin , nil },
{` *\w[-\w+.]*://[\w$\-_.+!*'(&/:;=?@z%#\\]+ *` , String , nil },
{`( *)([^, )]+)( [^,)]+)?` , ByGroups (TextWhitespace , NameFunction , String ), nil },
{`.` , Text , nil },
},
"footnote-reference" : {
{`(\[)([0-9]+)(\])` , ByGroups (Keyword , NameVariable , Keyword ), nil },
},
"subtext" : {
{`(v\()(.*?)(\))` , ByGroups (Keyword , UsingSelf ("inline" ), Keyword ), nil },
},
"supertext" : {
{`(\^\()(.*?)(\))` , ByGroups (Keyword , UsingSelf ("inline" ), Keyword ), nil },
},
"url" : {
{`\w[-\w+.]*://[\w\$\-_.+!*'()&,/:;=?@z%#\\]+` , String , nil },
},
}
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .