mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Merge pull request #145 from jsteuer/master
html escape img alt attribute
This commit is contained in:
commit
b7f25d6cd9
2 changed files with 18 additions and 1 deletions
|
|
@ -142,3 +142,20 @@ bbb
|
|||
//- - - - - - - - -//
|
||||
<p><code>{%</code><em>name</em><code>%}</code></p>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
||||
|
||||
|
||||
12: the alt attribute of img should be escaped
|
||||
//- - - - - - - - -//
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
//- - - - - - - - -//
|
||||
<p><img src="quot.jpg" alt=""" />
|
||||
<img src="apos.jpg" alt="'" />
|
||||
<img src="lt.jpg" alt="<" />
|
||||
<img src="gt.jpg" alt=">" />
|
||||
<img src="amp.jpg" alt="&" /></p>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ func (r *Renderer) renderImage(w util.BufWriter, source []byte, node ast.Node, e
|
|||
_, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))
|
||||
}
|
||||
_, _ = w.WriteString(`" alt="`)
|
||||
_, _ = w.Write(n.Text(source))
|
||||
_, _ = w.Write(util.EscapeHTML(n.Text(source)))
|
||||
_ = w.WriteByte('"')
|
||||
if n.Title != nil {
|
||||
_, _ = w.WriteString(` title="`)
|
||||
|
|
|
|||
Loading…
Reference in a new issue