mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-05 16:37:19 -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)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,8 +34,6 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
|
|
||||||
keepNewlines := false
|
keepNewlines := false
|
||||||
|
|
||||||
renderText(bs.Current().Block, rules, rules.Suffix)
|
|
||||||
|
|
||||||
mw := NewMarginWriter(ctx, w, rules)
|
mw := NewMarginWriter(ctx, w, rules)
|
||||||
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
|
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
|
||||||
flow := reflow.NewReflow(int(bs.Width(ctx)))
|
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"))
|
_, _ = mw.Write([]byte("\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderText(w, bs.Current().Style, rules.StyledSuffix)
|
||||||
|
renderText(w, bs.Parent().Style, rules.Suffix)
|
||||||
|
|
||||||
bs.Current().Block.Reset()
|
bs.Current().Block.Reset()
|
||||||
bs.Pop()
|
bs.Pop()
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user