mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Let user pick a syntax color theme in Gold's style config
This commit is contained in:
@@ -427,7 +427,14 @@ func (tr *TermRenderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf
|
|||||||
|
|
||||||
for _, f := range e.Fragments {
|
for _, f := range e.Fragments {
|
||||||
if node.Type == bf.CodeBlock {
|
if node.Type == bf.CodeBlock {
|
||||||
err := quick.Highlight(w, f.Token, string(node.CodeBlockData.Info), "terminal16m", "monokai")
|
theme := "monokai"
|
||||||
|
if rules, ok := tr.style[f.Style]; ok {
|
||||||
|
if len(rules.Theme) > 0 {
|
||||||
|
theme = rules.Theme
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err := quick.Highlight(w, f.Token, string(node.CodeBlockData.Info), "terminal16m", theme)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ type ElementStyle struct {
|
|||||||
Overlined bool `json:"overlined"`
|
Overlined bool `json:"overlined"`
|
||||||
Inverse bool `json:"inverse"`
|
Inverse bool `json:"inverse"`
|
||||||
Blink bool `json:"blink"`
|
Blink bool `json:"blink"`
|
||||||
|
Theme string `json:"theme"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func keyToType(key string) (StyleType, error) {
|
func keyToType(key string) (StyleType, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user