parent
46ce1f191b
commit
2db43f841c
3 changed files with 1 additions and 8 deletions
|
@ -33,7 +33,6 @@ const (
|
||||||
lineNosKey = "linenos"
|
lineNosKey = "linenos"
|
||||||
hlLinesKey = "hl_lines"
|
hlLinesKey = "hl_lines"
|
||||||
linosStartKey = "linenostart"
|
linosStartKey = "linenostart"
|
||||||
noHlKey = "nohl"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var DefaultConfig = Config{
|
var DefaultConfig = Config{
|
||||||
|
@ -60,9 +59,6 @@ type Config struct {
|
||||||
// Use inline CSS styles.
|
// Use inline CSS styles.
|
||||||
NoClasses bool
|
NoClasses bool
|
||||||
|
|
||||||
// No highlighting.
|
|
||||||
NoHl bool
|
|
||||||
|
|
||||||
// When set, line numbers will be printed.
|
// When set, line numbers will be printed.
|
||||||
LineNos bool
|
LineNos bool
|
||||||
LineNumbersInTable bool
|
LineNumbersInTable bool
|
||||||
|
@ -234,8 +230,6 @@ func normalizeHighlightOptions(m map[string]any) {
|
||||||
|
|
||||||
for k, v := range m {
|
for k, v := range m {
|
||||||
switch k {
|
switch k {
|
||||||
case noHlKey:
|
|
||||||
m[noHlKey] = cast.ToBool(v)
|
|
||||||
case lineNosKey:
|
case lineNosKey:
|
||||||
if v == "table" || v == "inline" {
|
if v == "table" || v == "inline" {
|
||||||
m["lineNumbersInTable"] = v == "table"
|
m["lineNumbersInTable"] = v == "table"
|
||||||
|
|
|
@ -168,7 +168,7 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes.
|
||||||
lexer = chromalexers.Get(lang)
|
lexer = chromalexers.Get(lang)
|
||||||
}
|
}
|
||||||
|
|
||||||
if lexer == nil && (cfg.GuessSyntax && !cfg.NoHl) {
|
if lexer == nil && cfg.GuessSyntax {
|
||||||
lexer = lexers.Analyse(code)
|
lexer = lexers.Analyse(code)
|
||||||
if lexer == nil {
|
if lexer == nil {
|
||||||
lexer = lexers.Fallback
|
lexer = lexers.Fallback
|
||||||
|
|
|
@ -36,7 +36,6 @@ var chromaHighlightProcessingAttributes = map[string]bool{
|
||||||
"lineNoStart": true,
|
"lineNoStart": true,
|
||||||
"lineNumbersInTable": true,
|
"lineNumbersInTable": true,
|
||||||
"noClasses": true,
|
"noClasses": true,
|
||||||
"nohl": true,
|
|
||||||
"style": true,
|
"style": true,
|
||||||
"tabWidth": true,
|
"tabWidth": true,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue