mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-08-30 21:56:44 -04:00
Support styled prefix/suffix in ParagraphElement
This commit is contained in:
+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