Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for interactive plantuml #2754

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bharatrajagopalan
Copy link

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 object tag 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 render object
  • 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 data are overriden to the required values for plantuml to work with wikijs explicitly to avoid any code injection scenarios

Tested using sample markdown

@DraakBZH
Copy link

any idea when it could be merged? I need this! :D

@ImBoop
Copy link

ImBoop commented Sep 6, 2022

Requesting a followup on this, one year later!

@hernrup-modelon
Copy link

+1 for this. The interactivity is a must for plantuml-C4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants