mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Reuse reflow's writer-pipes
This commit is contained in:
+3
-10
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/muesli/reflow/ansi"
|
||||
"github.com/muesli/reflow/indent"
|
||||
"github.com/muesli/reflow/wordwrap"
|
||||
)
|
||||
@@ -62,15 +61,9 @@ func (e *HeadingElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
margin = *rules.Margin
|
||||
}
|
||||
|
||||
iw := &indent.Writer{
|
||||
Indent: indentation + margin,
|
||||
IndentFunc: func(wr io.Writer) {
|
||||
renderText(w, ctx.colorProfile, bs.Parent().Style.StylePrimitive, " ")
|
||||
},
|
||||
Forward: &ansi.Writer{
|
||||
Forward: w,
|
||||
},
|
||||
}
|
||||
iw := indent.NewWriterPipe(w, indentation+margin, func(wr io.Writer) {
|
||||
renderText(w, ctx.colorProfile, bs.Parent().Style.StylePrimitive, " ")
|
||||
})
|
||||
|
||||
flow := wordwrap.NewWriter(int(bs.Width(ctx) - indentation - margin*2))
|
||||
_, err := flow.Write(bs.Current().Block.Bytes())
|
||||
|
||||
Reference in New Issue
Block a user