Plugins
https://github.com/JetBrains/intellij-platform-plugin-template
Create a new IntelliJ plugin project with the following dependencies:
com.intellij.modules.platform org.jetbrains.annotations com.intellij.openapi.application com.intellij.openapi.editor com.intellij.openapi.fileEditor com.intellij.openapi.project com.intellij.openapi.util com.intellij.openapi.actionSystem In the plugin.xml file of your project, define a new action that will generate the table of contents:
Create a new Java class called GenerateMarkdownTocAction that extends com.intellij.openapi.actionSystem.AnAction and implements the actionPerformed method:
Build and install the plugin in IntelliJ IDEA.
Open a Markdown file in the editor and right-click to display the context menu. Click "Generate Table of Contents" to generate a table of contents based on the headers in the file.
Add the intellij plugin to your build.gradle file:
plugins { id 'java' id 'org.jetbrains.intellij' version '0.7.2' }
Configure the intellij plugin to specify the IntelliJ version and the location of the plugin descriptor file:
intellij { version '2021.3.1' pluginName 'MyPlugin' pluginDescription 'My awesome IntelliJ plugin' pluginVersion '1.0.0' pluginVendor 'My Company' pluginUrl 'https://mycompany.com/myplugin' ideaIC { plugins = [ 'com.intellij.modules.platform' ] } testIdea { plugins = [ 'com.intellij.modules.platform' ] } descriptor { displayName 'My Plugin' id 'com.mycompany.myplugin' version pluginVersion changeNotes """ Initial release """ } }
Add your plugin's source code to the src/main directory.
Build the plugin using the buildPlugin task:
./gradlew buildPlugin
The resulting plugin ZIP file will be located in the build/distributions directory.
Install the plugin in IntelliJ IDEA by going to File -> Settings -> Plugins -> Install Plugin from Disk and selecting the plugin ZIP file.
the plugin.xml file is created in the src/main/resources/META-INF directory.
Last updated