structurizr / lite

Structurizr Lite
https://docs.structurizr.com/lite
MIT License
268 stars 32 forks source link

Images from markdown documentation, are imported into workspace.json, but never removed. #160

Closed gumbo2k closed 2 months ago

gumbo2k commented 2 months ago

Expected

When linking to markdown documentation of a software system with images, the documentation is rendered correctly in structurizr. A side effect is, that the image gets copied and embedded as base64 into the workspace.json file.

Expectation: When removing the image-link from the documentation, I would expect structurizr to also remove the embedded image from the workspace.json.

Alternative Expectation: Not embedd the image into workspace.json at all. I suspect, it is needed "on the wire" between the structurizr server and the browser, but at least not the workspace.json that is stored on disk could be cleaned up.

Actual

The image stays embedded as base64 string in the workspace.json

Steps to reproduce

Create a workspace.dsl and link the software system documentation

...
        mysystem = softwareSystem "My Software System" {
            !docs ../../arc42/mysystem
...

Create a the documentation file ../../arc42/mysystem/architecture.md that contains an image link like this:

...
![Some Image](images/some-image.png)
...

Place some-image.png in ../../arc42/mysystem/images/

Open workspace with structurizr lite (if you use the container, make sure you do not bind-mount the directory where workspace.dsl lies, but its grand-parent directory and use STRUCTURIZR_WORKSPACE_PATH=dir1/dir2 )

Version/build information

Structurizr Lite

Severity

Minor

Priority

I have no budget and there's no rush, please fix this for free

More information

No response

simonbrowndotje commented 2 months ago

This is working as expected ... file-based images are inlined (as a Base64 data URIs) into the workspace. The reason is that Markdown is rendered client-side in the web browser, which doesn't have access to your file system.