From be2762f3db784205ed6c3764f89381ca9dd579a5 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 18 Dec 2019 19:47:58 +0100 Subject: [PATCH] Let style define the indentation token --- ansi/margin.go | 7 ++++++- ansi/style.go | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ansi/margin.go b/ansi/margin.go index f97f372..dee45d0 100644 --- a/ansi/margin.go +++ b/ansi/margin.go @@ -35,10 +35,15 @@ func NewMarginWriter(ctx RenderContext, w io.Writer, rules StyleBlock) *MarginWr Forward: w, }, } + + ic := " " + if rules.IndentToken != nil { + ic = *rules.IndentToken + } iw := &indent.Writer{ Indent: indentation + margin, IndentFunc: func(wr io.Writer) { - renderText(w, bs.Parent().Style.StylePrimitive, " ") + renderText(w, bs.Parent().Style.StylePrimitive, ic) }, Forward: &ansi.Writer{ Forward: pw, diff --git a/ansi/style.go b/ansi/style.go index 0c13205..519aa0f 100644 --- a/ansi/style.go +++ b/ansi/style.go @@ -31,8 +31,9 @@ type StyleTask struct { type StyleBlock struct { StylePrimitive - Indent *uint `json:"indent"` - Margin *uint `json:"margin"` + Indent *uint `json:"indent"` + IndentToken *string `json:"indent_token"` + Margin *uint `json:"margin"` } type StyleCodeBlock struct {