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

Detect diagram type #76

Closed
pomdtr opened this issue Dec 21, 2019 · 3 comments
Closed

Detect diagram type #76

pomdtr opened this issue Dec 21, 2019 · 3 comments
Assignees
Milestone

Comments

@pomdtr
Copy link

pomdtr commented Dec 21, 2019

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:

#!/usr/bin/env sh
#This scripts require the installation of the ruby gems asciidoctor, asciidoctor-pdf, kramdoc and rouge

kramdoc "$1" -o - | asciidoctor-pdf -a "source-highlighter=rouge" -r rouge -o "${1%.*}.pdf" -

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

[source, plantuml]
----
@startuml
Alice --> Bob: Hello
@enduml
----

when this output would be more useful.

[plantuml]
----
@startuml
Alice --> Bob: Hello
@enduml
----
@mojavelinux
Copy link
Member

That sounds like a great idea. I hadn't thought of that.

Would you be able to submit a pull request to implement it?

@mojavelinux
Copy link
Member

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.

@mojavelinux
Copy link
Member

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.

@mojavelinux mojavelinux self-assigned this Jul 3, 2022
@mojavelinux mojavelinux added this to the v2.1.x milestone Jul 3, 2022
mojavelinux added a commit to mojavelinux/kramdown-asciidoc that referenced this issue Jul 3, 2022
…onvert matching fenced code blocks to diagram literal blocks
mojavelinux added a commit to mojavelinux/kramdown-asciidoc that referenced this issue Jul 3, 2022
…onvert matching fenced code blocks to diagram literal blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants