summaryrefslogtreecommitdiff
path: root/html/highlight.go
diff options
context:
space:
mode:
authora73x <[email protected]>2024-09-02 18:32:22 +0100
committera73x <[email protected]>2024-09-02 18:32:22 +0100
commit94392c082192b1fc69fda2954e7b60eb0b741a72 (patch)
treefd263673d577fd093162f74b1e6e08a2770a6b15 /html/highlight.go
parent4303b1c281ea814ca493534d12451c485a9a763d (diff)
feat(html): new css styling
Diffstat (limited to 'html/highlight.go')
-rw-r--r--html/highlight.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/html/highlight.go b/html/highlight.go
index 72b8d79..7f520ed 100644
--- a/html/highlight.go
+++ b/html/highlight.go
@@ -19,10 +19,10 @@ type Highlighter struct {
}
func (h Highlighter) htmlHighlight(w io.Writer, source, lang, defaultLang string) error {
-
if lang == "" {
lang = defaultLang
}
+
l := lexers.Get(lang)
if l == nil {
l = lexers.Analyse(source)
@@ -55,9 +55,7 @@ func (h Highlighter) myRenderHook(w io.Writer, node ast.Node, entering bool) (as
func newRenderer() *mdhtml.Renderer {
htmlFormatter := html.New(html.WithClasses(true), html.TabWidth(2))
- if htmlFormatter == nil {
- panic("couldn't create html formatter")
- }
+
styleName := "monokailight"
highlightStyle := styles.Get(styleName)
if highlightStyle == nil {