-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Generate a PDF "inside" the Asciidoctor IntelliJ plugin #325
Comments
Not yet, but it looks like a reasonable thing to add. I'll have a look. |
This feature is available in the pre-release 0.30.0 of this plugin. From the docs:
You'll find a new button to create a PDF in the action tool bar of the editor. You find an example with PDF styling I've tested in one of my demo repositories: https://github.com/ahus1/asciidoctor-deepdive/blob/master/manual/src/main/asciidoc/manual.adoc As usually I'm looking forward to feedback. As this feature is experimental, it might change its behavior according to user feedback. The new pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository. |
Hi @ahus1 , In "Event Log" I see two messages after click on "PDF" button:
Than I have searched for "Show Log in Explorer" and I have no such menutitem in help menu. Nor "find action" know it. I have clicked on "Show Log in Files" and it has taken me to some file-browser where I have opened log file. Its content is here:
I hope, this will help making this functionality work even for non-standard set-ups. Have on mind, that I have tried this on spring-docs project which require custom extension which you have improved a few weeks ago, #310. |
@luvarqpp - thanks for giving it a try. I triggered the build of another pre-release 0.30.1 that will prevent the exception you've seen above. I will continue to look into this and will update the ticket once it is ready for a test run with spring-rest-docs. |
@ahus1 thanks for fast fix. Feedback:
Thanks for great work. |
@luvarqpp - you don't need to install asciidoctor-pdf in order to create PDFs with the plugin. Everything is included in the plugin already. Support for .asciidoctorconfigVersion 0.30.2 is now available as a pre-release that adds support for .asciidoctorconfig files. This should also fix the remaining errors you received when copying the contents to the beginning of your file that resulted from asciidoctorconfigdir being not set (it is set automatically by the plugin for the context of each .asciidoctorconfig file). Download size/speed of the pluginThe AsciiDoc plugin for IntelliJ (this plugin) is quite "fat" as it includes a JRuby runtime to run Asciidoctor, plantuml plus dependencies for Diagrams, MathML for math formula rendering in the preview, fonts for the preview. Adding PDF support by adding asciidoctor-pdf increased the size of the plugin from 44 MB to 48 MB. I know this is only an explanation of how it is today, not a solution for you. You might want to build it locally, as it will download the "big" elements only once. For building it downloads a full IntelliJ plus runtime, so this pays off only after multiple builds. And it lacks a lot of convenience of update notifications and "official" builds. Therefore I don't recommend it. Weird Placement of PDFThe plugin doesn't know about Maven or Gradle project structures yet. I'd like to split this off to a different ticket once this is closed. Picking the "right" output folder (plus the right sub directory) might be an issue for a debate. Let's see where this issue ends up - before or after out-of-the-box spring-rest-docs support. |
@ahus1 Thanks for reply and all information. According to download size/speed of plugin, is there any possibility to solve it by not downloading same things more times? i.e.:
Sidenote, what about to add this project to list located here? https://github.com/JetBrains/gradle-intellij-plugin/blob/master/README.md#examples |
Thank you for sharing these ideas. Using plugins to depend on plugins would using a mechanism that wasn't designed to support the proper needs: AFAIK the mechanism doesn't supply versioning of dependencies, and the plugin might end up with a wrong version of JRuby. I know that some plugins download dependencies after they've been installed. Usually they do this for optional dependencies; in our case JRuby would be an essential dependency. Downloading dependencies after the installation usually gives rise to proxy issues. If you don't download them at the beginning, you might end up with a non-working feature with no access to the internet. Therefore I hesitate, it would make it more difficult for users to use the plugin. If someone wants give it a try, I'm happy to support. Any solution developed here shouldn't negatively affect ease-of-use. Using diff/patch is not built into the JetBrains plugin system. I could automate supplying binary diff files on the GitHub repo. But it will be for the user to apply them manually. I hesitate to list the project in the example list as I consider the other plugins on the list to using more functionality of the plugin already. Adding this plugin to the list wouldn't add value to the list, it would just make it longer. |
Ok, I see it from your point of view. I would probably try to ask directly Jetbrains for some solution if possible and if nothing can be done (to have good user experience like now), current state is fully acceptable. Thanks for reply with your opinion. |
Pre-Release 0.30.3 upgrades to asciidoctorj-pdf:1.5.0-beta.4. As the original scope of this ticket was to add PDF support, I consider this ticket closed. |
…PDF should use diagram in the format specified in the source (#325)
@gudaoxuri - looking at the tree view of your project I see that you've added some fonts and a theme to your project. It might be similar to (or parts of) https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic I assume that your maven build picks up the necessary fonts, while the IntelliJ configuration doesn't. Therefore Chinese characters don't appear in the PDF. The document you turned to a PDF seems to be one part of a bigger document, and I assume that this sub-section doesn't have pdf-stylesdir or pdf-style set. It might be set in the parent document or in the maven plugin configuration. Please give it a try by adding the necessary attributes to the file you are about to convert to a PDF. Once your configuration works for one file, you can take it one step further and add a .asciidoctorconfig-file to your project. This allows you apply common configurations for all AsciiDoc documents in a folder and its subfolders. While it works out-of-the-box for the preview with this plugin, you'll need to specify an include when you run it with maven (usually once in the parent document). I see that you have some GitHub repositories - is this issue about one of them? This would make it easier to support you if you could link it here. |
I tried to test successfully on a single asciidoc file, but the idea reported an error when the pdf was generated by the entire project (consisting of multiple asciidoc files) (see log attachment), while the document could generate the pdf normally through maven. |
The same problem occurs in another of my projects ( https://github.com/gudaoxuri/dew/blob/master/docs/src/main/asciidoc/book.adoc )where you can try to generate pdf on book.adoc |
It looking at the exception, it looks like an issue with prawn and syntax highlighting: I locked the trigger down to the quick-start.adoc file and reduced it to the following snippet that fails with the PDF generation in the IDE.
The project you referenced doesn't include a PDF generation, therefore I am not sure what versions you use to create a PDF. The IntelliJ plugin uses asciidoctorj-pdf:1.5.0-beta.4 together with the latest AsciiDoctorJ runtime. Please use the latest versions of asciidoctorj and asciidoctorj-pdf in your maven build. If you see the same problem there, please raise an issue with asciidoctor-pdf with a minimal example (usually not asciidoctorj-pdf, as this is just a re-packaging). Once you have a working Maven build with the latest versions and still have a failing IntelliJ plugin, please raise an issue with the plugin. |
PDF cannot be generated related to this code, but the Maven plug-in is OK (see below for version) |
how about jck(pdf)? idea plugin 0.30.18 |
Is it possible to generate a PDF directly from the Asciidoctor plugin? (Similar to AsciidocFX?).
Thank you.
The text was updated successfully, but these errors were encountered: