Skip to content

Commit ef3ad8f

Browse files
authored
Convert markdown to html for changelog (#8393)
This is annoying - the plugin view in IJ settings doesn't show markdown text properly, only HTML (otoh, the jetbrains web site shows markdown from the changelog properly). So we have to convert the markdown to HTML ourselves. Perhaps I can file this as a feature request for jetbrains, since I'm pretty sure having a CHANGELOG.md file is recommended for plugins.
1 parent 2abf854 commit ef3ad8f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

build.gradle.kts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
1515
import java.io.File
1616
import java.time.LocalDate
1717
import java.time.format.DateTimeFormatter
18+
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
19+
import org.intellij.markdown.html.HtmlGenerator
20+
import org.intellij.markdown.parser.MarkdownParser
21+
22+
buildscript {
23+
repositories {
24+
mavenCentral()
25+
}
26+
dependencies {
27+
classpath("org.jetbrains:markdown:0.7.1")
28+
}
29+
}
1830

1931
// Specify UTF-8 for all compilations so we avoid Windows-1252.
2032
allprojects {
@@ -163,7 +175,13 @@ intellijPlatform {
163175
untilBuild = untilBuildInput
164176
}
165177
changeNotes = provider {
166-
file("CHANGELOG.md").readText(Charsets.UTF_8)
178+
// This is gemini-provided code to turn the changelog into HTML. Without it, the changelog will display properly on the jetbrains
179+
// site, but not in the Plugins settings view.
180+
val flavour = GFMFlavourDescriptor()
181+
val parser = MarkdownParser(flavour)
182+
val markdownText = file("CHANGELOG.md").readText(Charsets.UTF_8)
183+
val parsedTree = parser.buildMarkdownTreeFromString(markdownText)
184+
HtmlGenerator(markdownText, parsedTree, flavour).generateHtml()
167185
}
168186
}
169187

0 commit comments

Comments
 (0)