clickable render of HTML, AsciiDoc, Markdown inside a plugin? Follow
Answered
Hi
I wonder if we can use your plugin to view AsciiDoc in another plugin. I recently joined a company that created a plugin for IntelliJ to support our work. It would be great if we can have some kind of help, FAQ inside the plugin. Before I approach internal developers in our company asking for that I want to know that something like that is possible.
So what I want is that our plugin would be able to
- display information with links inside a panel (not sure if I use the right terminology) of IntelliJ
- end user of the plugin can browse through the links inside the panel - not a MUST feature
- the source code of the data being displayed is in GitHub, GitLab or somewhere like that
- the source code is written either in HTML, ASCIIDoc, Markdown and anything like that
I went through these post but did not find the answer. Markdown plugin might be of help but its reviews does not look good https://plugins.jetbrains.com/plugin/7793-markdown/reviews
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004450219-Tool-for-HTML-displaying
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206780695-HTML-rendering-component-
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206117419-HTML-inside-panels
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206546859-Rendering-HTML-page-for-a-plugin
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206795495-Alternative-Editors-ala-HTML-Preview
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206110919-Html-preview-tab-for-markdown
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000717690-Plans-for-supporting-HTML-JS-CSS-for-plugin-development-
I wonder if someone could help me
Thank you
Radek
Please sign in to leave a comment.
Hi Radek,
It seems that you need to create a panel that will display HTML. Depending on the file you want to display, you will need to render it to HTML (if it's not HTML). The requirement "the source code is written in HTML, ASCIIDoc, Markdown, and anything like that" seems too generic. I don't know any mechanism that will detect the language of any passed file and render it, and I doubt something like this exists. You need to set the exact requirements and implement all the supported cases.
Regarding displaying HTML, you can get some inspiration from the Markdown preview editor:
https://github.com/JetBrains/intellij-community/blob/master/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/MarkdownPreviewFileEditor.java#L237:L276
Regarding rendering Markdown HTML output, you can see how it is done here: https://github.com/JetBrains/intellij-community/blob/master/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/html/MarkdownUtil.kt#L32:L53
The AsciiDoc plugin is not maintained by JetBrains. I suggest contacting its authors to get the answer about what is possible to reuse.
Hi Karol
thank you for your reply.
Sorry for not being clear and precise... I meant the source of what needs to be displayed might be in any format to be either HTML, AsciiDoc, Markdown or whatever else. Just something that IntelliJ is capable of and gives good result.
I am here finding out if it is possible and hopefully get some idea how.
So from your answer I understood that it is possible to
one more question... could the data to be displayed be gotten from the internet? GitHub for example?
Thank you
Radek
Every language you mentioned has a dedicated preview implementation. There is no single mechanism covering all of them, so you will have to implement dedicated support for each. You can display results taken from any accessible source, including GitHub.
It sounds like it is not defined what should be exactly implemented, in what form, etc. I suggest planning the functionality in detail, checking the documentation, and trying to implement it based on the information provided in the docs and in my answers. If something is unclear then please ask on Slack or on this forum.