sytsereitsma / mdbook-plantuml

mdBook preprocessor to render PlantUML diagrams to png images in the book output directory
MIT License
76 stars 14 forks source link

PlantUML not working in mdbook Windows 10 #43

Closed TeomanEgeSelcuk closed 1 year ago

TeomanEgeSelcuk commented 2 years ago

I cannot get to PlantUML diagrams to be downloaded into mdbook. I have locally downloaded the plantuml.jar but I get an error when trying to view the diagrams on local host. I have tried both the server and local run examples from the documentation and they both dont work. How would I be able to fix this?

OS: Windows 10 rustc 1.61.0 mdbook v0.4.18

Markdown File(The double quotes are single quotes in the .md file):

"""plantuml
@startuml
A --|> B
@enduml
"""

Local host Error:

PlantUML rendering error: Failed to render inline diagram (Failed to generate PlantUML diagrams, PlantUML exited with code 1 ('http:' is not recognized as an internal or external command, operable program or batch file. ).).

output.txt error:

INFO - --- Started preprocessor ---
DEBUG - Executing 'http://localhost:8080/plantuml -tsvg -nometadata C:\Users\Edge\AppData\Local\Temp\.tmpLUxd9o\52f99f31629134fdf4abb29a051f80dd14f49e00.puml'
DEBUG - Working dir 'C:\Users\Edge\Desktop\Backtesting Bot Docs'
ERROR - Failed to generate PlantUML diagram.

Contents of book.toml:

[book]
authors = ["Teoman Selcuk"]
language = "en"
multilingual = false
src = "src"
title = "Backtesting Bot Docs"
[output.html]
mathjax-support = true
additional-js = ["mermaid.min.js", "mermaid-init.js"]

[preprocessor]

[preprocessor.mermaid]
command = "mdbook-mermaid"

[output.html.fold]
enable = true    # whether or not to enable section folding
level = 1        # the depth to start folding

[preprocessor.plantuml]
plantuml-cmd="plantuml.exe"
command = "mdbook-plantuml -l"

Directory Tree:

Backtesting Bot Docs/
├─.gitignore
├─book/
├─book.toml
├─mermaid-init.js
├─mermaid.min.js
├─output.log
├─plantuml.jar
├─src/
└─theme/ 
sytsereitsma commented 2 years ago

Code blocks use backticks `, not single quotes '. Can you check your markdown?

See https://spec.commonmark.org/0.30/#fenced-code-blocks

Sorry about that. I see now that the plantuml exe command returns "http:' is not recognized as an internal or external command, operable program or batch file". Is your executable really an executable?

TeomanEgeSelcuk commented 2 years ago

Sorry I failed to respond for a while. Could you clarify what you mean by when you say Is your executable really an executable?

sytsereitsma commented 2 years ago

I noticed the line 'http:' is not recognized as an internal or external command, operable program or batch file in your logs, while your toml says you're using the shell version of plantuml. Looking further I see in the log the plantuml http server is called: Executing 'http://localhost:8080/plantuml.... So your book.toml and output do not add up.

The 'http:' is not recognized error only occurs when you have the --no-default-features build of mdbook, which excludes plantuml server support. Rebuild/reinstall mdbook-plantuml with server support if you want to use the server: Build from source: cargo build --release --no-default-features --features plantuml-server Install with cargo: cargo install --no-default-features --features plantuml-server mdbook-plantuml

In the mean time I'll make sure to output an error with the above description when someone tries to run the plugin without server support while selecting the plantuml server as engine.

sytsereitsma commented 1 year ago

Fixed with #52