diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt index 0a3183fdc..bd566a9f2 100644 --- a/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt +++ b/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt @@ -67,6 +67,14 @@ internal class MainPageGenerator( private fun HtmlBlockTag.renderPackages() { if (packagesData.isEmpty()) return + val sortedPackages = + packagesData.sortedWith { pkg1, pkg2 -> + when { + pkg1.ref.pkg == "pkl" -> -1 // always sort the stdlib first + else -> pkg1.ref.pkg.compareTo(pkg2.ref.pkg) + } + } + div { classes = setOf("member-group") @@ -79,7 +87,7 @@ internal class MainPageGenerator( } ul { - for (pkg in packagesData) { + for (pkg in sortedPackages) { val packageScope = pageScope.packageScopes[pkg.ref.pkg] // create scope for previously generated package