mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Fix lint issues (#285)
* fix(lint): cascadeStyles always passed true * fix(lint): gomnd
This commit is contained in:
+6
-6
@@ -29,17 +29,17 @@ func (e *HeadingElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
|
|
||||||
switch e.Level {
|
switch e.Level {
|
||||||
case h1:
|
case h1:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H1)
|
rules = cascadeStyles(rules, ctx.options.Styles.H1)
|
||||||
case h2:
|
case h2:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H2)
|
rules = cascadeStyles(rules, ctx.options.Styles.H2)
|
||||||
case h3:
|
case h3:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H3)
|
rules = cascadeStyles(rules, ctx.options.Styles.H3)
|
||||||
case h4:
|
case h4:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H4)
|
rules = cascadeStyles(rules, ctx.options.Styles.H4)
|
||||||
case h5:
|
case h5:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H5)
|
rules = cascadeStyles(rules, ctx.options.Styles.H5)
|
||||||
case h6:
|
case h6:
|
||||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H6)
|
rules = cascadeStyles(rules, ctx.options.Styles.H6)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !e.First {
|
if !e.First {
|
||||||
|
|||||||
+2
-2
@@ -138,11 +138,11 @@ type StyleConfig struct {
|
|||||||
HTMLSpan StyleBlock `json:"html_span,omitempty"`
|
HTMLSpan StyleBlock `json:"html_span,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func cascadeStyles(toBlock bool, s ...StyleBlock) StyleBlock {
|
func cascadeStyles(s ...StyleBlock) StyleBlock {
|
||||||
var r StyleBlock
|
var r StyleBlock
|
||||||
|
|
||||||
for _, v := range s {
|
for _, v := range s {
|
||||||
r = cascadeStyle(r, v, toBlock)
|
r = cascadeStyle(r, v, true)
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var (
|
|||||||
l = len(s)
|
l = len(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gomnd
|
||||||
if len(values) > 2 {
|
if len(values) > 2 {
|
||||||
r := values[2].(int)
|
r := values[2].(int)
|
||||||
if r > len(s) {
|
if r > len(s) {
|
||||||
|
|||||||
+4
-4
@@ -9,17 +9,17 @@ var DraculaStyleConfig = ansi.StyleConfig{
|
|||||||
BlockSuffix: "\n",
|
BlockSuffix: "\n",
|
||||||
Color: stringPtr("#f8f8f2"),
|
Color: stringPtr("#f8f8f2"),
|
||||||
},
|
},
|
||||||
Margin: uintPtr(2),
|
Margin: uintPtr(defaultMargin),
|
||||||
},
|
},
|
||||||
BlockQuote: ansi.StyleBlock{
|
BlockQuote: ansi.StyleBlock{
|
||||||
StylePrimitive: ansi.StylePrimitive{
|
StylePrimitive: ansi.StylePrimitive{
|
||||||
Color: stringPtr("#f1fa8c"),
|
Color: stringPtr("#f1fa8c"),
|
||||||
Italic: boolPtr(true),
|
Italic: boolPtr(true),
|
||||||
},
|
},
|
||||||
Indent: uintPtr(2),
|
Indent: uintPtr(defaultMargin),
|
||||||
},
|
},
|
||||||
List: ansi.StyleList{
|
List: ansi.StyleList{
|
||||||
LevelIndent: 2,
|
LevelIndent: defaultMargin,
|
||||||
StyleBlock: ansi.StyleBlock{
|
StyleBlock: ansi.StyleBlock{
|
||||||
StylePrimitive: ansi.StylePrimitive{
|
StylePrimitive: ansi.StylePrimitive{
|
||||||
Color: stringPtr("#f8f8f2"),
|
Color: stringPtr("#f8f8f2"),
|
||||||
@@ -115,7 +115,7 @@ var DraculaStyleConfig = ansi.StyleConfig{
|
|||||||
StylePrimitive: ansi.StylePrimitive{
|
StylePrimitive: ansi.StylePrimitive{
|
||||||
Color: stringPtr("#ffb86c"),
|
Color: stringPtr("#ffb86c"),
|
||||||
},
|
},
|
||||||
Margin: uintPtr(2),
|
Margin: uintPtr(defaultMargin),
|
||||||
},
|
},
|
||||||
Chroma: &ansi.Chroma{
|
Chroma: &ansi.Chroma{
|
||||||
Text: ansi.StylePrimitive{
|
Text: ansi.StylePrimitive{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const defaultListIndent = 2
|
const defaultListIndent = 2
|
||||||
|
const defaultListLevelIndent = 4
|
||||||
const defaultMargin = 2
|
const defaultMargin = 2
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -31,7 +32,7 @@ var (
|
|||||||
StyleBlock: ansi.StyleBlock{
|
StyleBlock: ansi.StyleBlock{
|
||||||
StylePrimitive: ansi.StylePrimitive{},
|
StylePrimitive: ansi.StylePrimitive{},
|
||||||
},
|
},
|
||||||
LevelIndent: 4,
|
LevelIndent: defaultListLevelIndent,
|
||||||
},
|
},
|
||||||
Heading: ansi.StyleBlock{
|
Heading: ansi.StyleBlock{
|
||||||
StylePrimitive: ansi.StylePrimitive{
|
StylePrimitive: ansi.StylePrimitive{
|
||||||
|
|||||||
Reference in New Issue
Block a user