mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
sphinx.ext.graphviz: use <object> instead of <img> to embed svg
If svg files are embedded in <img> in html, all interactive features are lost, which graphviz is able to produce. This commit replace <img> with <object> for svg files. Close #967
This commit is contained in:
@@ -223,7 +223,8 @@ def render_dot_html(self, node, code, options, prefix='graphviz',
|
||||
alt = node.get('alt', self.encode(code).strip())
|
||||
imgcss = imgcls and 'class="%s"' % imgcls or ''
|
||||
if format == 'svg':
|
||||
svgtag = '<img src="%s" alt="%s" %s/>\n' % (fname, alt, imgcss)
|
||||
svgtag = '''<object data="%s" type="image/svg+xml">
|
||||
<p class="warning">%s</p></object>\n''' % (fname, alt)
|
||||
self.body.append(svgtag)
|
||||
else:
|
||||
mapfile = open(outfn + '.map', 'rb')
|
||||
|
||||
Reference in New Issue
Block a user