mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
@@ -198,6 +198,7 @@ func newHighlighting(cfg highlight.Config) goldmark.Extender {
|
||||
|
||||
e := hl.NewHighlighting(
|
||||
hl.WithStyle(cfg.Style),
|
||||
hl.WithGuessLanguage(cfg.GuessSyntax),
|
||||
hl.WithCodeBlockOptions(highlight.GetCodeBlockOptions()),
|
||||
hl.WithFormatOptions(
|
||||
cfg.ToHTMLOptions()...,
|
||||
|
@@ -224,4 +224,25 @@ LINE5
|
||||
result = convertForConfig(c, cfg, lines, "bash {linenos=table}")
|
||||
c.Assert(result, qt.Contains, "<span class=\"lnt\">1\n</span>")
|
||||
})
|
||||
|
||||
c.Run("No language", func(c *qt.C) {
|
||||
cfg := highlight.DefaultConfig
|
||||
cfg.NoClasses = false
|
||||
cfg.LineNos = true
|
||||
cfg.LineNumbersInTable = false
|
||||
|
||||
result := convertForConfig(c, cfg, lines, "")
|
||||
c.Assert(result, qt.Contains, "<pre><code>LINE1\n")
|
||||
})
|
||||
|
||||
c.Run("No language, guess syntax", func(c *qt.C) {
|
||||
cfg := highlight.DefaultConfig
|
||||
cfg.NoClasses = false
|
||||
cfg.GuessSyntax = true
|
||||
cfg.LineNos = true
|
||||
cfg.LineNumbersInTable = false
|
||||
|
||||
result := convertForConfig(c, cfg, lines, "")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<")
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user