Interactive Plantuml with searchable content #1337
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use plantuml & markdown rather extensively so I thought it would be a good idea to extend the existing plantuml feature (https://requarks.canny.io/wiki/p/plantuml-support) in two ways
Make the plantuml Interactive:
Ensure that if the plantuml has links or other interactive content, they can actually be clicked upon.
Also currently plantuml is generated as an img and hence it renders as a picture. instead it needs to be rendered as html text.
Instead of using <img> when svg format is selected, use <object> in markdown-plantuml.
As <object> is normally cleaned up by xss, add an exception in html-security to only allow object if it is generated by the markdown-plantuml render, so that this cannot be exploited.
is only allowed IF the data attribute contains the configured plantuml server url (configured in wikijs by the admin) otherwise it's discarded. So the only url that is trusted is the plantuml server url that an admin configures. This is to avoid users to inject object tags with the same attributes but pointing to another malicious url. In addition, the code discards any extra attributes that may be passed with the object tag
Make the plantuml source searchable:
Plantuml can be used for interaction diagrams, activity diagrams, so the actual plantuml source content should be searchable. I noticed that wikijs searches for content within elements i.e. <tag> content </tag> where content is searchable but not for attribute values i.e. in the following <tag attr="content" /> , content is not searchable
So in order to make this searchable , it is a two step process
This is then picked up by wikijs search.
To test this
` ` `plantuml/` ` `
instead of@startuml /@enduml
so that i get the same result in both vscode and wikijs (ignore the change in server field, i was pointing it to my local plantuml install)Please let me know if there is anything else i need to do.