Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work, does not report errors #9

Open
smolijar opened this issue Mar 17, 2023 · 5 comments
Open

Does not work, does not report errors #9

smolijar opened this issue Mar 17, 2023 · 5 comments

Comments

@smolijar
Copy link

smolijar commented Mar 17, 2023

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
...
puml-for-markdown-test@1.0.0 /puml-for-markdown-test
└── puml-for-markdown@1.2.1
$ 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.

@NikitaIT
Copy link

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

@smolijar
Copy link
Author

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:

You can specify the CLI to output the diagram images as png and/or svg see --output-images and --image-formats

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 🎉

See npx puml-for-markdown -d

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?

@smolijar
Copy link
Author

smolijar commented Apr 3, 2023

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.

@NikitaIT
Copy link

NikitaIT commented Apr 12, 2023

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

@smolijar
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants