mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-01 14:37:28 -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 {
|
||||
case h1:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H1)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H1)
|
||||
case h2:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H2)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H2)
|
||||
case h3:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H3)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H3)
|
||||
case h4:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H4)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H4)
|
||||
case h5:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H5)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H5)
|
||||
case h6:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H6)
|
||||
rules = cascadeStyles(rules, ctx.options.Styles.H6)
|
||||
}
|
||||
|
||||
if !e.First {
|
||||
|
||||
+2
-2
@@ -138,11 +138,11 @@ type StyleConfig struct {
|
||||
HTMLSpan StyleBlock `json:"html_span,omitempty"`
|
||||
}
|
||||
|
||||
func cascadeStyles(toBlock bool, s ...StyleBlock) StyleBlock {
|
||||
func cascadeStyles(s ...StyleBlock) StyleBlock {
|
||||
var r StyleBlock
|
||||
|
||||
for _, v := range s {
|
||||
r = cascadeStyle(r, v, toBlock)
|
||||
r = cascadeStyle(r, v, true)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ var (
|
||||
l = len(s)
|
||||
}
|
||||
|
||||
//nolint:gomnd
|
||||
if len(values) > 2 {
|
||||
r := values[2].(int)
|
||||
if r > len(s) {
|
||||
|
||||
+4
-4
@@ -9,17 +9,17 @@ var DraculaStyleConfig = ansi.StyleConfig{
|
||||
BlockSuffix: "\n",
|
||||
Color: stringPtr("#f8f8f2"),
|
||||
},
|
||||
Margin: uintPtr(2),
|
||||
Margin: uintPtr(defaultMargin),
|
||||
},
|
||||
BlockQuote: ansi.StyleBlock{
|
||||
StylePrimitive: ansi.StylePrimitive{
|
||||
Color: stringPtr("#f1fa8c"),
|
||||
Italic: boolPtr(true),
|
||||
},
|
||||
Indent: uintPtr(2),
|
||||
Indent: uintPtr(defaultMargin),
|
||||
},
|
||||
List: ansi.StyleList{
|
||||
LevelIndent: 2,
|
||||
LevelIndent: defaultMargin,
|
||||
StyleBlock: ansi.StyleBlock{
|
||||
StylePrimitive: ansi.StylePrimitive{
|
||||
Color: stringPtr("#f8f8f2"),
|
||||
@@ -115,7 +115,7 @@ var DraculaStyleConfig = ansi.StyleConfig{
|
||||
StylePrimitive: ansi.StylePrimitive{
|
||||
Color: stringPtr("#ffb86c"),
|
||||
},
|
||||
Margin: uintPtr(2),
|
||||
Margin: uintPtr(defaultMargin),
|
||||
},
|
||||
Chroma: &ansi.Chroma{
|
||||
Text: ansi.StylePrimitive{
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
const defaultListIndent = 2
|
||||
const defaultListLevelIndent = 4
|
||||
const defaultMargin = 2
|
||||
|
||||
var (
|
||||
@@ -31,7 +32,7 @@ var (
|
||||
StyleBlock: ansi.StyleBlock{
|
||||
StylePrimitive: ansi.StylePrimitive{},
|
||||
},
|
||||
LevelIndent: 4,
|
||||
LevelIndent: defaultListLevelIndent,
|
||||
},
|
||||
Heading: ansi.StyleBlock{
|
||||
StylePrimitive: ansi.StylePrimitive{
|
||||
|
||||
Reference in New Issue
Block a user