summaryrefslogtreecommitdiff
path: root/public/static/highlight.go.js
diff options
context:
space:
mode:
authora73x <[email protected]>2024-08-31 18:51:42 +0100
committera73x <[email protected]>2024-08-31 18:51:46 +0100
commit68cc8a115d79c97e3c557c70d81d59d0de29ae46 (patch)
treed027f0eb3cb8d1cf0692238dfbb582326661a17e /public/static/highlight.go.js
parent975df0362b6ccfe958e550db246f465b2753baf7 (diff)
feat(html): add syntax highlighting
using a js library until I work out how to use https://github.com/alecthomas/chroma
Diffstat (limited to 'public/static/highlight.go.js')
-rw-r--r--public/static/highlight.go.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/public/static/highlight.go.js b/public/static/highlight.go.js
new file mode 100644
index 0000000..d851930
--- /dev/null
+++ b/public/static/highlight.go.js
@@ -0,0 +1,20 @@
+/*! `go` grammar compiled for Highlight.js 11.10.0 */
+(()=>{var e=(()=>{"use strict";return e=>{const a={
+ keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],
+ type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],
+ literal:["true","false","iota","nil"],
+ built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]
+ };return{name:"Go",aliases:["golang"],keywords:a,illegal:"</",
+ contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",
+ variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{
+ className:"number",variants:[{
+ match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0
+ },{
+ match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,
+ relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{
+ match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{
+ match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{
+ begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",
+ excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,
+ endsParent:!0,keywords:a,illegal:/["']/}]}]}}})();hljs.registerLanguage("go",e)
+ })(); \ No newline at end of file