mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-27 03:29:58 -04:00
Optionally Preserving New Lines (#115)
This commit is contained in:
1 parent
44a6b3913e
commit
8ea7b1c86c
6 files changed
+53
-5
No files matched your search
+1
-1
@@ -38,7 +38,7 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
mw := NewMarginWriter(ctx, w, rules)
|
||||
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
|
||||
flow := wordwrap.NewWriter(int(bs.Width(ctx)))
|
||||
flow.KeepNewlines = false
|
||||
flow.KeepNewlines = ctx.options.PreserveNewLines
|
||||
_, _ = flow.Write(bs.Current().Block.Bytes())
|
||||
flow.Close()
|
||||
|
||||
|
||||
+5
-4
@@ -15,10 +15,11 @@ import (
|
||||
|
||||
// Options is used to configure an ANSIRenderer.
|
||||
type Options struct {
|
||||
BaseURL string
|
||||
WordWrap int
|
||||
ColorProfile termenv.Profile
|
||||
Styles StyleConfig
|
||||
BaseURL string
|
||||
WordWrap int
|
||||
PreserveNewLines bool
|
||||
ColorProfile termenv.Profile
|
||||
Styles StyleConfig
|
||||
}
|
||||
|
||||
// ANSIRenderer renders markdown content as ANSI escaped sequences.
|
||||
|
||||
Reference in new issue
Block a user