yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.89k stars 216 forks source link

Add the option to generate ASCII art from PlantUML diagrams #38

Closed akosma closed 4 years ago

akosma commented 4 years ago

PlantUML offers the option to generate ASCII art diagrams, passing the -txt parameter in the command line. Would it be possible to do the same in Kroki? For example it is a useful option to embed diagrams in man page output generated by Asciidoctor.

ggrossetie commented 4 years ago

Yes, I think we could use the Accept header:

Accept: text/plain

Or use the output format in the URL:

GET /plantuml/txt/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

What do you think?

akosma commented 4 years ago

Just the output format in the URL would be enough I think, and the other would be a nice bonus! Thanks

ggrossetie commented 4 years ago

PlantUML offers two text format:

$ http :8000/plantuml/utxt/eNrjciguSSwqKc3N4XLKT1LQtVNwzMlMTlWwUshIzcnJ53JIzUsBSQIABnMM1A==
HTTP/1.1 200 OK
cache-control: public, max-age=432000
content-length: 372
content-type: text/plain; charset=utf-8
date: 1576243016424
etag: 6p09ACFG7EfRkAXkCLWl8lk0m00
expires: 1576675016424
last-modified: 1567581178724

     ┌───┐          ┌─────┐
     │Bob│          │Alice│
     └─┬─┘          └──┬──┘
       │    hello      │   
       │──────────────>│   
     ┌─┴─┐          ┌──┴──┐
     │Bob│          │Alice│
     └───┘          └─────┘
$ http :8000/plantuml/txt/eNrjciguSSwqKc3N4XLKT1LQtVNwzMlMTlWwUshIzcnJ53JIzUsBSQIABnMM1A==
HTTP/1.1 200 OK
cache-control: public, max-age=432000
content-length: 224
content-type: text/plain
date: 1576243005713
etag: 6p09ACFG7EfRkAXkCLWl8lk0m00
expires: 1576675005713
last-modified: 1567581178724

     ,---.          ,-----.
     |Bob|          |Alice|
     `-+-'          `--+--'
       |    hello      |   
       |-------------->|   
     ,-+-.          ,--+--.
     |Bob|          |Alice|
     `---'          `-----'

I think in this case the Asciidoctor Kroki extension should use a literal block right?

akosma commented 4 years ago

Yes, absolutely! This is wonderful, thanks!

akosma commented 4 years ago

Thanks!