Closed pomdtr closed 2 years ago
That sounds like a great idea. I hadn't thought of that.
Would you be able to submit a pull request to implement it?
There are so many diagram types, with more on the way, that maintaining a hard-coded list is not sustainable. What I would prefer is to make this an option. When this option is set, the converter will look for diagrams with those names and convert them to a block style in AsciiDoc. Better yet, the option can be a map so that the name in Markdown can be different than the name in AsciiDoc.
I propose the name of the option to be diagram_types
. It would look like this:
diagram_types: { 'puml' => 'plantuml', 'mermaid' => 'mermaid' }
Anything not listed would be ignored. We can map this to the CLI option --diagram-types
and it can have the form like: puml=plantuml,mermaid
. Here we can use a shorthand if the name is the same in both cases.
After giving this further thought, I'd like to use the option name diagram_languages
instead of diagram_types
. The focus is really on the language. Each language can support many diagram types. What we are doing is stealing languages away from becoming code blocks and turning them into diagram blocks. So the terminology fits better this way.
I propose supporting two languages by default, plantuml and mermaid. These languages can be overridden using the :diagram_languages
API option or --diagram-languages
CLI option. I think we should keep it simple to start and make these single values. If necessary, we can add name mapping in the future.
I use kramdoc as a converter to be able to transform markdown to pdf (Asciidoc is awesome, but our documentation generator only support markdown).
My current script looks like this:
I would love to be able to also generate diagrams during the process, using asciidoctor-diagram.
Howerver, if i write in my markdown file :
```plantuml @startuml Alice --> Bob: Hello @enduml ```
It will be converted to
when this output would be more useful.