Markdown text rendering in a plugin

Answered

I have a custom tool window showing plain text. However, the text is being taken from .md file and I want to render it in the window as the markdown plugin itself does it. Can someone please outline the steps towards integrating the plugin functionality into my own so that I could render it accordingly? I examined the source code, but it left me clueless.

Thank you for any help!

0
10 comments

See com.intellij.ui.javafx.JavaFxHtmlPanel, for HTML generation see org.intellij.plugins.markdown.ui.preview.MarkdownUtil#generateMarkdownHtml which could be simplified if you dont' use code fences

1
Avatar
Permanently deleted user

Thank you, Yann! Can you please tell me why I can't access the method in MarkdownUtil? Do I need to specify some special configs?

0

Please make sure you follow steps to add Markdown plugin (ID: org.intellij.plugins.markdown) itself as dependency to yours: http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html

0
Avatar
Permanently deleted user

I already tried following the guide some time ago (using Gradle) and it keeps complaining with 

Cannot find builtin plugin org.intellij.markdown for IDE: C:\Users\..\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIC\2019.1.2\7999543c914a11e4d9b4039ed77338c4f36a86dd\ideaIC-2019.1.2

What might be an issue?

0

In case of using IntelliJ Ultimate:

intellij {
version 'IU-2019.1.2'
plugins 'markdown'
}

The syntax for builtin plugins is to use directory name ('markdown'), not ID of plugin - see https://github.com/JetBrains/gradle-intellij-plugin/#configuration

 

 

0
Avatar
Permanently deleted user

Thanks for the reference, but I still somehow fail to get it to work. I have another plugin working in this manner, but markdown is highlighted as red in plugin.xml. Fetching 'markdown' by name still yields the same exception as above.

My definitions are following:

intellij {
version '2019.1.2'
plugins 'git4idea', 'markdown'
}
<depends>Git4Idea</depends>
0

In plugin.xml "<depends"> tag, ID must be used.

0
Avatar
Permanently deleted user

Let me describe the problem in a little more detail. Integrating builtin plugin by the directory name still throws the following exception: 

Cannot find builtin plugin org.intellij.markdown for IDE: C:\Users\..\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIC\2019.1.2\7999543c914a11e4d9b4039ed77338c4f36a86dd\ideaIC-2019.1.2

Therefore <depends> can't include the dependency. I tried both name and id. I can't figure out what's wrong.

0

Sorry, indeed my previous answer wrongly implied targeting Ultimate Edition where Markdown plugin is bundled.

When using Community Edition, the correct definition is:

intellij {
version '2019.1.2'
plugins 'org.intellij.plugins.markdown:191.7141.32'
}

0
Avatar
Permanently deleted user

Thanks a lot, Yann! It finally works.

0

Please sign in to leave a comment.