]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/svg.mdwn
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki.git] / doc / todo / svg.mdwn
1 We should support SVG.  In particular:
2
3 * We could support rendering SVGs to PNGs when compiling the wiki.  Not all browsers support SVG yet.
4
5 * We could support editing SVGs via the web interface.  SVG can contain unsafe content such as scripting, so we would need to whitelist safe markup.
6   * I am interested in seeing [svg-edit](http://code.google.com/p/svg-edit/) integrated -- [[EricDrechsel]]
7
8 --[[JoshTriplett]]
9
10 [[wishlist]]
11
12 I'm allowing for inline SVG on my own installation.  I've patched my
13 copy of htmlscrubber.pm to allow safe MathML and SVG elements (as
14 implemented in html5lib).  <del datetime="2008-03-20T23:04-05:00">Here's a patch
15 if anyone else is interested.</del>
16 <ins datetime="2008-03-20T23:05-05:00">Actually, that patch wasn't quite
17 right.  I'll post a new one when it's working properly.</ins> --[[JasonBlevins]]
18
19 * * *
20
21 I'd like to hear what people think about the following:
22
23 1. Including whitelists of elements and attributes for SVG and MathML in
24    htmlscrubber.
25
26 2. Creating a whitelist of safe SVG (and maybe even HTML) style
27    attributes such as `fill`, `stroke-width`, etc.
28
29    This is how the [sanitizer][] in html5lib works.  It shouldn't be too
30    hard to translate the relevant parts to Perl.
31
32    --[[JasonBlevins]], March 21, 2008 11:39 EDT
33
34 [sanitizer]: http://code.google.com/p/html5lib/source/browse/trunk/ruby/lib/html5/sanitizer.rb
35
36 * * * 
37
38 Another problem is that [HTML::Scrubber][] converts all tags to lowercase.
39 Some SVG elements, such as viewBox, are mixed case.  It seems that
40 properly handling SVG might require moving to a different sanitizer.
41 It seems that [HTML::Sanitizer][] has functions for sanitizing XHTML.
42 Any thoughts? --[[JasonBlevins]], March 21, 2008 13:54 EDT
43
44 [HTML::Scrubber]: http://search.cpan.org/~podmaster/HTML-Scrubber-0.08/Scrubber.pm
45 [HTML::Sanitizer]: http://search.cpan.org/~nesting/HTML-Sanitizer-0.04/Sanitizer.pm
46
47 I figured out a quick hack to make HTML::Scrubber case-sensitive by
48 making the underlying HTML::Parser case-sensitive:
49
50     $_scrubber->{_p}->case_sensitive(1);
51
52 So now I've got a version of [htmlscrubber.pm][] ([diff][])
53 which allows safe SVG and MathML elements and attributes (but no
54 styles&mdash;do we need them?).  I'd be thrilled to see this
55 in the trunk if other people think it's useful.
56 --[[JasonBlevins]], March 24, 2008 14:56 EDT
57
58 [htmlscrubber.pm]:http://xbeta.org/gitweb/?p=xbeta/ikiwiki.git;a=blob;f=IkiWiki/Plugin/htmlscrubber.pm;h=3c0ddc8f25bd8cb863634a9d54b40e299e60f7df;hb=fe333c8e5b4a5f374a059596ee698dacd755182d
59 [diff]: http://xbeta.org/gitweb/?p=xbeta/ikiwiki.git;a=blobdiff;f=IkiWiki/Plugin/htmlscrubber.pm;h=3c0ddc8f25bd8cb863634a9d54b40e299e60f7df;hp=3bdaccea119ec0e1b289a0da2f6d90e2219b8d66;hb=fe333c8e5b4a5f374a059596ee698dacd755182d;hpb=be0b4f603f918444b906e42825908ddac78b7073