From ebebb1b7e92c5d85bf90633dca5e88e92a2cc370 Mon Sep 17 00:00:00 2001 From: Marc Izquierdo Date: Tue, 12 Sep 2023 14:59:17 +0200 Subject: [PATCH] Allow adding custom styles to images --- html.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/html.go b/html.go index fa044ca2..6fa95dd4 100644 --- a/html.go +++ b/html.go @@ -72,6 +72,8 @@ type HtmlRendererParameters struct { HeaderIDPrefix string // If set, add this text to the back of each Header ID, to ensure uniqueness. HeaderIDSuffix string + // If set, add this style to each image. + ImageStyleTag string } // Html is a type that implements the Renderer interface for HTML output. @@ -521,6 +523,10 @@ func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []b out.WriteString("\" title=\"") attrEscape(out, title) } + if options.parameters.ImageStyleTag != "" { + out.WriteString("\" style=\"") + attrEscape(out, []byte(options.parameters.ImageStyleTag)) + } out.WriteByte('"') out.WriteString(options.closeTag)