puml-for-markdown
puml-for-markdown copied to clipboard
Does not work, does not report errors
Following the README, the program does not seem to work for me. Maybe there is something I missed in the setup?
Here are steps to reproduce:
$ npm init --yes && npm i puml-for-markdown && npm ls puml-for-markdown
...
[email protected] /puml-for-markdown-test
└── [email protected]
$ printf "@startuml\ntitle root\n@enduml\n" > diagram.plantuml
$ printf "# TEST\n<!--[test](./diagram.plantuml)-->\n" > README.md
$ cat README.md
# TEST
<!--[test](./diagram.plantuml)-->
$ npx puml-for-markdown
Processing md file at /tmp/puml-for-markdown-test/node_modules/balanced-match/LICENSE.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/balanced-match/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/bent/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/bluebird/changelog.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/bluebird/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/brace-expansion/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/bytesish/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/caseless/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/commander/Readme.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/fs.realpath/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/gitignore-globs/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/glob/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/inflight/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/inherits/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/is-stream/readme.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/lodash/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/lodash/release.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/minimatch/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/once/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/path-is-absolute/readme.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/plantuml-encoder/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/puml-for-markdown/CONTRIBUTING.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/puml-for-markdown/LICENSE.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/puml-for-markdown/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/tinyurl/README.md
Processing md file at /tmp/puml-for-markdown-test/node_modules/wrappy/README.md
Processing md file at /tmp/puml-for-markdown-test/README.md
$ cat README.md
# TEST
<!--[test](./diagram.plantuml)-->
$ node -v
v18.12.0
$ uname -a
Linux latitude 5.15.94-1-MANJARO #1 SMP PREEMPT Tue Feb 14 19:45:58 UTC 2023 x86_64 GNU/Linux
Expected: Updates the readme or prints error message.
Add -d like:
puml-for-markdown -s http://localhost:8089 -i ./.md.gitignore -d --image-formats both --turn-off-link-shortening
or like: https://github.com/danielyaa5/puml-for-markdown/blob/main/.husky/pre-commit
I see, so generating images is a mandatory step then and puml-for-markdown does not work without it?
Sorry I assumed from the docs's Advanced Usage:
that it is optional.
Adding the -d still does not add the links into the readme, but it does provide output with bunch of warnings :tada:
There are now some images in dist_puml but not the ones from the README. Not sure if only -d makes it work; your example include even a custom server which I don't have.
Using the additional parameters you mentioned (without the custom server as I explained), the program ends on what seems like an unhandled HTTP request. See npx puml-for-markdown -d --image-formats both --turn-off-link-shortening
Can you tell me which combination of parameters should I use to get the simple diagram in the provided MWE, if I don't have a custom PlantUML server?
Anyone is welcome to try an alternative until this is resolved: https://github.com/grissius/plantaznik. I've written it without notion of this project and wanted to compare the two, but I did not manage to do a simple hello-world example.
There are now some images in dist_puml but not the ones from the README.
I understand it doesn't work with inline blocks:
```puml ... ```
U should define link to XXX.puml in XXX.md and this link should be replaced.
P.S. Try to create a demo repository or debug it, there is a simple js file, in general, you can figure it out in 15 minutes.
About PlantUML server.
// docker-compose.yml
version: '3'
services:
plantuml-server:
build:
context: .
dockerfile: Dockerfile
ports:
- 8089:8080
// Dockerfile
FROM plantuml/plantuml-server:tomcat
EXPOSE 8080
First, you need to install Docker Compose.
docker-compose up -d && docker-compose logs -f
If zsh: command not found: docker-compose and u have docker installed - just run docker and retry.
Go to http://localhost:8089 to access it.
VSCode jebbs.plantuml plugin
Setup in .vscode/workspace.code-workspace
{
"settings": {
// plantuml-server
"plantuml.render": "PlantUMLServer",
"plantuml.server": "http://localhost:8089"
}
}
Curl
Use localhost:8089/<lang> to compile. See plantuml-server/pull.
curl -s -X POST --data-binary @mydb.plantuml -H "Content-Type:text/plain" localhost:8089/png > mydb.png
Path @mydb.plantuml same as ./mydb.plantuml.
AppSec
Disallow include
I understand it doesn't work with inline blocks:
But I don't use the inline blocks in the provided MWE, do I?
U should define link to XXX.puml in XXX.md and this link should be replaced.
Exactly what I did in the MWE, links were not replaced, however.
So based on your answer I assume I do need local PlantUML server? I can run it ofc, but I don't want to for every update of the readme, that was my point. The public one should be usable.
P.S. Try to create a demo repository or debug it, there is a simple js file, in general, you can figure it out in 15 minutes.
I guess this answers my question on the ease of use, if I should debug the primary basic functionality. Thanks for the help @NikitaIT , I am sorry we are not able to make the tool work with the public PlantUML server, with literally a single markdown and PlantUML file.