mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-27 03:29:58 -04:00
Support styled prefix/suffix in ParagraphElement
This commit is contained in:
1 parent
7c15f8780e
commit
75c1852f53
1 file changed
+5
-3
+5
-3
@@ -23,7 +23,8 @@ func (e *ParagraphElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
}
|
||||
bs.Push(be)
|
||||
|
||||
renderText(w, bs.Current().Style, rules.Prefix)
|
||||
renderText(w, bs.Parent().Style, rules.Prefix)
|
||||
renderText(w, bs.Current().Style, rules.StyledPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -33,8 +34,6 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
|
||||
keepNewlines := false
|
||||
|
||||
renderText(bs.Current().Block, rules, rules.Suffix)
|
||||
|
||||
mw := NewMarginWriter(ctx, w, rules)
|
||||
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
|
||||
flow := reflow.NewReflow(int(bs.Width(ctx)))
|
||||
@@ -49,6 +48,9 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
_, _ = mw.Write([]byte("\n"))
|
||||
}
|
||||
|
||||
renderText(w, bs.Current().Style, rules.StyledSuffix)
|
||||
renderText(w, bs.Parent().Style, rules.Suffix)
|
||||
|
||||
bs.Current().Block.Reset()
|
||||
bs.Pop()
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user