Changes for interactive plantuml
This is a copy of the original pull request here
Creating this pull request on dev branch as discussed with @NGPixel . I had originally created this a while ago by forking the master branch and hence needed to rewrite this using DOMPurify.
Summary: Plantuml is currently created as an image which means that links do not work and the plantuml content is treated as a picture and is not searchable
This PR does the following:
- Renders plantuml as svg using
objecttag so that it is interactive and selectable (e.g. you can now copy paste text from within the diagram) with a backup non-interactive img tag if browser will not renderobject - Places the original plantuml content inline inside the object tag to ensure that this is not visible but included in wikijs search index
As object tag is typically insecure, it is checked and sanitised to make sure that
- Only the configured plantuml server, image format (e.g. https://plantuml.requarks.io/svg/
) are allowed in the url parameter passed in data; Any other value results in the node being discarded - Only attributes required for plantuml+wikijs are allowed (
style/class/type/data/alt); mismatch in number of attributes being passed in will result in the node being discarded. - Allowed attributes other than
dataare overriden to the required values for plantuml to work with wikijs explicitly to avoid any code injection scenarios
Tested using sample markdown
any idea when it could be merged? I need this! :D
Requesting a followup on this, one year later!
+1 for this. The interactivity is a must for plantuml-C4.