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

support barcode extension #1327

Closed
AlexCzar opened this issue Apr 11, 2023 · 5 comments
Closed

support barcode extension #1327

AlexCzar opened this issue Apr 11, 2023 · 5 comments

Comments

@AlexCzar
Copy link

AlexCzar commented Apr 11, 2023

Why the new feature should be added

This is a part of asciidoctor-diagram, which is already supported.
https://docs.asciidoctor.org/diagram-extension/latest/#barcode
The extension (namely the qrcode macros) could be used for documentation which talks about mobile resources or relevant to mobile apps.
It is also useful to render things like barcodes for printing labels.
I imagine there are other uses as well.

How the new feature should work

When there is a barcode extension block or macro in the document, it should be rendered, same way diagrams are rendered.
example:

Scan this with your phone: qrcode::https://my-link.tld/something[]

Currently document rendering/preview in IntelliJ just crashes with the following error:

unable to render AsciiDoc document

org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.LoadError: (LoadError)
You are using functionality that requires the optional gem dependency `barby` which could not be
loaded. Add `gem 'barby', '~> 0.6.8'` to your Gemfile.

At the very least, if supporting it is impossible or too hard, the rendering/preview in the IDE should not crash, which would enable at least external generation/rendering while allowing to edit comfortably in the IDE.

@ahus1
Copy link
Contributor

ahus1 commented Apr 15, 2023

Hi @AlexCzar - thanks for raising this here. The AsciiDoc plugin uses the upstream project asciidoctorj-diagram, which bundles the Ruby gems needed of asciidoctor-diagram for consuming them with Java.

I've raised issue asciidoctor/asciidoctorj-diagram#34 with the upstream project. Once there is an update, I can update the AsciiDoc plugin for IntelliJ.

@ahus1
Copy link
Contributor

ahus1 commented Jun 11, 2023

The next version of this plugin will support diagrams in AsciIDoc contents thanks to the changes in the asciidoctorj-diagram dependency.

There are two known issues that I found when testing this today:

I suppose none of them should be a blocker.

Given your example above, I see that there are two colons (::) after the macro name (qrcode). Two colons are use only for block macros. When using a macro as part of a paragraph, use an inline macro with only one colon (:). Otherwise the second colon will be treated part of the code and your hyperlink will start with a colon (:https://my-link.tld/something).

So use for an inline macro:

Scan this with your phone: qrcode:https://my-link.tld/something[]

Or for a block macro:

Scan this with your phone: 

qrcode::https://my-link.tld/something[]

I'll update this issue once the next preview-version of this AsciiDoc plugin for IntelliJ is available.

@ahus1
Copy link
Contributor

ahus1 commented Jun 11, 2023

There's now pre-release 0.38.19 which includes this change. I'd did a local test and it look ok to me. I'd be happy if you could take a look as well and comment here with your findings.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

@ahus1 ahus1 self-assigned this Jun 11, 2023
@NLH-Software
Copy link

Without being the reporter, just installed the pre-release, and it works perfectly for me with my barcodes now. Before I always had to comment them to get a preview. Looking forward to find this in the released version.

@ahus1
Copy link
Contributor

ahus1 commented Aug 18, 2023

Thank you for installing the pre-release. I published Release 0.38.20 on Jun 27, 2023 on the JetBrains marketplace, so the functionality should be available for everyone since that date once they use the plugin update functionality in IntelliJ.

Thanks for testing this change. As it works for you, I'm closing this issue.

@ahus1 ahus1 closed this as completed Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants