adrianvlupu / C4-Builder

This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
https://adrianvlupu.github.io/C4-Builder/
MIT License
563 stars 93 forks source link

Including C4-PlantUML locally with relative path #3

Open schferbe opened 4 years ago

schferbe commented 4 years ago

The C4-PlantUML documentation suggests that you can include the puml files locally with relative paths. I tried this with c4builder site and "generateLocalImages": true but that results in errors.

Is there a way that I missed?

azizur commented 4 years ago

Looks like this is always going to the remote server (www.plantuml.com): https://github.com/adrianvlupu/C4-Builder/blob/master/utils.js#L119

adrianvlupu commented 4 years ago

I'm working on a feature to allow it to clone the C4-PlantUML repo locally. Hopefully it will be up this weekend.

@schferbe, the generateLocalImages refers to the actual image generation from .puml files without hitting the PlantUML server. Most likely you don't have java, graphviz and all the stuff required to actually do it locally. I think I need to update the readme with how to set that up or try to make the module actually install them.

adrianvlupu commented 4 years ago

@azizur, the line is from a helper function in case the online server is used. The relevant lines are in https://github.com/adrianvlupu/C4-Builder/blob/master/build.js#L584, https://github.com/adrianvlupu/C4-Builder/blob/master/build.js#L158 and https://github.com/adrianvlupu/C4-Builder/blob/master/build.js#L102

bwoester commented 4 years ago

I wouldn't necessarily go with relative include paths. If you work on the same project with a couple of colleagues, or on a couple different devices, this forces every environment to stick to a certain folder structure.

From my point of view (and maybe it's already possible and I simply missed it), it should be good enough to provide a way to configure PlantUML's include path.

ognyandim commented 3 years ago

This is another problem with C4-PlantUML local install.

I use it locally by replacing the C4-Plantuml web paths to local paths.

Repro:

The problem with this is that when another developer downloads the docs the absolute path must be replaced everywhere.

Summary:

Possible solution: Is it hard to add a path in the config that changes that?

darielrll commented 3 years ago

Hi, any update on this issue?

ognyandim commented 3 years ago

Do you accept PRs? I can try to work on this.

adrianvlupu commented 3 years ago

Yes, I accept PRs. Last weekend I managed to merge a couple of them. I would really appreciate a PR.

There's a branch I use for local development at https://github.com/adrianvlupu/C4-PlantUML/tree/local, that could be a good starting point.

darielrll commented 3 years ago

I solved this for now while the final solution is being developed using a local plantuml server in a docker container and adding the capability to serve as a static file the core C4 files, and modify C4 files to get the dependencies from this local server. Here is my initial approach: https://github.com/darielrll/c4-builder-example

kontza commented 3 years ago

This (work on local solution) sounds promising.

My current workaround is as such:

I noticed that if I have a file .vscode/settings.json with the following:

{
    "plantuml.includepaths": ["C4-PlantUML directory"]
}

it works in VS Code.

The solution you work on... Could it scan that .vscode/settings.json if it exists, and use that?

uhippo commented 3 years ago
  1. Put "C4-PlantUML" in the project root.
  2. Update "!include https://raw.githubusercontent.com/adrianvlupu/C4-PlantUML/latest/C4_Component.puml" to "!include <C4/C4_Component>"
jonesmith518 commented 2 years ago

thanks , and my additional settings: in vscode settings: "plantuml.includepaths": ["/path/to/C4-PlantUML-2.4.0"], "plantuml.commandArgs": ["-DRELATIVE_INCLUDE=\".\""]