File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 26
26
once sync.Once
27
27
)
28
28
29
- // NewContext loads highlight map
29
+ // NewContext loads custom highlight map from local config
30
30
func NewContext () {
31
31
once .Do (func () {
32
32
keys := setting .Cfg .Section ("highlight.mapping" ).Keys ()
@@ -38,6 +38,7 @@ func NewContext() {
38
38
39
39
// Code returns a HTML version of code string with chroma syntax highlighting classes
40
40
func Code (fileName , code string ) string {
41
+ NewContext ()
41
42
formatter := html .New (html .WithClasses (true ),
42
43
html .WithLineNumbers (false ),
43
44
html .PreventSurroundingPre (true ),
@@ -78,6 +79,7 @@ func Code(fileName, code string) string {
78
79
79
80
// File returns map with line lumbers and HTML version of code with chroma syntax highlighting classes
80
81
func File (numLines int , fileName string , code []byte ) map [int ]string {
82
+ NewContext ()
81
83
m := make (map [int ]string , numLines )
82
84
83
85
formatter := html .New (html .WithClasses (true ),
You can’t perform that action at this time.
0 commit comments