Skip to content

Commit

Permalink
Inline to use <img> tag
Browse files Browse the repository at this point in the history
  • Loading branch information
litao-byted committed Jul 20, 2019
1 parent 72698dc commit eb368c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inline_tex_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mathjax

import (
"bytes"
"encoding/base64"
"fmt"

"github.com/yuin/goldmark/ast"
Expand Down Expand Up @@ -32,7 +33,7 @@ func (r *InlineTexMathRenderer) renderInlineMath(w util.BufWriter, source []byte
svg := r.texRenderer.RunInline(buf.String())
_, _ = w.WriteString(`<span class="latex-svg inline">`)
if svg != nil {
_, _ = w.WriteString(string(svg))
_, _ = w.WriteString(`<img alt="" src="data:image/svg+xml;base64, ` + base64.StdEncoding.EncodeToString(svg) + `">`)
}
return ast.WalkSkipChildren, nil
}
Expand Down

0 comments on commit eb368c7

Please sign in to comment.