xod
xod copied to clipboard
As a documentation writer, I want to run CLI-renderer to convert patch saved to an SVG image
As a documentation author, I want a command-line utility that given a path to patch JSON would provide rendered SVG file.
Patch figures are massively used for end-user documentation. It’s a pain to have a long toolset to produce that images.
The better idea is to keep example mini-patches as JSONs along with documentation source files and get them rendered automatically on documentation build.
This would also guarantee that we’ll get 1:1 visual experience between IDE and HTML docs.
Produced SVG’s must be correctly rendered by supported browsers.
Acceptance criteria
- [ ] I can
xodc render /path/to/project/patch-to-render/patch.xodpand result SVG well be rendered to stdout - [ ]
xodc rendercan understand paths of shorter form/path/to/project/patch-to-render/and/path/to/project/patch-to-renderas well - [ ]
xodc rendercan take--outputor-oargument to output to file rather than stdout - [ ] Dimensions of the output are determined by bounding box of patch contents
- [ ] The resulting SVG alone is rendered correctly in Chrome and Firefox
How to implement
- Implement an additional build step of
xod-clientthat would produce a single CSS for patch rendering - Make a
ReadOnlyPatchReact container that is similar to existingPatchbut doesn’t attach all interactive stuff - In the implementation of
rendersubcommand use that container and invoke method to render it to an SVG string - Inline CSS required into the SVG string
- Output the SVG string