mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-08-28 04:46:29 -04:00
fix: linter errors (#263)
* refactor: extract magic numbers to const * fix: linter errors
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ func (s BlockStack) Margin() uint {
|
||||
return i
|
||||
}
|
||||
|
||||
// Width returns the available rendering width
|
||||
// Width returns the available rendering width.
|
||||
func (s BlockStack) Width(ctx RenderContext) uint {
|
||||
if s.Indent()+s.Margin()*2 > uint(ctx.options.WordWrap) {
|
||||
return 0
|
||||
|
||||
+15
-6
@@ -14,22 +14,31 @@ type HeadingElement struct {
|
||||
First bool
|
||||
}
|
||||
|
||||
const (
|
||||
h1 = iota + 1
|
||||
h2
|
||||
h3
|
||||
h4
|
||||
h5
|
||||
h6
|
||||
)
|
||||
|
||||
func (e *HeadingElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
bs := ctx.blockStack
|
||||
rules := ctx.options.Styles.Heading
|
||||
|
||||
switch e.Level {
|
||||
case 1:
|
||||
case h1:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H1)
|
||||
case 2:
|
||||
case h2:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H2)
|
||||
case 3:
|
||||
case h3:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H3)
|
||||
case 4:
|
||||
case h4:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H4)
|
||||
case 5:
|
||||
case h5:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H5)
|
||||
case 6:
|
||||
case h6:
|
||||
rules = cascadeStyles(true, rules, ctx.options.Styles.H6)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ type ImageElement struct {
|
||||
Text string
|
||||
BaseURL string
|
||||
URL string
|
||||
Child ElementRenderer // FIXME
|
||||
Child ElementRenderer
|
||||
}
|
||||
|
||||
func (e *ImageElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ type LinkElement struct {
|
||||
Text string
|
||||
BaseURL string
|
||||
URL string
|
||||
Child ElementRenderer // FIXME
|
||||
Child ElementRenderer
|
||||
}
|
||||
|
||||
func (e *LinkElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
// TemplateFuncMap contains a few useful template helpers
|
||||
// TemplateFuncMap contains a few useful template helpers.
|
||||
var (
|
||||
TemplateFuncMap = template.FuncMap{
|
||||
"Left": func(values ...interface{}) string {
|
||||
|
||||
Reference in New Issue
Block a user