vscode-plantuml icon indicating copy to clipboard operation
vscode-plantuml copied to clipboard

!include not inlined in markdown preview

Open wrzlbrzl opened this issue 3 years ago • 5 comments

The plantUML server responds with

[From string (line2)]

@startuml
!include config_sequence.puml
cannot include config_sequence.puml

i.e. the include file is not inlined

  • inlining works when specifing absolut path to puml file
  • VScode workspace folder includes the folder to example.md
  • no folder settings in plantuml extension
  • example.md and config_sequence.puml are stored in the same folder

the behavior can be reproduced with a minimal md file, e.g.
example.md

    ```plantuml
    @startuml
    !include config_sequence.puml
    @enduml
    ```

Is there anything in this setting that forbids include inlining?

wrzlbrzl avatar May 24 '22 09:05 wrzlbrzl

This seems to be related to previous redesigns of include handling, i.e. #260. According to the readme, I would have expected it to work given the new search order:

  1. The folder of the rendered file
  2. The includepaths as configured in settings.json Can somebody confirm whether a relative link (relative to the .md file, that is) is supposed to work in markdown preview?

wrzlbrzl avatar Jun 01 '22 06:06 wrzlbrzl

No, the rendering codes has no way to get the parent document where the diagram is in, so relative links won't work.

qjebbs avatar Jun 22 '22 03:06 qjebbs

that is understood from a server point of view.

Are you saying that the preprocessing is not used for markdown preview at all?

wrzlbrzl avatar Jun 22 '22 06:06 wrzlbrzl

I am not able to run it as Local. And not with !include with server on Linux

ipcoder avatar Jul 25 '22 17:07 ipcoder

@qjebbs: I spent half an hour analyzing the code in the preprocessing and I don't understand why this could not work.

Here are some ideas:

  1. If the parent document is unknown, just try all combinations of {includePaths, diagramsRoot, workspaceRoot} + include_string - the first that is an existing file is used.
  2. Alternatively (or, if step 1 fails), search for the relative path of the !include in the diagramsRoot, and return the first hit.

Solution 2 would also make it unnecessary to add includePaths 🙂

arwedus avatar Apr 05 '23 19:04 arwedus