Code Monkey home page Code Monkey logo

c4-builder's Introduction

Overview

c4builder is a lightweight nodejs cli tool for building, maintaining and sharing a software architecture project using only text.

The main idea behind the project is that a developer could use familiar tools to define software.

Combined with git any change to the architecture defined in those documents is easily traced. Pull requests, branches, cherry picks and all of the git features could be used as an easier way to keep track of the projects architectural changes.

It relies on these great projects :

  • PlantUml creates diagrams from plain text.

  • Markdown creates rich text documents from plant text.

  • C4Model the idea behind maps of your code

  • C4-PlantUML C4 syntax support for generating plantuml diagrams

  • Docsify creates a single page site based on markdown files.

  • vscode-plantuml plugin for visual studio code to view diagrams at design time

I strongly encourage people to check them out first but if you want to dive right in, the new project template should be easy to understand and edit.

edit

Getting started

npm i -g c4builder

The easiest way to get started is with the new project template.

new

c4builder new
cd project
c4builder

A sample project is available at C4Builder-Demo.

Available Commands

PS C:\docprojects\Online Banking> c4builder --help
Usage: index [options]

Options:
  -V, --version   output the version number
  new             create a new project from template
  config          change configuration for the current directory
  list            display the current configuration
  reset           clear all configuration
  site            serve the generated site
  -w, --watch     watch for changes and rebuild
  docs            a brief explanation for the available configuration options
  -p, --port <n>  port used for serving the generated site
  -h, --help      output usage information

By default, running c4builder will attempt to build the project.

If no configuration was set it will ask for it and then do the actual build. Running just c4builder after a configuration will no longer show the wizard.

To change the configuration after building for the first time just run c4builder config. The default will be the configuration set previously so you can just edit the options you are interested in.

The project

The project consists of two main folders. The source folder and the destination folder.

Following the C4 model, folders inside the source represent Systems/Containers/Components or any other additional type of information regarding the software.

│   .gitignore
│   README.MD
├───docs # destination folder
└───src # source folder
    │   context.md
    │   context.puml
    └───Internet Banking System
        │   system.puml
        │   system.md
        ├───API Application
        │       container.puml
        │       container.md
        └───Single Page Application
            │   container.puml
            │   container.md
            └───Additional Information
                    additionalDetails.md
                    class.puml
                    sequence.puml
                    class.1.md

The destination folder is automatically generated by the build process and can have various formats. The folder can provide a drill down style view of the Systems/Containers/Components in different ways. Either by pushing it as a site to gitpages, using it as a navigable markdown directly in the repository or by generating pdfs and using the traditional mail.

The build

The build process consists of parsing the folder structure and merging together all the information found in the markdown files and diagrams into a single file per folder.

The basic navigation, table of contents, local generation of images and their inclusion in the end documentation is automatically handled.

c4builder comes with a wizard for managing configuration for each project folder.

wizard

NOTE

Files starting with _ will be ignored during the build process

Diagrams can be placed at arbitrary positions by adding them to the markdown file like this: ![name](<diagram name>.puml)

The output

Using the configuration wizard you can choose any combination of outputs. By default all are enabled.

The output should have the same folder structure as the source. Each .md file inherits all the contents from the source .md files in that folder and appends either a link or the actual diagram images at the bottom/top of the file.

│   .gitignore
│   README.MD
├───docs
│   │   README.md
│   └───Internet Banking System
│       │   README.md
│       ├───API Application
│       │       README.md
│       └───Single Page Application
│           │   README.md
│           └───Additional Diagrams
│                   README.md
└───src
    │   ...

Collection of markdowns with navigation

The generated markdown files can be pushed to git and viewed directly as a readme.

mds

Options:

  • basic navigation

    The basic navigation comes in the form of a menu providing a link to the parent and descendants.

    basicnav

  • table of contents (default)

    The table navigation always shows all entities and bolds the current one

    tablenav

Single markdown file

Outputs into a single file containing all entities. It includes a table of contents and a 'go to top' link after each section.

The generated markdown file makes for an easy single page readme for the repository.

singlemd

Collection of pdf files each describing one entity

A fast way to pass around information regarding only one particular System/Container/Component

pdf

Single pdf file with a table of contents

The easiest format to share the full documentation

pdffull

Docsify site with a sidebar

After choosing to generate a docsify site, it can be viewed locally by running c4builder site and accessing http://localhost:3000;

The site is minimalistic including only a sidebar with the System/Container/Components hierarchy.

The sidebar is generated manually so that it only contains the main entities defined in the project in a hierarchical way.

site

By going to the github repository settings and enabling GitHub pages the site be pushed with ease and provide an overview to all people involved in the project without having to worry about which version of pdf file got sent when.

github

Generate diagrams locally

By default this option is disabled. The output will contain image files generated using the plantuml server.

![diagram](https://www.plantuml.com/plantuml/svg/0/fLLDRnen4BqZyH-c72eY4RZqr5CJWff48K5PqgIdQDOxW5j_h6ml9AhwtplsifibJPL3EO0yVfvvy_p6VF41NQYqwlS-I2DKLL3b56n2AFtdoSJXRho...)

If enabled, all images will be generated using the local copy of plantuml and will get added to the destination folder.

Replace diagrams with link

By default this is disabled. If enabled, the output will no longer include the actual diagrams but a link to the image file.

Include breadcrumbs

The current entity structure is inserted after the header

Custom pdf

If defined, this css is used in the generation of the pdf files.

Future plans

I would like to bind the build phase to the C4 model. It could parse the diagrams and know what Person/System/Component/Container is related to what and help with additional validation. Maybe even export to structurizr or vice versa.

The project is still in it's early phase and I intend on using it on some actual projects in order to find more use cases and fix bugs.

Change log

v0.2.16

Partial build (image generation) #55 (MickeJohannesson)

Bugfixes

v0.2.14

Diagrams at arbitrary positions #28 (Sjuanola)

Support for Ditaa Diagrams #56 (MickeJohannesson)

Resolved npm vulnerabilities

Latest plantuml jar file 1.2022.3.jar

Dockerfile #51 (craigwardman)

Search in site sidebar #48 (arifinoid)

v0.2.12

Relative urls in TOC for multiple markdown files #9.

Fixed Processed 1/1..2/2 files bug.

Added another version of the PlantUML jar file.

v0.2.11

Updated latest plantuml jar to 1.2021.7.jar #41 (pandasuit)

Allow input plantuml source files to use relative include statements to other plantuml files #42 (pandasuit)

Local image generation in sequence due to the jar failing with "dot executable not found".

v0.2.9

Updated VSCode snippets and resolved npm audit issues

Docsify image plugin #20 (alefcarlos)

PlantUML 1.2020.17 #23 (RohanTalip)

Configurable PlantUML Server url #25 (jikuja), #29 (coryodaniel)

GitHub Action for running C4 Builder in CI #16 (hkdobrev)

Overloading the docsify template #27 (sju66)

v0.2.12

Relative urls in TOC for multiple markdown files #9.

Fixed Processed 1/1..2/2 files bug.

Added another version of the PlantUML jar file.

v0.2.7

Resolved npm audit issues

The projects generated now support PlantUML versioning

PlantUML jar files included

v0.2.4

Solved the limation of including local images in the markdown files.

Updated the project template with the diagram descriptions from C4Model

v0.2.3

Updated template to include the new Dynamic Diagram in C4-PlantUML and fixed npm audit issues.

v0.2.1 + v0.2.2

Added the c4builder --watch option and some refactoring.

v0.2.0

Pdf generation now uses puppeteer. There are no more scaling issues for high resolution displays. Used the css file from vscode-markdown-pdf.

Removed unused dependencies.

v0.1.9

Thanks to howiefh for adding the charset option.

v0.1.8

Updated template to include the new Deployment Diagram in C4-PlantUML and more info inside readme.md

node-plantuml accepted the pull request #29 so I changed the dependency back to the original repository.

v0.1.7

Changed template to include the latest C4-PlantUML!include https://raw.githubusercontent.com/adrianvlupu/C4-PlantUML/latest/...

v0.1.6

Switched from http-server module to express for serving the static site.

Added the option to place diagrams before text.

v0.1.5

PlantUML recently switched to V1.2019.6 adding some breaking changes to !define and !definelong. You can still use them but when calling you have to add () method call (http://plantuml.com/preprocessing)

Considering they updated their server to use the new version, diagrams generated locally that display correctly won't work on the plantuml server and viceversa

Until the underlying node-plantuml package gets updated, I changed the dependency to the fork at https://github.com/adrianvlupu/node-plantuml.git

Also the !include directives on each template diagram point to the 1.2019.6 compatible version hosted at https://github.com/adrianvlupu/C4-PlantUML.

c4-builder's People

Contributors

adrianvlupu avatar alefcarlos avatar brycecutt-msft avatar coryodaniel avatar craigwardman avatar dependabot[bot] avatar hkdobrev avatar howiefh avatar mickejohannesson avatar rohantalip avatar sjuanola34 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c4-builder's Issues

c4builder watch

A watch option with the site command would be convenient, to update the site upon changes, without having to stop the server, rebuild, and start again.

C4Builder command never terminates

C4Builder command (version 0.2.16) never terminates and have to do Ctrl-C to close.
This causes timeout issues when used in a DevOps CI/Cd pipelines.
Command works and build the docs as expected, but then just hangs after it is done,

c4builder

Fails to install on ubuntu (via docker/node)

I tried installing on my local ubuntu machine and when that didn't work (thought it was my version of node/npm) I tried installing in a docker container:

$ docker pull node:16
$ cat c4builder.Dockerfile
FROM node:16
RUN npm i -g c4builder
$ docker build -t c4builder - < c4builder.Dockerfile

This fails:

npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/joi. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/c4builder/node_modules/node-plantuml
npm ERR! command failed
npm ERR! command sh -c node scripts/get-vizjs.js
npm ERR! node:events:498
npm ERR!       throw er; // Unhandled 'error' event
npm ERR!       ^
npm ERR! 
npm ERR! Error: spawn java ENOENT
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR!     at onErrorNT (node:internal/child_process:478:16)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! Emitted 'error' event on ChildProcess instance at:
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR!     at onErrorNT (node:internal/child_process:478:16)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
npm ERR!   errno: -2,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'spawn java',
npm ERR!   path: 'java',
npm ERR!   spawnargs: [
npm ERR!     '-Dplantuml.include.path=/usr/local/lib/node_modules/c4builder/node_modules/node-plantuml',
npm ERR!     '-Djava.awt.headless=true',
npm ERR!     '-jar',
npm ERR!     '/usr/local/lib/node_modules/c4builder/node_modules/node-plantuml/vendor/plantuml.jar',
npm ERR!     '-testdot'
npm ERR!   ]
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-02-28T22_11_43_780Z-debug-0.log
The command '/bin/sh -c npm i -g c4builder' returned a non-zero code: 1

I get the same error using node:alpine or node:17 as the FROM

Relative paths for navigation links.

It seems that when the output is multiple markdown files the navigation link targets are preceded by '/' which when viewed on GitHub links relative to the project root and causes problems when the c4builder project is not located at the repository's root. I think it is reasonable to expect the documentation to be in a directory not at root.

Overview diagram is not displayed on new project

I need to create a C4 diagram models using a personal plantuml server. In this GitHub repository I am trying to get it to work.
I create a docker container for the plantuml server(this is a requirement for my use case), I modified the container to serve also as static files the C4 plantuml core files.

Once the site is generated, the only image that is with error is the first image(context.svg), the one in the Overview section.
image

I am using by default C4 model example when the project is created initially, my only modification here is to have a local plantuml server and consume core C4 files locally as static files.

This is the preview of the generated file context.svg:
image

But, if I delete the selected code in the generated file context.svg:

image

then the image is shown correctly:

image

So, I need to understand why this is happening, thanks in advance for your help

Support to multiple languages when create a c4builder project

Maybe it should be helpful to support multiple languages.

I'm a committer in an OpenSource project, which has PT-BR and ENG doc versions. I aim to use c4 builder to document the project's architecture and integrate them with my doc. For this, I need to build two c4 builder projects, one in PT-BR and a second in English.
I think it should be an option when creating the project to allow support for multiple languages.

Something as:

  • docs
    • pt-br
    • eng
    • fr
  • src
    • pt-br
      • system.puml
      • system.md
    • eng
      • system.puml
      • system.md
    • fr
      • system.puml
      • system.md

If this sounds like a good idea, I'd be happy to also work on a PR for this.

Partial build in development

c4builder seems to be building images for all of them for every build even when there are no changes. It would be great if we can only build images where there are changes.

same thing with -watch as well.

Error create new project

After install, i create new project

c4builder new

And i have this message:

_ _ _ _ _ _ ___| || | | |__ _ _(_) | __| | ___ _ __ / __| || |_| '_ \| | | | | |/ _ |/ _ \ '|
| (
|__ | |) | || | | | (| | / |
_
| || |./ _,|||_,|_|_|

Blow up your software documentation writing skills

This will create a new folder with the name of the project
? Project Name (node:42774) ExperimentalWarning: The fs.promises API is experimental
`

$ node -v
v10.15.1

npm install issues

Following the readme guidelines trying to install c4builder via
npm i -g install c4builder
I am running into issue with zlib, has anyone else encountered this on mac?

Error:
npm timing command:i Completed in 72965ms
npm ERR! code 127
npm ERR! path /usr/local/Cellar/nvm/0.37.2/versions/node/v17.4.0/lib/node_modules/c4builder/node_modules/zlib
npm ERR! command failed
npm ERR! command sh -c node-waf clean || true; node-waf configure build
npm ERR! sh: node-waf: command not found
npm ERR! sh: node-waf: command not found
npm timing npm Completed in 73370ms

Using `"generateLocalImages": true` fails without error when server URL is bad

I encountered this when trying out the C4Builder-Demo. Since I was trying out something new, I was expecting problems and wasn't too thrown off, but we're setting up this to be used by all developers on our projects, an error message would be really helpful.

Steps to reproduce

  1. Install c4builder
  2. Clone C4Builder-Demo && cd C4Builder-Demo
  3. Copy pdf.css as per adrianvlupu/C4Builder-Demo#1
  4. Make sure .c4builder has "plantumlServerUrl": "https://www.plantuml.com/plantuml",, using https instead of the supported http
  5. rm -rf docs && c4builder

Expected result

docs/context.png should be a valid PNG.

Actual result

docs/context.png is 0 bytes, and there is no error message. This is the output from running:

$ rm -rf docs && c4builder
       _  _   _           _ _     _           
   ___| || | | |__  _   _(_) | __| | ___ _ __ 
  / __| || |_| '_ \| | | | | |/ _` |/ _ \ '__|
 | (__|__   _| |_) | |_| | | | (_| |  __/ |   
  \___|  |_| |_.__/ \__,_|_|_|\__,_|\___|_|   
                                              
Blow up your software documentation writing skills

building documentation in ./docs
parsed 7 folders
generating images
processed 8/8 images
generating markdown files
processed 7/7 files
generating docsify site
generating complete pdf file
built in 6.945 seconds

to view the generated website run
> c4builder site

Open diagrams in a new tab

Hi! Thank you for this amazing project !

Is there a way to create a link for generated diagrams when using local render ? We cant zoom in on diagrams, so it would be cool if we had link targeting "_ blank".

What do You think ?

Edit:
I saw docsfy has a plugin to zoom in: https://docsify.js.org/#/plugins?id=zoom-image
I created a PR includind this ref.

Use top-level README file

Repositories typically have a top-level README file that explains what the project is about and how to get started using it. I think it would be helpful to re-use that file when generating the documentation using c4builder:

/README.md       # for website generation, use this as the start page (and assume it has a link to e.g. `doc/all-in-one.md`); for pdf, use this as the intro section
/src/context.md  # this is the "architecture overview" linked to in the top-level readme

Are there already ways to achieve this or any thoughts on alternative approaches? If this sounds like a good idea I could also work on a PR for this.

Support add some hooks before/after/in when build src to docs

Is it possible to add some hooks before and after the build function, as well as before and after converting PUML to PNG, to achieve some effects using additional script processing?
For example, my current project scans all generated markdown files after build is complete, and then

```python @execute
import Demo
text=Demo.SOME_KEY
```
```python @execute
def outout(s:io.StringIO()):
    io.append("test")
```

The content in the API description is output according to the Python script I wrote. If this is used to automatically generate and export some APIs and descriptive text.

In addition, before converting PUML, we can write a script to replace placeholders like '$ABC' to automatically generate some PUML content to prevent a certain degree of document corruption.

At present, my approach is to simply rewrite build.js to achieve my goal, but I think it can be more modular

const {build} = require('c4builder/build')
const {execSync} = require('child_process')
const {existsSync} = require('fs')
const extraBuild = async (options, conf) => {
    await build(options, conf)
    const venv = '../../venv/bin/python'
    const python = existsSync(venv) ? venv : 'python'
    console.log('process markdown python start');
    execSync(`${python} ./scripts/process_md_python.py`, (error, stdout, stderr) => {
        if (error) {
            console.error('execute python error', error)
        }
        if (stdout) {
            console.log(stdout)
        }
        if (stderr) {
            console.error(stderr)
        }
    })
    console.log('process markdown python finish');

}
module.exports = {build: extraBuild}
import glob
import io

import sys

sys.path.append("../../src")
sys.path.append("../")

for file in glob.glob('./docs/**/*.md', recursive=True):
    f = open(file)
    content = f.read()
    find_exec = True
    while find_exec:
        namespace = {}
        word = "```python @execute"
        start = content.find(word)
        if start > 0:
            end = content.find("```", start + len(word))
            script = content[(start + len(word)):end]

            try:
                exec(script, namespace)
                if namespace.get('output') is not None:
                    s = io.StringIO()
                    namespace['output'](s)
                    content = content[:start] + s.getvalue() + content[(end + len("```")):]
                elif namespace.get('pre_text') is not None:
                    pre_text = namespace['pre_text']
                    content = (content[:start] + "```\n" + str(pre_text).replace('```', "").strip() + "\n```" +
                               content[(end + len("```")):])
                elif namespace.get('text') is not None:
                    text = namespace['text']
                    content = content[:start] + text + content[(end + len("```")):]
            except Exception as e:
                print("execute script failed:")
                print(script)
                print(e.with_traceback(None))
        else:
            find_exec = False
    f.close()
    f = open(file, 'w')
    f.write(content)
    f.close()

`.c4builder` keeps getting updated with every change making it hard to check in to Git

I thought it would be a good idea to have .c4builder checked into version control. That way, other team members all work with the same configuration.

However, this means the file keeps getting updated with every change because of the checksums that get written to it. So everyone needs to remember to commit this file with every change in a different image.

Also checksums seem to vary between operating systems (to be confirmed). I have one anecdotal evidence of my colleague's Windows machine generating a different checksum compared to my Mac.

Can we move the checksums to a separate file that can be safely .gitignored and keep the .c4builder file easy to maintain in version control?

_sidebar.md gets 404 for any file not in the root of the distFolder

Root issue: _sidebar.md gets 404 for any file not in the root of the distFolder

Context:
We are following the source layout example provided in the readme and using the sidebar=true option. After building, the distFolder has a file called _sidebar.md. The top level index.html and Home.md file renders perfectly and work correctly. However for every page in any subfolders of the distFolder, they fail to find _sidebar.md because those subfolder do not have that file. Looking at the web debugger is that it seems to make requests for _sidebar.md once per level in the tree.. but no request from a page below the root of distFolder makes the request for the topmost.

Its possible that what I am hitting is really docsifyjs/docsify#1713 but wanted to call it out here too.

Outdated PlantUML version or broken C4-PlantUML?

I've noticed that on some C4-Build-based projects, the generated diagrams end up being along the lines of
image (cf. https://ac-architecture.netlify.app/#/) and even trying to change the config to have the generateLocalImages/embedDiagram``and such set differently as well as using https://raw.githubusercontent.com/adrianvlupu/C4-PlantUML/latest/C4_Context.puml` over https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml lead to failed images (which doesn't happen locally when using the PlantUML VSC extension).

default template creates "readme.md" and "README.MD"

installing the tool globally, as described in the documentation, and running

c4builder new

...accepting all defaults, creates 2 (!) readme files:

-rw-r--r-- 1 patrick patrick 3266 Jul 19 22:40 readme.md
-rw-r--r-- 1 patrick patrick 3281 Jul 19 22:40 README.MD

The readme files also have different content (see above file size).

Is this the intended behaviour from the template?

I was expecting "README.md" ;-)

OS: Arch linux
c4builder version: 0.2.16
node: v18.4.0

Ping me if I can help with more detailed infos

Update plantuml jar to the latest version

PUML json file to image conversion is failing in some cases with error message "your data doesn't sound like json data"
probably due to old plantuml jar version. Where as its working okay using vscode plugin and on plantuml site.

Cannot install without Java being installed

Recently when trying to install this I ran into an issue where I was unable to install. In the end, the culprit was that I needed to have Java installed and added to PATH. This is because one of the dependent libraries, node-plantuml requires java as a part of it's installation.

Could this be added to the list of dependencies or called out somewhere in the getting started to make it easier for people who are doing a fresh install? Or perhaps I missed something and there is a way to install without install Java. Thanks!

Feature Request: Support for Structurizr DSL

Now that there is a formal definition of Structurizr DSL exists, perhaps it is time to consider if C4Builder should support it.

I haven't read the Language reference line by line yet. I am sure it's possible to do this.

I am not sure if this is something the community would like? If you like this feature then why not leave a thumb up?

Fix markdown heading levels

Problem description

c4builder currently assumes that markdown files don't use h1 (#) and h2 (##) headers. For example:

image

If you don't know this, you might be tempted to start with a h1 heading, which is what you'd usually do. Then it looks like this:

image

This is probably not what you want. Even more obvious in case of generated markdown:

# test

* [Overview](#Overview)
* [src](#src)
  * [foo](#foo)

---

## Overview

# Top-level readme h1

top-level readme content

And here's the PDF view:

image

Thoughts

  • Most projects use a h1 heading with their project name in the top-level readme file. If that is present, there's no need to render the project name separately or define a HOMEPAGE_NAME. (Related to #9.)
  • To prevent forcing users to use only level 3+ headings, c4builder could alter heading levels in the build process.

Thoughts?

c4builder on centos 7

Hi,
Does c4builder is supported on centos server without GUI? If so what is the installation process. Thanks in advance.

Diagrams at arbitrary positions not working for more than one file

When there is more than one ![name](name.puml) in a .md file, build replacing all the file with the first one.

// test.md file

![name1](name1.puml) 
![name2](name2.puml) 

after running build all .puml references are replace with first .svg file,

//afterbuild.md file

![diagram](name1.svg)
![diagram](name1.svg)

expected

//afterbuild.md file

![diagram](name1.svg)
![diagram](name2.svg)

Provide option to include PlantUML diagrams at arbitrary positions in doc

At the moment the user is forced to either have all PlantUML images at the very top of a page, or at the very bottom (option diagramsOnTop).

But what if I want to be able to freely distribute the diagrams on the page? E.g. what if I want to have an introduction headline and paragraph, followed by diagram number 1, then some more text, then diagram number 2, etc.

Since I can simply include images myself using the syntax ![diagram](diagram.svg) the easiest solution would probably to have a CLI argument that disables the automatic inclusion of the converted puml files.

Allow configuration of the base URL for PlantUML Server

I would like to be able to have the speed of rapid page updates without the dependency on an outside server. It would be nice if that (like the VS Code extension), you could configure the plantUmlServerUrl to use a per-project configured value instead of the default plantuml.com host.

Sidebar is raw Markdown if source and dist are not in same folder

Title says it all really. Here is a specific example:

project/
├── doc/
│   ├── architecture/
│   │    └── model/
│   │        └── context.md
│   └── dist/
└── .c4builder

.c4builder

{
	"rootFolder": "doc/architecture/model",
	"distFolder": "doc/dist"
}

In this case, everything works normally and the dist is generated where it is expected the c4builder site command works as expected. But the sidebar is served raw as a plain-text Markdown without converting to HTML with links. The correct links are in the sidebar in Markdown and they update when adding new content.

I guess it doesn't look for the pages in the proper place and it cannot find the page and therefore the conversion fails.

graphviz was not found on the system

During installation (on MacOS) I am getting this message:
graphviz was not found on the system. Downloading vizjs instead. See http://plantuml.com/vizjs. This may take a few minutes.

This means it should work regardless of graphviz installed or not because vizjs is being installed. However, I am getting an error in the generated output site.

The graphviz requirement is not listed as a dependency. It would be useful to have this documented for new starters.

On Mac OS, it's simple homebrew command to install it:
brew install graphviz

Issue with parsing plantUml files

When i generate my .puml files from structurizr java-api I have got as example following imports on top of the file:

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

It will result in following error:

Screenshot 2564-07-11 at 23 15 28

On the other hand if I will replace those imports manually to be:

!include https://raw.githubusercontent.com/adrianvlupu/C4-PlantUML/latest/C4_Container.puml

Everything generates correctly. Is it possible @adrianvlupu your fork of C4-PlantUML is not up to date?

Building PlantUML files that contain relative includes results in broken output diagrams

Frequently I want to share common elements between multiple puml files or use my own local function/procedure library. Instead of copying the element into each file I just move that element into a shared file that both puml files include using a relative path.

For example I might have a shared library of puml in _shared.puml and include it in other puml files like this: !include _shared.puml

These relative paths work when using PlantUML preview IDE plugins or the plantuml JAR itself to create output image files.

When I build my project using C4-Builder the output diagrams contain an error message indicating it "cannot include _shared.puml".

If I switch to using an absolute path in the include it works however this is not an ideal solution when the C4 project is being worked on by multiple developers like ours are. We've been using a bit of a hack where the developers set their local project root directory in an environment variable and our puml files use that in their include statements.

The issue seems to be in the node-plantuml library used by C4-Builder. I tried using that library directly and I get the same error in output diagrams.

I was looking at how to fix this in node-plantuml and noticed that project hasn't been actively developed in a couple years but there is a more recent alternative called plantuml-pipe. That library does seem to handle relative includes properly in my testing so far. I haven't tried to change C4-Builder to use that library, I've just been using the library directly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.