Add syntax coloring to XML dialog
Add the Gtk Source View library to enable syntax coloring in the XML Dialog when editing style and d attributes. This MR is a collaboration with @S-Rafael.
Inline-style and path "d" attribute are reformatted for editing (aka pretty-printed) making it easy to see individual elements (styles and path commands).
Coloring applies to XML dialog tree too:
The tree no longer shows the superfluous svg: prefix for SVG namespace elements.
Syntax coloring for <style> content:
Syntax highlighting scheme can be selected in the preferences. Apart form stock themes that are two Inkscape-specific themes for light and dark UI theme, that are created specifically for our use of highlighting. They support in-line CSS styles and SVG path "d" attribute fully. Other themes may not offer distinct colors for all path command arguments.
Those two themes are also special in a sense that Inkscape can automatically select correct one (that is dark or light) based on current UI theme.
- Theme selector
- Ability to turn coloring off
- Option to use monospaced font in XML dialog
Improved experience adding new element in XML dialog:
To do
-
Ensure that CSS minification doesn't remove semantic whitespace (don't strip spaces inside parens). -
Add a language definition for the SVG dattribute. -
Implement reformatting for d. -
Force style/path dattribute editing in a popup. -
Apply color scheme to XML tree. -
Add user preferences for selecting themes. -
Add syntax coloring for <polygon>points. -
Add gtksourveview4as a dependency in the CI pipeline: see inkscape-ci-docker!34 (merged) -
Ensure the gtksourceview library is bundled in the Windows installation. -
Ensure it's also packaged into the AppImage (should be taken care of by inkscape-ci-docker!34 (merged)) -
Ensure it's also packaged into the macOS application.
Stretch goal:
-
Add warning for invalid SVG path data attribute.
Closes inbox#4263 (closed) | Closes inbox#4264 (closed)





