asciidoctor-intellij-plugin icon indicating copy to clipboard operation
asciidoctor-intellij-plugin copied to clipboard

Support for charts in Asciidoc plug-in.

Open wfouche opened this issue 6 years ago • 5 comments

Enhancement Idea

This is more a question, than a bug report. I'd like to create charts in Asciidoc in IntelliJ. With the Asciidoc extension in Chrome the following chart syntax is supported:

....
January,February,March
28,48,40
65,59,80
....

image

How can charts be created in Asciidoc (IntelliJ)?

Maintainer notes (by @ahus1)

Good First Issue

This issue is labeled "good first issue", and maintainers are willing to help. Please comment in this ticket to exchange ideas how this could be implemented. Feel free to pair up with a maintainer to help when you don't know where to start if when you're stuck.

Find out more about how to contribute at "Contribute as a coder" in the Contributor's guide.

Implementation Idea

  1. There is an Asciidoctor chart extension, that could be bundled.

  2. The current build script build.gradle needs to be enhanced to download the Ruby gem as part of the build process

  3. In AsciiDoc.initWithExtensions load the extension

wfouche avatar Nov 14 '19 07:11 wfouche

An initiative to support charts in Asciidoctor is discussed here:

  • https://discuss.asciidoctor.org/How-to-include-bar-chart-td6030.html

  • https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/76

wfouche avatar Nov 14 '19 08:11 wfouche

Is your example missing a block macro name [chart] just before the "...."?

You can load an Asciidoctor ruby extension like we describe here: https://github.com/asciidoctor/asciidoctor-intellij-plugin/wiki/Support-for-Asciidoctor-Extensions

Does this work for you?

ahus1 avatar Nov 14 '19 08:11 ahus1

Yes, my example was missing the chart specification line. It should have read:

[chart,line]
....
January,February,March
28,48,40
65,59,80
....

I'll try the proposed workaround, and will report back. It would nice though to have chart functionality supported out-of-the-box .... but the Asciidoc plug-in already includes so much valuable functionality that it is a small missing feature. I use Asciidoc in IntelliJ daily, and it is a joy to use!

wfouche avatar Nov 14 '19 09:11 wfouche

@Mogztter - I see that the Asciidoctor browser extension includes some bundled extensions. What were your criteria to include an extension? AsciidoctorFX as an editor has also lots of extensions.

I fear that users see that something works in one editor and not in another. Once they use the command line none of them works as the would need to add he extension on the command line.

I'd love to hear your thoughts. Thanks.

ahus1 avatar Nov 16 '19 11:11 ahus1

I see that the Asciidoctor browser extension includes some bundled extensions.

The main issue is that a browser extension is a restricted environment. As far as I know it's not possible to register arbitrary extensions. That's why I chose to bundle a few extensions.

What were your criteria to include an extension? AsciidoctorFX as an editor has also lots of extensions.

To be honest, I don't really have strict criteria. I chose to bundle "popular" extensions that can be useful to the majority of the users (but in the end that's quite arbitrary). In my opinion, charts and diagrams are popular and everyone ❤️ emoji right?

I fear that users see that something works in one editor and not in another. Once they use the command line none of them works as the would need to add he extension on the command line.

True. And since the syntax is consistent with other "built-in" features, it's understandable to assume that this syntax will work everywhere.

It would nice though to have chart functionality supported out-of-the-box

Thought decision! I think that the support for Asciidoctor extensions in IntelliJ is great because if .asciidoctor/lib is versioned, it will work for everyone working on this repository.

The chart extension should probably be moved to a dedicated repository with a Ruby and a JavaScript implementation.

ggrossetie avatar Nov 16 '19 11:11 ggrossetie