Right click -> Open in Browser Follow
I have a request for the AsciiDoc plugin to add the 'open in browser' feature, but right now I'm not sure how to do that, and I'm not even sure if it's possible. Any hints?
Please sign in to leave a comment.
You can use the WebBrowserUrlProvider extension point to implement this.
Thanks! It's implemented now: https://twitter.com/epragt/status/633957430070747136
Update: Okay, I thought it was implemented, but it isn't. It works when I run the plugin (run plugin configuration, which starts my IntelliJ community edition), but when I release the plugin and install it, it doesn't work. The icon is displayed, but when I click on it, nothing happens. I'm sure I implemented it work, though I'm surprised it works in development mode.
You're opening the .adoc file in the browser directly. I would be surprised if this worked, because normally browsers don't support displaying asciiidoc files. Instead, you need to save the HTML generated from .adoc to a temporary file and open that file in the browser.
Thanks for the reply. I know I'm trying that, and that's exactly what I want: to display the raw contents of the .adoc file in the browser without the HTML transformation, because then the AsciiDoc plugin in Chrome will take over. However, it's not opened, and it doesn't explain the stacktrace.
So, basically, I just want IntelliJ to open this file: file:///Users/erikp/IdeaProjects/test/test.adoc, without using the interal web server. Tried that, but that failed (Chrome will download the file then, which is not what I want). Like I said above, it works in development mode, but not in the actual plugin.
Tried this too:
This requires your users to have the AsciiDoc plugin for Chrome installed, which not everyone has. (And some people use Safari, for which, as far as I know, it's not possible to open AsciiDoc files directly.)
All correct, and that's exactly the requirement from one of the AsciiDoc plugin users. Still this doesn't bring me closer to a solution :-)
I don't think you'd see this exception when opening a regular .html file rather than .adoc.
I'm not sure what you mean. I'm not even sure the exception is the problem. Can we focus on a solution? I'm confused why it works when I run IntelliJ CE as a plugin (even then I have the stacktrace), but when test the plugin, it doesn't.
I'm offering you a solution - always export the .adoc file to .html and open the .html. We know that opening .html files via this API works correctly. We also know that this will work for all users of the plugin, and not only those who have a browser extension for .adoc support installed. Is there any other reason why this solution isn't satisfactory for you?
Hi Dmitry, thanks for the feedback, but that's just not what I am looking for. I'm looking for a way to satisfy this requirement: https://github.com/asciidoctor/asciidoctor-intellij-plugin/issues/82, and rendering to HTML will just not give the same result due to a different way of rendering in the plugin. That's why it's not satisfactory for me. Well, actually, it's not my requirement, but I'd like to help out, and I just would like to understand why rendering the .adoc works when running the plugin, but not when the plugin is installed.