feature: better support for published svg documents
Background
Currently, Inkscape supports several features that facilitate distribution of Inkscape documents into non-Inkscape, SVG display environments:
- Export as plain SVG.
- Export as optimized SVG.
- Export with text converted to paths.
- Embed linked images. (Currently, only by plugin, and only functional in place, that is, by changing the source document.)
These features are not well integrated, with examples of problems among the following:
- Optimization lacking CLI support.
- Embedding requiring either making a destructive modification to the source or making an intermediary target.
- Embedding currently only supporting raster targets.
Further, a user seeking comprehensive support for exporting to a format suitable for publication faces limited or no support for a variety of useful cases, including all of the following:
- Not imposing Inkscape's particular, editor-oriented restrictions on SVG document structure, such as Inkscape's tendency to insert
style
attributes into elements that otherwise obtain all style information from class tags. (Such restrictions have many unwanted effects, depending on the particular case, including added difficulty for integrating the target file into display environments, such as web pages, that include their own styles.) - Embedding linked images (including raster and SVG targets) on-the-fly, without modifying the source document.
- Embedding any required non-image dependencies (in addition to embedded images), that may be supported by Inkscape at any current iteration (e.g. if external style sheets are supported in the future), in order to support standalone, zero-dependency documents.
- Removing all absolute links, in favor of relative links, and, if appropriate, copying dependencies to the same directory as the exported target, to create a colocated package of files that satisfy all dependencies, much like many web browsers will save a page and all dependencies in a local target location, with link locations rewritten appropriately.
- Support for all above and related features from command line, for automated scripting, in addition to from graphical interface.
- In cases where the user may be unaware of external dependencies, display of a warning against publishing the document without including the dependencies.
Suggestion
Support export, both by graphical interface and command line, to plain SVG images satisfying a greater variety of the cases described.
With SVG gaining support in a widening variety of targets, including HTML5, EPUB, and so on, the importance becomes greater for producing robust, safe, optimized images.
Further Notes
- This issue is largely a superset of #131, though more complete consideration of the relevant issues lead me to create an issue oriented toward a more thorough, comprehensive solution to a set of related problems.
- I recently reviewed part of the codebase of an open source-initiative, to discover that the SVG icon included for distribution is an Inkscape file that includes an absolute path in the system of one of the developers. It is very unlikely that the developer intended this effect. If feature for publishing a document, with support for various cases, according to options, were included with Inkscape, and were clearly visible within the graphical interface, then casual and advanced users alike would be more likely and more able to produce robust and secure documents for a variety of purposes.
Edited by brainchild