diff --git a/go.mod b/go.mod index 2edee626..07303804 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,8 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Masterminds/sprig v2.22.0+incompatible - github.com/frustra/bbcode v0.0.0-20201127003707-6ef347fbe1c8 // indirect + github.com/alecthomas/chroma v0.9.2 + github.com/frustra/bbcode v0.0.0-20201127003707-6ef347fbe1c8 github.com/go-stack/stack v1.8.0 github.com/google/uuid v1.2.0 github.com/huandu/xstrings v1.3.2 // indirect @@ -15,13 +16,14 @@ require ( github.com/jackc/pgtype v1.6.2 github.com/jackc/pgx/v4 v4.10.1 github.com/mitchellh/copystructure v1.1.1 // indirect - github.com/rs/zerolog v1.20.0 + github.com/rs/zerolog v1.21.0 github.com/spf13/cobra v1.1.3 github.com/stretchr/testify v1.7.0 github.com/teacat/noire v1.1.0 github.com/wellington/go-libsass v0.9.2 github.com/yuin/goldmark v1.3.7 + github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 ) -replace github.com/rs/zerolog v1.20.0 => github.com/bvisness/zerolog v1.20.1-0.20210321191248-05f63bf0e9e0 +replace github.com/frustra/bbcode v0.0.0-20201127003707-6ef347fbe1c8 => github.com/bvisness/bbcode v0.0.0-20210623031351-ec0e2e2e39d9 diff --git a/go.sum b/go.sum index f21765df..9ba727dc 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,17 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= +github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= +github.com/alecthomas/chroma v0.7.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= +github.com/alecthomas/chroma v0.9.2 h1:yU1sE2+TZbLIQPMk30SolL2Hn53SR/Pv750f7qZ/XMs= +github.com/alecthomas/chroma v0.9.2/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk= +github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= +github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= +github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= +github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= +github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= +github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -29,8 +40,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bvisness/zerolog v1.20.1-0.20210321191248-05f63bf0e9e0 h1:2FrBN+MEMyGgts3Sm9M+6sMR6cMYEZ8+4fvotGFtRNE= -github.com/bvisness/zerolog v1.20.1-0.20210321191248-05f63bf0e9e0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM= +github.com/bvisness/bbcode v0.0.0-20210623031351-ec0e2e2e39d9 h1:gew4wjAHhzk3hDsMljZGeBpILp972yDjYXGoSP57mzs= +github.com/bvisness/bbcode v0.0.0-20210623031351-ec0e2e2e39d9/go.mod h1:8jLyeA/BGisSvIXbNmRUQv3tdcjiAi2opLVdt3bt6oM= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= @@ -43,14 +54,18 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= +github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/frustra/bbcode v0.0.0-20201127003707-6ef347fbe1c8 h1:sdIsYe6Vv7KIWZWp8KqSeTl+XlF17d+wHCC4lbxFcYs= -github.com/frustra/bbcode v0.0.0-20201127003707-6ef347fbe1c8/go.mod h1:0QBxkXxN+o4FyZgLI9FHY/oUizheze3+bNY/kgCKL+4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -194,10 +209,12 @@ github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcncea github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -240,10 +257,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/rs/zerolog v1.21.0 h1:Q3vdXlfLNT+OftyBHsU0Y445MD+8m8axjKgf2si0QcM= +github.com/rs/zerolog v1.21.0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -282,8 +303,11 @@ github.com/wellington/go-libsass v0.9.2 h1:6Ims04UDdBs6/CGSVK5JC8FNikR5ssrsMMKE/ github.com/wellington/go-libsass v0.9.2/go.mod h1:mxgxgam0N0E+NAUMHLcu20Ccfc3mVpDkyrLDayqfiTs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.6/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.7 h1:NSaHgaeJFCtWXCBkBKXw0rhgMuJ0VoE9FB5mWldcrQ4= github.com/yuin/goldmark v1.3.7/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01 h1:0SJnXjE4jDClMW6grE0xpNhwpqbPwkBTn8zpVw5C0SI= +github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01/go.mod h1:TwKQPa5XkCCRC2GRZ5wtfNUTQ2+9/i19mGRijFeJ4BE= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -361,6 +385,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -375,6 +400,7 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= diff --git a/public/parsing.wasm b/public/parsing.wasm index 85a85d6d..eb7f349c 100644 Binary files a/public/parsing.wasm and b/public/parsing.wasm differ diff --git a/public/style.css b/public/style.css index cd46ccc4..548fb10f 100644 --- a/public/style.css +++ b/public/style.css @@ -1173,7 +1173,7 @@ img, video { .br1 { border-radius: 0.125rem; } -.br2 { +.br2, .hmn-code { border-radius: 0.25rem; } .br3 { @@ -6952,272 +6952,212 @@ For convenience in common cases, if only a single argument is provided and it does not match an existing variable, this will throw an error. */ -/* bbcode [code] -- see: https://github.com/richleland/pygments-css/blob/master/friendly.css */ -.codeblock .hll { - background-color: #ffffcc; } +.hmn-code, .codeblock { + /* Comment */ + /* Error */ + /* Keyword */ + /* Operator */ + /* Comment.Multiline */ + /* Comment.Preproc */ + /* Comment.Single */ + /* Comment.Special */ + /* Generic.Deleted */ + /* Generic.Emph */ + /* Generic.Error */ + /* Generic.Heading */ + /* Generic.Inserted */ + /* Generic.Output */ + /* Generic.Prompt */ + /* Generic.Strong */ + /* Generic.Subheading */ + /* Generic.Traceback */ + /* Keyword.Constant */ + /* Keyword.Declaration */ + /* Keyword.Namespace */ + /* Keyword.Pseudo */ + /* Keyword.Reserved */ + /* Keyword.Type */ + /* Literal.Number */ + /* Literal.String */ + /* Name.Attribute */ + /* Name.Builtin */ + /* Name.Class */ + /* Name.Constant */ + /* Name.Decorator */ + /* Name.Entity */ + /* Name.Exception */ + /* Name.Function */ + /* Name.Label */ + /* Name.Namespace */ + /* Name.Tag */ + /* Name.Variable */ + /* Operator.Word */ + /* Text.Whitespace */ + /* Literal.Number.Float */ + /* Literal.Number.Hex */ + /* Literal.Number.Integer */ + /* Literal.Number.Oct */ + /* Literal.String.Backtick */ + /* Literal.String.Char */ + /* Literal.String.Doc */ + /* Literal.String.Double */ + /* Literal.String.Escape */ + /* Literal.String.Heredoc */ + /* Literal.String.Interpol */ + /* Literal.String.Other */ + /* Literal.String.Regex */ + /* Literal.String.Single */ + /* Literal.String.Symbol */ + /* Name.Builtin.Pseudo */ + /* Name.Variable.Class */ + /* Name.Variable.Global */ + /* Name.Variable.Instance */ + /* Literal.Number.Integer.Long */ } + .hmn-code .hll, .codeblock .hll { + background-color: #ffffcc; } + .hmn-code .c, .codeblock .c { + color: #60a0b0; + font-style: italic; } + .hmn-code .err, .codeblock .err { + color: #FF0000; } + .hmn-code .k, .codeblock .k { + color: #007020; + font-weight: bold; } + .hmn-code .o, .codeblock .o { + color: #666666; } + .hmn-code .cm, .codeblock .cm { + color: #60a0b0; + font-style: italic; } + .hmn-code .cp, .codeblock .cp { + color: #007020; } + .hmn-code .c1, .codeblock .c1 { + color: #60a0b0; + font-style: italic; } + .hmn-code .cs, .codeblock .cs { + color: #60a0b0; + background-color: #fff0f0; } + .hmn-code .gd, .codeblock .gd { + color: #A00000; } + .hmn-code .ge, .codeblock .ge { + font-style: italic; } + .hmn-code .gr, .codeblock .gr { + color: #FF0000; } + .hmn-code .gh, .codeblock .gh { + color: #000080; + font-weight: bold; } + .hmn-code .gi, .codeblock .gi { + color: #00A000; } + .hmn-code .go, .codeblock .go { + color: #808080; } + .hmn-code .gp, .codeblock .gp { + color: #c65d09; + font-weight: bold; } + .hmn-code .gs, .codeblock .gs { + font-weight: bold; } + .hmn-code .gu, .codeblock .gu { + color: #800080; + font-weight: bold; } + .hmn-code .gt, .codeblock .gt { + color: #0040D0; } + .hmn-code .kc, .codeblock .kc { + color: #007020; + font-weight: bold; } + .hmn-code .kd, .codeblock .kd { + color: #007020; + font-weight: bold; } + .hmn-code .kn, .codeblock .kn { + color: #007020; + font-weight: bold; } + .hmn-code .kp, .codeblock .kp { + color: #007020; } + .hmn-code .kr, .codeblock .kr { + color: #007020; + font-weight: bold; } + .hmn-code .kt, .codeblock .kt { + color: #902000; } + .hmn-code .m, .codeblock .m { + color: #40a070; } + .hmn-code .s, .codeblock .s { + color: #4070a0; } + .hmn-code .na, .codeblock .na { + color: #4070a0; } + .hmn-code .nb, .codeblock .nb { + color: #007020; } + .hmn-code .nc, .codeblock .nc { + color: #0e84b5; + font-weight: bold; } + .hmn-code .no, .codeblock .no { + color: #60add5; } + .hmn-code .nd, .codeblock .nd { + color: #555555; + font-weight: bold; } + .hmn-code .ni, .codeblock .ni { + color: #d55537; + font-weight: bold; } + .hmn-code .ne, .codeblock .ne { + color: #007020; } + .hmn-code .nf, .codeblock .nf { + color: #06287e; } + .hmn-code .nl, .codeblock .nl { + color: #002070; + font-weight: bold; } + .hmn-code .nn, .codeblock .nn { + color: #0e84b5; + font-weight: bold; } + .hmn-code .nt, .codeblock .nt { + color: #062873; + font-weight: bold; } + .hmn-code .nv, .codeblock .nv { + color: #bb60d5; } + .hmn-code .ow, .codeblock .ow { + color: #007020; + font-weight: bold; } + .hmn-code .w, .codeblock .w { + color: #bbbbbb; } + .hmn-code .mf, .codeblock .mf { + color: #40a070; } + .hmn-code .mh, .codeblock .mh { + color: #40a070; } + .hmn-code .mi, .codeblock .mi { + color: #40a070; } + .hmn-code .mo, .codeblock .mo { + color: #40a070; } + .hmn-code .sb, .codeblock .sb { + color: #4070a0; } + .hmn-code .sc, .codeblock .sc { + color: #4070a0; } + .hmn-code .sd, .codeblock .sd { + color: #4070a0; + font-style: italic; } + .hmn-code .s2, .codeblock .s2 { + color: #4070a0; } + .hmn-code .se, .codeblock .se { + color: #4070a0; + font-weight: bold; } + .hmn-code .sh, .codeblock .sh { + color: #4070a0; } + .hmn-code .si, .codeblock .si { + color: #70a0d0; + font-style: italic; } + .hmn-code .sx, .codeblock .sx { + color: #c65d09; } + .hmn-code .sr, .codeblock .sr { + color: #235388; } + .hmn-code .s1, .codeblock .s1 { + color: #4070a0; } + .hmn-code .ss, .codeblock .ss { + color: #517918; } + .hmn-code .bp, .codeblock .bp { + color: #007020; } + .hmn-code .vc, .codeblock .vc { + color: #bb60d5; } + .hmn-code .vg, .codeblock .vg { + color: #bb60d5; } + .hmn-code .vi, .codeblock .vi { + color: #bb60d5; } + .hmn-code .il, .codeblock .il { + color: #40a070; } -.codeblock .c { - color: #60a0b0; - font-style: italic; } - -/* Comment */ -.codeblock .err { - color: #FF0000; } - -/* Error */ -.codeblock .k { - color: #007020; - font-weight: bold; } - -/* Keyword */ -.codeblock .o { - color: #666666; } - -/* Operator */ -.codeblock .cm { - color: #60a0b0; - font-style: italic; } - -/* Comment.Multiline */ -.codeblock .cp { - color: #007020; } - -/* Comment.Preproc */ -.codeblock .c1 { - color: #60a0b0; - font-style: italic; } - -/* Comment.Single */ -.codeblock .cs { - color: #60a0b0; - background-color: #fff0f0; } - -/* Comment.Special */ -.codeblock .gd { - color: #A00000; } - -/* Generic.Deleted */ -.codeblock .ge { - font-style: italic; } - -/* Generic.Emph */ -.codeblock .gr { - color: #FF0000; } - -/* Generic.Error */ -.codeblock .gh { - color: #000080; - font-weight: bold; } - -/* Generic.Heading */ -.codeblock .gi { - color: #00A000; } - -/* Generic.Inserted */ -.codeblock .go { - color: #808080; } - -/* Generic.Output */ -.codeblock .gp { - color: #c65d09; - font-weight: bold; } - -/* Generic.Prompt */ -.codeblock .gs { - font-weight: bold; } - -/* Generic.Strong */ -.codeblock .gu { - color: #800080; - font-weight: bold; } - -/* Generic.Subheading */ -.codeblock .gt { - color: #0040D0; } - -/* Generic.Traceback */ -.codeblock .kc { - color: #007020; - font-weight: bold; } - -/* Keyword.Constant */ -.codeblock .kd { - color: #007020; - font-weight: bold; } - -/* Keyword.Declaration */ -.codeblock .kn { - color: #007020; - font-weight: bold; } - -/* Keyword.Namespace */ -.codeblock .kp { - color: #007020; } - -/* Keyword.Pseudo */ -.codeblock .kr { - color: #007020; - font-weight: bold; } - -/* Keyword.Reserved */ -.codeblock .kt { - color: #902000; } - -/* Keyword.Type */ -.codeblock .m { - color: #40a070; } - -/* Literal.Number */ -.codeblock .s { - color: #4070a0; } - -/* Literal.String */ -.codeblock .na { - color: #4070a0; } - -/* Name.Attribute */ -.codeblock .nb { - color: #007020; } - -/* Name.Builtin */ -.codeblock .nc { - color: #0e84b5; - font-weight: bold; } - -/* Name.Class */ -.codeblock .no { - color: #60add5; } - -/* Name.Constant */ -.codeblock .nd { - color: #555555; - font-weight: bold; } - -/* Name.Decorator */ -.codeblock .ni { - color: #d55537; - font-weight: bold; } - -/* Name.Entity */ -.codeblock .ne { - color: #007020; } - -/* Name.Exception */ -.codeblock .nf { - color: #06287e; } - -/* Name.Function */ -.codeblock .nl { - color: #002070; - font-weight: bold; } - -/* Name.Label */ -.codeblock .nn { - color: #0e84b5; - font-weight: bold; } - -/* Name.Namespace */ -.codeblock .nt { - color: #062873; - font-weight: bold; } - -/* Name.Tag */ -.codeblock .nv { - color: #bb60d5; } - -/* Name.Variable */ -.codeblock .ow { - color: #007020; - font-weight: bold; } - -/* Operator.Word */ -.codeblock .w { - color: #bbbbbb; } - -/* Text.Whitespace */ -.codeblock .mf { - color: #40a070; } - -/* Literal.Number.Float */ -.codeblock .mh { - color: #40a070; } - -/* Literal.Number.Hex */ -.codeblock .mi { - color: #40a070; } - -/* Literal.Number.Integer */ -.codeblock .mo { - color: #40a070; } - -/* Literal.Number.Oct */ -.codeblock .sb { - color: #4070a0; } - -/* Literal.String.Backtick */ -.codeblock .sc { - color: #4070a0; } - -/* Literal.String.Char */ -.codeblock .sd { - color: #4070a0; - font-style: italic; } - -/* Literal.String.Doc */ -.codeblock .s2 { - color: #4070a0; } - -/* Literal.String.Double */ -.codeblock .se { - color: #4070a0; - font-weight: bold; } - -/* Literal.String.Escape */ -.codeblock .sh { - color: #4070a0; } - -/* Literal.String.Heredoc */ -.codeblock .si { - color: #70a0d0; - font-style: italic; } - -/* Literal.String.Interpol */ -.codeblock .sx { - color: #c65d09; } - -/* Literal.String.Other */ -.codeblock .sr { - color: #235388; } - -/* Literal.String.Regex */ -.codeblock .s1 { - color: #4070a0; } - -/* Literal.String.Single */ -.codeblock .ss { - color: #517918; } - -/* Literal.String.Symbol */ -.codeblock .bp { - color: #007020; } - -/* Name.Builtin.Pseudo */ -.codeblock .vc { - color: #bb60d5; } - -/* Name.Variable.Class */ -.codeblock .vg { - color: #bb60d5; } - -/* Name.Variable.Global */ -.codeblock .vi { - color: #bb60d5; } - -/* Name.Variable.Instance */ -.codeblock .il { - color: #40a070; } - -/* Literal.Number.Integer.Long */ .dark { background-color: #222; color: #bbb; } @@ -7997,7 +7937,12 @@ header { background-color: black; } pre { - font-family: monospace; } + font-family: "Fira Mono", monospace; } + +.hmn-code { + background-color: #f0f0f0; + background-color: var(--dim-background); + padding: 0.7em; } .toolbar { background-color: #fff; diff --git a/public/themes/dark/theme.css b/public/themes/dark/theme.css index d1815213..c8a4dd41 100644 --- a/public/themes/dark/theme.css +++ b/public/themes/dark/theme.css @@ -18,255 +18,194 @@ For convenience in common cases, if only a single argument is provided and it does not match an existing variable, this will throw an error. */ -/* bbcode [code] -- see: https://github.com/richleland/pygments-css/blob/master/monokai.css */ -.codeblock .hll { - background-color: #49483e; } +.hmn-code, .codeblock { + /* Comment */ + /* Error */ + /* Keyword */ + /* Literal */ + /* Name */ + /* Operator */ + /* Punctuation */ + /* Comment.Multiline */ + /* Comment.Preproc */ + /* Comment.Single */ + /* Comment.Special */ + /* Generic.Emph */ + /* Generic.Strong */ + /* Keyword.Constant */ + /* Keyword.Declaration */ + /* Keyword.Namespace */ + /* Keyword.Pseudo */ + /* Keyword.Reserved */ + /* Keyword.Type */ + /* Literal.Date */ + /* Literal.Number */ + /* Literal.String */ + /* Name.Attribute */ + /* Name.Builtin */ + /* Name.Class */ + /* Name.Constant */ + /* Name.Decorator */ + /* Name.Entity */ + /* Name.Exception */ + /* Name.Function */ + /* Name.Label */ + /* Name.Namespace */ + /* Name.Other */ + /* Name.Property */ + /* Name.Tag */ + /* Name.Variable */ + /* Operator.Word */ + /* Text.Whitespace */ + /* Literal.Number.Float */ + /* Literal.Number.Hex */ + /* Literal.Number.Integer */ + /* Literal.Number.Oct */ + /* Literal.String.Backtick */ + /* Literal.String.Char */ + /* Literal.String.Doc */ + /* Literal.String.Double */ + /* Literal.String.Escape */ + /* Literal.String.Heredoc */ + /* Literal.String.Interpol */ + /* Literal.String.Other */ + /* Literal.String.Regex */ + /* Literal.String.Single */ + /* Literal.String.Symbol */ + /* Name.Builtin.Pseudo */ + /* Name.Variable.Class */ + /* Name.Variable.Global */ + /* Name.Variable.Instance */ + /* Literal.Number.Integer.Long */ + /* Generic Heading & Diff Header */ + /* Generic.Subheading & Diff Unified/Comment? */ + /* Generic.Deleted & Diff Deleted */ + /* Generic.Inserted & Diff Inserted */ } + .hmn-code .hll, .codeblock .hll { + background-color: #49483e; } + .hmn-code .c, .codeblock .c { + color: #75715e; } + .hmn-code .err, .codeblock .err { + color: #ff0000; } + .hmn-code .k, .codeblock .k { + color: #66d9ef; } + .hmn-code .l, .codeblock .l { + color: #ae81ff; } + .hmn-code .n, .codeblock .n { + color: #f8f8f2; } + .hmn-code .o, .codeblock .o { + color: #f92672; } + .hmn-code .p, .codeblock .p { + color: #f8f8f2; } + .hmn-code .cm, .codeblock .cm { + color: #75715e; } + .hmn-code .cp, .codeblock .cp { + color: #75715e; } + .hmn-code .c1, .codeblock .c1 { + color: #75715e; } + .hmn-code .cs, .codeblock .cs { + color: #75715e; } + .hmn-code .ge, .codeblock .ge { + font-style: italic; } + .hmn-code .gs, .codeblock .gs { + font-weight: bold; } + .hmn-code .kc, .codeblock .kc { + color: #66d9ef; } + .hmn-code .kd, .codeblock .kd { + color: #66d9ef; } + .hmn-code .kn, .codeblock .kn { + color: #f92672; } + .hmn-code .kp, .codeblock .kp { + color: #66d9ef; } + .hmn-code .kr, .codeblock .kr { + color: #66d9ef; } + .hmn-code .kt, .codeblock .kt { + color: #66d9ef; } + .hmn-code .ld, .codeblock .ld { + color: #e6db74; } + .hmn-code .m, .codeblock .m { + color: #ae81ff; } + .hmn-code .s, .codeblock .s { + color: #e6db74; } + .hmn-code .na, .codeblock .na { + color: #a6e22e; } + .hmn-code .nb, .codeblock .nb { + color: #f8f8f2; } + .hmn-code .nc, .codeblock .nc { + color: #a6e22e; } + .hmn-code .no, .codeblock .no { + color: #66d9ef; } + .hmn-code .nd, .codeblock .nd { + color: #a6e22e; } + .hmn-code .ni, .codeblock .ni { + color: #f8f8f2; } + .hmn-code .ne, .codeblock .ne { + color: #a6e22e; } + .hmn-code .nf, .codeblock .nf { + color: #a6e22e; } + .hmn-code .nl, .codeblock .nl { + color: #f8f8f2; } + .hmn-code .nn, .codeblock .nn { + color: #f8f8f2; } + .hmn-code .nx, .codeblock .nx { + color: #a6e22e; } + .hmn-code .py, .codeblock .py { + color: #f8f8f2; } + .hmn-code .nt, .codeblock .nt { + color: #f92672; } + .hmn-code .nv, .codeblock .nv { + color: #f8f8f2; } + .hmn-code .ow, .codeblock .ow { + color: #f92672; } + .hmn-code .w, .codeblock .w { + color: #f8f8f2; } + .hmn-code .mf, .codeblock .mf { + color: #ae81ff; } + .hmn-code .mh, .codeblock .mh { + color: #ae81ff; } + .hmn-code .mi, .codeblock .mi { + color: #ae81ff; } + .hmn-code .mo, .codeblock .mo { + color: #ae81ff; } + .hmn-code .sb, .codeblock .sb { + color: #e6db74; } + .hmn-code .sc, .codeblock .sc { + color: #e6db74; } + .hmn-code .sd, .codeblock .sd { + color: #e6db74; } + .hmn-code .s2, .codeblock .s2 { + color: #e6db74; } + .hmn-code .se, .codeblock .se { + color: #ae81ff; } + .hmn-code .sh, .codeblock .sh { + color: #e6db74; } + .hmn-code .si, .codeblock .si { + color: #e6db74; } + .hmn-code .sx, .codeblock .sx { + color: #e6db74; } + .hmn-code .sr, .codeblock .sr { + color: #e6db74; } + .hmn-code .s1, .codeblock .s1 { + color: #e6db74; } + .hmn-code .ss, .codeblock .ss { + color: #e6db74; } + .hmn-code .bp, .codeblock .bp { + color: #f8f8f2; } + .hmn-code .vc, .codeblock .vc { + color: #f8f8f2; } + .hmn-code .vg, .codeblock .vg { + color: #f8f8f2; } + .hmn-code .vi, .codeblock .vi { + color: #f8f8f2; } + .hmn-code .il, .codeblock .il { + color: #ae81ff; } + .hmn-code .gu, .codeblock .gu { + color: #75715e; } + .hmn-code .gd, .codeblock .gd { + color: #f92672; } + .hmn-code .gi, .codeblock .gi { + color: #a6e22e; } -.codeblock .c { - color: #75715e; } - -/* Comment */ -.codeblock .err { - color: #ff0000; } - -/* Error */ -.codeblock .k { - color: #66d9ef; } - -/* Keyword */ -.codeblock .l { - color: #ae81ff; } - -/* Literal */ -.codeblock .n { - color: #f8f8f2; } - -/* Name */ -.codeblock .o { - color: #f92672; } - -/* Operator */ -.codeblock .p { - color: #f8f8f2; } - -/* Punctuation */ -.codeblock .cm { - color: #75715e; } - -/* Comment.Multiline */ -.codeblock .cp { - color: #75715e; } - -/* Comment.Preproc */ -.codeblock .c1 { - color: #75715e; } - -/* Comment.Single */ -.codeblock .cs { - color: #75715e; } - -/* Comment.Special */ -.codeblock .ge { - font-style: italic; } - -/* Generic.Emph */ -.codeblock .gs { - font-weight: bold; } - -/* Generic.Strong */ -.codeblock .kc { - color: #66d9ef; } - -/* Keyword.Constant */ -.codeblock .kd { - color: #66d9ef; } - -/* Keyword.Declaration */ -.codeblock .kn { - color: #f92672; } - -/* Keyword.Namespace */ -.codeblock .kp { - color: #66d9ef; } - -/* Keyword.Pseudo */ -.codeblock .kr { - color: #66d9ef; } - -/* Keyword.Reserved */ -.codeblock .kt { - color: #66d9ef; } - -/* Keyword.Type */ -.codeblock .ld { - color: #e6db74; } - -/* Literal.Date */ -.codeblock .m { - color: #ae81ff; } - -/* Literal.Number */ -.codeblock .s { - color: #e6db74; } - -/* Literal.String */ -.codeblock .na { - color: #a6e22e; } - -/* Name.Attribute */ -.codeblock .nb { - color: #f8f8f2; } - -/* Name.Builtin */ -.codeblock .nc { - color: #a6e22e; } - -/* Name.Class */ -.codeblock .no { - color: #66d9ef; } - -/* Name.Constant */ -.codeblock .nd { - color: #a6e22e; } - -/* Name.Decorator */ -.codeblock .ni { - color: #f8f8f2; } - -/* Name.Entity */ -.codeblock .ne { - color: #a6e22e; } - -/* Name.Exception */ -.codeblock .nf { - color: #a6e22e; } - -/* Name.Function */ -.codeblock .nl { - color: #f8f8f2; } - -/* Name.Label */ -.codeblock .nn { - color: #f8f8f2; } - -/* Name.Namespace */ -.codeblock .nx { - color: #a6e22e; } - -/* Name.Other */ -.codeblock .py { - color: #f8f8f2; } - -/* Name.Property */ -.codeblock .nt { - color: #f92672; } - -/* Name.Tag */ -.codeblock .nv { - color: #f8f8f2; } - -/* Name.Variable */ -.codeblock .ow { - color: #f92672; } - -/* Operator.Word */ -.codeblock .w { - color: #f8f8f2; } - -/* Text.Whitespace */ -.codeblock .mf { - color: #ae81ff; } - -/* Literal.Number.Float */ -.codeblock .mh { - color: #ae81ff; } - -/* Literal.Number.Hex */ -.codeblock .mi { - color: #ae81ff; } - -/* Literal.Number.Integer */ -.codeblock .mo { - color: #ae81ff; } - -/* Literal.Number.Oct */ -.codeblock .sb { - color: #e6db74; } - -/* Literal.String.Backtick */ -.codeblock .sc { - color: #e6db74; } - -/* Literal.String.Char */ -.codeblock .sd { - color: #e6db74; } - -/* Literal.String.Doc */ -.codeblock .s2 { - color: #e6db74; } - -/* Literal.String.Double */ -.codeblock .se { - color: #ae81ff; } - -/* Literal.String.Escape */ -.codeblock .sh { - color: #e6db74; } - -/* Literal.String.Heredoc */ -.codeblock .si { - color: #e6db74; } - -/* Literal.String.Interpol */ -.codeblock .sx { - color: #e6db74; } - -/* Literal.String.Other */ -.codeblock .sr { - color: #e6db74; } - -/* Literal.String.Regex */ -.codeblock .s1 { - color: #e6db74; } - -/* Literal.String.Single */ -.codeblock .ss { - color: #e6db74; } - -/* Literal.String.Symbol */ -.codeblock .bp { - color: #f8f8f2; } - -/* Name.Builtin.Pseudo */ -.codeblock .vc { - color: #f8f8f2; } - -/* Name.Variable.Class */ -.codeblock .vg { - color: #f8f8f2; } - -/* Name.Variable.Global */ -.codeblock .vi { - color: #f8f8f2; } - -/* Name.Variable.Instance */ -.codeblock .il { - color: #ae81ff; } - -/* Literal.Number.Integer.Long */ -/* Generic Heading & Diff Header */ -.codeblock .gu { - color: #75715e; } - -/* Generic.Subheading & Diff Unified/Comment? */ -.codeblock .gd { - color: #f92672; } - -/* Generic.Deleted & Diff Deleted */ -.codeblock .gi { - color: #a6e22e; } - -/* Generic.Inserted & Diff Inserted */ .light { background-color: #fff; color: #000; } diff --git a/public/themes/light/theme.css b/public/themes/light/theme.css index bb2db0e6..f22af402 100644 --- a/public/themes/light/theme.css +++ b/public/themes/light/theme.css @@ -18,272 +18,212 @@ For convenience in common cases, if only a single argument is provided and it does not match an existing variable, this will throw an error. */ -/* bbcode [code] -- see: https://github.com/richleland/pygments-css/blob/master/friendly.css */ -.codeblock .hll { - background-color: #ffffcc; } +.hmn-code, .codeblock { + /* Comment */ + /* Error */ + /* Keyword */ + /* Operator */ + /* Comment.Multiline */ + /* Comment.Preproc */ + /* Comment.Single */ + /* Comment.Special */ + /* Generic.Deleted */ + /* Generic.Emph */ + /* Generic.Error */ + /* Generic.Heading */ + /* Generic.Inserted */ + /* Generic.Output */ + /* Generic.Prompt */ + /* Generic.Strong */ + /* Generic.Subheading */ + /* Generic.Traceback */ + /* Keyword.Constant */ + /* Keyword.Declaration */ + /* Keyword.Namespace */ + /* Keyword.Pseudo */ + /* Keyword.Reserved */ + /* Keyword.Type */ + /* Literal.Number */ + /* Literal.String */ + /* Name.Attribute */ + /* Name.Builtin */ + /* Name.Class */ + /* Name.Constant */ + /* Name.Decorator */ + /* Name.Entity */ + /* Name.Exception */ + /* Name.Function */ + /* Name.Label */ + /* Name.Namespace */ + /* Name.Tag */ + /* Name.Variable */ + /* Operator.Word */ + /* Text.Whitespace */ + /* Literal.Number.Float */ + /* Literal.Number.Hex */ + /* Literal.Number.Integer */ + /* Literal.Number.Oct */ + /* Literal.String.Backtick */ + /* Literal.String.Char */ + /* Literal.String.Doc */ + /* Literal.String.Double */ + /* Literal.String.Escape */ + /* Literal.String.Heredoc */ + /* Literal.String.Interpol */ + /* Literal.String.Other */ + /* Literal.String.Regex */ + /* Literal.String.Single */ + /* Literal.String.Symbol */ + /* Name.Builtin.Pseudo */ + /* Name.Variable.Class */ + /* Name.Variable.Global */ + /* Name.Variable.Instance */ + /* Literal.Number.Integer.Long */ } + .hmn-code .hll, .codeblock .hll { + background-color: #ffffcc; } + .hmn-code .c, .codeblock .c { + color: #60a0b0; + font-style: italic; } + .hmn-code .err, .codeblock .err { + color: #FF0000; } + .hmn-code .k, .codeblock .k { + color: #007020; + font-weight: bold; } + .hmn-code .o, .codeblock .o { + color: #666666; } + .hmn-code .cm, .codeblock .cm { + color: #60a0b0; + font-style: italic; } + .hmn-code .cp, .codeblock .cp { + color: #007020; } + .hmn-code .c1, .codeblock .c1 { + color: #60a0b0; + font-style: italic; } + .hmn-code .cs, .codeblock .cs { + color: #60a0b0; + background-color: #fff0f0; } + .hmn-code .gd, .codeblock .gd { + color: #A00000; } + .hmn-code .ge, .codeblock .ge { + font-style: italic; } + .hmn-code .gr, .codeblock .gr { + color: #FF0000; } + .hmn-code .gh, .codeblock .gh { + color: #000080; + font-weight: bold; } + .hmn-code .gi, .codeblock .gi { + color: #00A000; } + .hmn-code .go, .codeblock .go { + color: #808080; } + .hmn-code .gp, .codeblock .gp { + color: #c65d09; + font-weight: bold; } + .hmn-code .gs, .codeblock .gs { + font-weight: bold; } + .hmn-code .gu, .codeblock .gu { + color: #800080; + font-weight: bold; } + .hmn-code .gt, .codeblock .gt { + color: #0040D0; } + .hmn-code .kc, .codeblock .kc { + color: #007020; + font-weight: bold; } + .hmn-code .kd, .codeblock .kd { + color: #007020; + font-weight: bold; } + .hmn-code .kn, .codeblock .kn { + color: #007020; + font-weight: bold; } + .hmn-code .kp, .codeblock .kp { + color: #007020; } + .hmn-code .kr, .codeblock .kr { + color: #007020; + font-weight: bold; } + .hmn-code .kt, .codeblock .kt { + color: #902000; } + .hmn-code .m, .codeblock .m { + color: #40a070; } + .hmn-code .s, .codeblock .s { + color: #4070a0; } + .hmn-code .na, .codeblock .na { + color: #4070a0; } + .hmn-code .nb, .codeblock .nb { + color: #007020; } + .hmn-code .nc, .codeblock .nc { + color: #0e84b5; + font-weight: bold; } + .hmn-code .no, .codeblock .no { + color: #60add5; } + .hmn-code .nd, .codeblock .nd { + color: #555555; + font-weight: bold; } + .hmn-code .ni, .codeblock .ni { + color: #d55537; + font-weight: bold; } + .hmn-code .ne, .codeblock .ne { + color: #007020; } + .hmn-code .nf, .codeblock .nf { + color: #06287e; } + .hmn-code .nl, .codeblock .nl { + color: #002070; + font-weight: bold; } + .hmn-code .nn, .codeblock .nn { + color: #0e84b5; + font-weight: bold; } + .hmn-code .nt, .codeblock .nt { + color: #062873; + font-weight: bold; } + .hmn-code .nv, .codeblock .nv { + color: #bb60d5; } + .hmn-code .ow, .codeblock .ow { + color: #007020; + font-weight: bold; } + .hmn-code .w, .codeblock .w { + color: #bbbbbb; } + .hmn-code .mf, .codeblock .mf { + color: #40a070; } + .hmn-code .mh, .codeblock .mh { + color: #40a070; } + .hmn-code .mi, .codeblock .mi { + color: #40a070; } + .hmn-code .mo, .codeblock .mo { + color: #40a070; } + .hmn-code .sb, .codeblock .sb { + color: #4070a0; } + .hmn-code .sc, .codeblock .sc { + color: #4070a0; } + .hmn-code .sd, .codeblock .sd { + color: #4070a0; + font-style: italic; } + .hmn-code .s2, .codeblock .s2 { + color: #4070a0; } + .hmn-code .se, .codeblock .se { + color: #4070a0; + font-weight: bold; } + .hmn-code .sh, .codeblock .sh { + color: #4070a0; } + .hmn-code .si, .codeblock .si { + color: #70a0d0; + font-style: italic; } + .hmn-code .sx, .codeblock .sx { + color: #c65d09; } + .hmn-code .sr, .codeblock .sr { + color: #235388; } + .hmn-code .s1, .codeblock .s1 { + color: #4070a0; } + .hmn-code .ss, .codeblock .ss { + color: #517918; } + .hmn-code .bp, .codeblock .bp { + color: #007020; } + .hmn-code .vc, .codeblock .vc { + color: #bb60d5; } + .hmn-code .vg, .codeblock .vg { + color: #bb60d5; } + .hmn-code .vi, .codeblock .vi { + color: #bb60d5; } + .hmn-code .il, .codeblock .il { + color: #40a070; } -.codeblock .c { - color: #60a0b0; - font-style: italic; } - -/* Comment */ -.codeblock .err { - color: #FF0000; } - -/* Error */ -.codeblock .k { - color: #007020; - font-weight: bold; } - -/* Keyword */ -.codeblock .o { - color: #666666; } - -/* Operator */ -.codeblock .cm { - color: #60a0b0; - font-style: italic; } - -/* Comment.Multiline */ -.codeblock .cp { - color: #007020; } - -/* Comment.Preproc */ -.codeblock .c1 { - color: #60a0b0; - font-style: italic; } - -/* Comment.Single */ -.codeblock .cs { - color: #60a0b0; - background-color: #fff0f0; } - -/* Comment.Special */ -.codeblock .gd { - color: #A00000; } - -/* Generic.Deleted */ -.codeblock .ge { - font-style: italic; } - -/* Generic.Emph */ -.codeblock .gr { - color: #FF0000; } - -/* Generic.Error */ -.codeblock .gh { - color: #000080; - font-weight: bold; } - -/* Generic.Heading */ -.codeblock .gi { - color: #00A000; } - -/* Generic.Inserted */ -.codeblock .go { - color: #808080; } - -/* Generic.Output */ -.codeblock .gp { - color: #c65d09; - font-weight: bold; } - -/* Generic.Prompt */ -.codeblock .gs { - font-weight: bold; } - -/* Generic.Strong */ -.codeblock .gu { - color: #800080; - font-weight: bold; } - -/* Generic.Subheading */ -.codeblock .gt { - color: #0040D0; } - -/* Generic.Traceback */ -.codeblock .kc { - color: #007020; - font-weight: bold; } - -/* Keyword.Constant */ -.codeblock .kd { - color: #007020; - font-weight: bold; } - -/* Keyword.Declaration */ -.codeblock .kn { - color: #007020; - font-weight: bold; } - -/* Keyword.Namespace */ -.codeblock .kp { - color: #007020; } - -/* Keyword.Pseudo */ -.codeblock .kr { - color: #007020; - font-weight: bold; } - -/* Keyword.Reserved */ -.codeblock .kt { - color: #902000; } - -/* Keyword.Type */ -.codeblock .m { - color: #40a070; } - -/* Literal.Number */ -.codeblock .s { - color: #4070a0; } - -/* Literal.String */ -.codeblock .na { - color: #4070a0; } - -/* Name.Attribute */ -.codeblock .nb { - color: #007020; } - -/* Name.Builtin */ -.codeblock .nc { - color: #0e84b5; - font-weight: bold; } - -/* Name.Class */ -.codeblock .no { - color: #60add5; } - -/* Name.Constant */ -.codeblock .nd { - color: #555555; - font-weight: bold; } - -/* Name.Decorator */ -.codeblock .ni { - color: #d55537; - font-weight: bold; } - -/* Name.Entity */ -.codeblock .ne { - color: #007020; } - -/* Name.Exception */ -.codeblock .nf { - color: #06287e; } - -/* Name.Function */ -.codeblock .nl { - color: #002070; - font-weight: bold; } - -/* Name.Label */ -.codeblock .nn { - color: #0e84b5; - font-weight: bold; } - -/* Name.Namespace */ -.codeblock .nt { - color: #062873; - font-weight: bold; } - -/* Name.Tag */ -.codeblock .nv { - color: #bb60d5; } - -/* Name.Variable */ -.codeblock .ow { - color: #007020; - font-weight: bold; } - -/* Operator.Word */ -.codeblock .w { - color: #bbbbbb; } - -/* Text.Whitespace */ -.codeblock .mf { - color: #40a070; } - -/* Literal.Number.Float */ -.codeblock .mh { - color: #40a070; } - -/* Literal.Number.Hex */ -.codeblock .mi { - color: #40a070; } - -/* Literal.Number.Integer */ -.codeblock .mo { - color: #40a070; } - -/* Literal.Number.Oct */ -.codeblock .sb { - color: #4070a0; } - -/* Literal.String.Backtick */ -.codeblock .sc { - color: #4070a0; } - -/* Literal.String.Char */ -.codeblock .sd { - color: #4070a0; - font-style: italic; } - -/* Literal.String.Doc */ -.codeblock .s2 { - color: #4070a0; } - -/* Literal.String.Double */ -.codeblock .se { - color: #4070a0; - font-weight: bold; } - -/* Literal.String.Escape */ -.codeblock .sh { - color: #4070a0; } - -/* Literal.String.Heredoc */ -.codeblock .si { - color: #70a0d0; - font-style: italic; } - -/* Literal.String.Interpol */ -.codeblock .sx { - color: #c65d09; } - -/* Literal.String.Other */ -.codeblock .sr { - color: #235388; } - -/* Literal.String.Regex */ -.codeblock .s1 { - color: #4070a0; } - -/* Literal.String.Single */ -.codeblock .ss { - color: #517918; } - -/* Literal.String.Symbol */ -.codeblock .bp { - color: #007020; } - -/* Name.Builtin.Pseudo */ -.codeblock .vc { - color: #bb60d5; } - -/* Name.Variable.Class */ -.codeblock .vg { - color: #bb60d5; } - -/* Name.Variable.Global */ -.codeblock .vi { - color: #bb60d5; } - -/* Name.Variable.Instance */ -.codeblock .il { - color: #40a070; } - -/* Literal.Number.Integer.Long */ .dark { background-color: #222; color: #bbb; } diff --git a/src/parsing/bbcode.go b/src/parsing/bbcode.go index 70b63270..11d471ad 100644 --- a/src/parsing/bbcode.go +++ b/src/parsing/bbcode.go @@ -1,9 +1,16 @@ package parsing import ( + "bytes" "regexp" + "strings" "git.handmade.network/hmn/hmn/src/hmnurl" + "git.handmade.network/hmn/hmn/src/oops" + "github.com/alecthomas/chroma" + chromahtml "github.com/alecthomas/chroma/formatters/html" + "github.com/alecthomas/chroma/lexers" + "github.com/alecthomas/chroma/styles" "github.com/frustra/bbcode" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" @@ -108,26 +115,49 @@ func init() { lang = arglang } + text := bbcode.CompileText(bn) + text = strings.TrimPrefix(text, "\n") + + var lexer chroma.Lexer + if lang != "" { + lexer = lexers.Get(lang) + } + if lexer == nil { + lexer = lexers.Analyse(text) + } + if lexer == nil { + lexer = lexers.Fallback + } + + iterator, err := lexer.Tokenise(nil, text) + if err != nil { + panic(oops.New(err, "failed to tokenize bbcode")) + } + + var result bytes.Buffer + formatter := chromahtml.New(HMNChromaOptions...) + formatter.Format(&result, styles.Monokai, iterator) + formatted := result.String() + out := bbcode.NewHTMLTag("") out.Name = "pre" + out.Attrs["class"] = "hmn-code" - // TODO: After figuring out code for Markdown, put it here too. - _ = lang + child := bbcode.NewHTMLTag(formatted) + child.Raw = true + out.AppendChild(child) - return out, true + return out, false }) } func makeYoutubeBBCodeFunc(preview bool) bbcode.TagCompilerFunc { return func(bn *bbcode.BBCodeNode) (*bbcode.HTMLTag, bool) { - if len(bn.Children) != 1 { - return bbcode.NewHTMLTag(""), false - } - if bn.Children[0].Token.ID != bbcode.TEXT { + contents := bbcode.CompileText(bn) + if contents == "" { return bbcode.NewHTMLTag(""), false } - contents := bn.Children[0].Token.Value.(string) vid := "" if m := REYoutubeLong.FindStringSubmatch(contents); m != nil { diff --git a/src/parsing/chroma.go b/src/parsing/chroma.go new file mode 100644 index 00000000..02807337 --- /dev/null +++ b/src/parsing/chroma.go @@ -0,0 +1,20 @@ +package parsing + +import "github.com/alecthomas/chroma/formatters/html" + +var HMNChromaOptions = []html.Option{ + html.WithClasses(true), + html.WithPreWrapper(nopPreWrapper{}), +} + +type nopPreWrapper struct{} + +var _ html.PreWrapper = nopPreWrapper{} + +func (w nopPreWrapper) Start(code bool, styleAttr string) string { + return "" +} + +func (w nopPreWrapper) End(code bool) string { + return "" +} diff --git a/src/parsing/parsing.go b/src/parsing/parsing.go index 029e53f2..d433f269 100644 --- a/src/parsing/parsing.go +++ b/src/parsing/parsing.go @@ -4,12 +4,15 @@ import ( "bytes" "github.com/yuin/goldmark" + highlighting "github.com/yuin/goldmark-highlighting" "github.com/yuin/goldmark/extension" + "github.com/yuin/goldmark/util" ) var previewMarkdown = goldmark.New( goldmark.WithExtensions( extension.GFM, + highlightExtension, SpoilerExtension{}, EmbedExtension{ Preview: true, @@ -23,6 +26,7 @@ var previewMarkdown = goldmark.New( var realMarkdown = goldmark.New( goldmark.WithExtensions( extension.GFM, + highlightExtension, SpoilerExtension{}, EmbedExtension{}, MathjaxExtension{}, @@ -43,3 +47,14 @@ func ParsePostInput(source string, preview bool) string { return buf.String() } + +var highlightExtension = highlighting.NewHighlighting( + highlighting.WithFormatOptions(HMNChromaOptions...), + highlighting.WithWrapperRenderer(func(w util.BufWriter, context highlighting.CodeBlockContext, entering bool) { + if entering { + w.WriteString(`
`)
+		} else {
+			w.WriteString(`
`) + } + }), +) diff --git a/src/parsing/parsing_test.go b/src/parsing/parsing_test.go index 6abb8d07..546ee748 100644 --- a/src/parsing/parsing_test.go +++ b/src/parsing/parsing_test.go @@ -1,55 +1,66 @@ package parsing import ( - "fmt" + "strings" "testing" "github.com/stretchr/testify/assert" ) -func TestParseBBCode(t *testing.T) { - const testDoc = `Hello, [b]amazing[/b] [i]incredible[/i] [b][i][u]world!!![/u][/i][/b] - -Too many opening tags: [b]wow.[b] - -Too many closing tags: [/i]wow.[/i] - -Mix 'em: [u][/i]wow.[/i][/u] - -[url=https://google.com/]Google![/url] -` - - t.Run("hello world", func(t *testing.T) { - bbcode := "Hello, [b]amazing[/b] [i]incredible[/i] [b][i][u]world!!![/u][/i][/b]" - expected := "Hello, amazing incredible world!!!" - assert.Equal(t, expected, ParseBBCode(bbcode)) +func TestMarkdown(t *testing.T) { + t.Run("fenced code blocks", func(t *testing.T) { + t.Run("multiple lines", func(t *testing.T) { + html := ParsePostInput("```\nmultiple lines\n\tof code\n```", false) + t.Log(html) + assert.Equal(t, 1, strings.Count(html, "