]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/SVG_files_not_recognized_as_images.mdwn
(no commit message)
[ikiwiki.git] / doc / bugs / SVG_files_not_recognized_as_images.mdwn
1 In ikiwiki 2.66, SVG images are not recognized as images. In ikiwiki.pm,
2 the hardcoded list of image file extensions does not include ".svg", which
3 it probably should unless there's some other issue about rendering SVGs?
4
5 The 'img' plugin also seems to not support SVGs.
6
7 > SVG images can only be included via an `<object>`, `<embed>`, or
8 > `<iframe>` tag. Or, perhaps as [inline SVG](http://wiki.svg.org/Inline_SVG). 
9 > The [[plugins/htmlscrubber]] strips all three tags since they can easily
10 > be used maliciously. If doing inline SVG, I'd worry that the svg file
11 > could be malformed and mess up the html, or even inject javascript. So,
12 > the only options seem to be only supporting svgs on wikis that do not
13 > sanitize their html, or assuming that svgs are trusted content and
14 > embedding them inline. None of which seem particularly palatable.
15
16 > I suppose the other option would be converting the svg file to a static
17 > image (png). The img plugin could probably do that fairly simply.
18 > --[[Joey]]
19
20 >> This seems to have improved since; at least chromium can display svg
21 >> images from `<img>` tags. Firefox 3.5.19 did not in my testing.
22 >>
23 >> So, svgs can now be included on pages by linking to them, or by using
24 >> the img directive. The most portable thing is to use the img directive
25 >> plus some size, which forces them to be resized and a png to actually
26 >> be displayed.
27 >>
28 >> I have not yet tried to do anything with sanitizing them. --[[Joey]] 
29
30 >> I'm working on inline SVG and MathML support in ikiwiki and I've
31 >> modified my htmlscrubber to sanitize SVG and MathML using the
32 >> whitelists from html5lib.  Here's a [patch][].  I've also made some
33 >> notes about this here: [[todo/svg]].
34 >> 
35 >> I suspect that this bug may have caught the eye of anyone interested
36 >> in this sort of thing.  I'll elaborate a bit on my user page to avoid
37 >> getting off-topic here. --[[JasonBlevins]], October 21, 2008
38
39  [patch]: http://xbeta.org/gitweb/?p=xbeta/ikiwiki.git;a=blobdiff;f=IkiWiki/Plugin/htmlscrubber.pm;h=3c0ddc8f25bd8cb863634a9d54b40e299e60f7df;hp=3bdaccea119ec0e1b289a0da2f6d90e2219b8d66;hb=fe333c8e5b4a5f374a059596ee698dacd755182d;hpb=be0b4f603f918444b906e42825908ddac78b7073