mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Move stateful objects to RenderContext struct
This commit is contained in:
@@ -10,10 +10,12 @@ type ImageElement struct {
|
||||
}
|
||||
|
||||
func (e *ImageElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error {
|
||||
ctx := tr.context
|
||||
|
||||
if len(node.LastChild.Literal) > 0 {
|
||||
el := &BaseElement{
|
||||
Token: string(node.LastChild.Literal),
|
||||
Style: tr.style[ImageText],
|
||||
Style: ctx.style[ImageText],
|
||||
}
|
||||
err := el.Render(w, node.LastChild, tr)
|
||||
if err != nil {
|
||||
@@ -24,7 +26,7 @@ func (e *ImageElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) erro
|
||||
el := &BaseElement{
|
||||
Token: resolveRelativeURL(tr.BaseURL, string(node.LinkData.Destination)),
|
||||
Prefix: " ",
|
||||
Style: tr.style[Image],
|
||||
Style: ctx.style[Image],
|
||||
}
|
||||
err := el.Render(w, node, tr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user