Skip to content

Commit 43850ee

Browse files
committed
Improve prism.js highlighting
- plugin changes: - add `show-language` + `toolbar` plugins: Shows the language of the current codeblock. - add `autoloader`: Used to automatically load languages. - add `match-braces`: when hovering over a bracket, highlight the matching bracket. Added match-braces class to `base.ftl`. - add `diff-highlight`: highlight diff codeblocks in conjunction with other languages. - remove `css` and `javascript` languages from being loaded in the main prism.js file. - Add components directory with all additional `prism.js` supported languages. These are loaded on-demand by the `autoloader` plugin. - Add small transition to the copy code element to match the language toolbar element. (100ms linear transition from 0 -> 100% opacity) - Fix minor bug in FileWriter causing additional empty directories to be created when copying a folder with a trailing slash. - Make the diff highlighting look better Signed-off-by: solonovamax <[email protected]>
1 parent 1a46f82 commit 43850ee

File tree

303 files changed

+415
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+415
-19
lines changed

dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/FileWriter.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public class FileWriter(
8080
if (Files.isDirectory(file)) {
8181
val dirPath = file.toAbsolutePath().toString()
8282
withContext(Dispatchers.IO) {
83-
Paths.get(root.path, rebase(dirPath)).toFile().mkdirsOrFail()
83+
// Append a slash to fix an issue with removePrefix in the rebase function
84+
// This causes useless directories to be created in some cases
85+
Paths.get(root.path, rebase("$dirPath/")).toFile().mkdirsOrFail()
8486
}
8587
} else {
8688
val filePath = file.toAbsolutePath().toString()

dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/htmlPreprocessors.kt

+12-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,20 @@ public class ScriptsInstaller(private val dokkaContext: DokkaContext) : PageTran
7070
"scripts/symbol-parameters-wrapper_deferred.js",
7171
)
7272

73+
/**
74+
* This directory is copied to the output, but is not included in the page
75+
* header.
76+
*/
77+
private val copiedScriptDirectories = listOf(
78+
"scripts/components/"
79+
)
80+
7381
override fun invoke(input: RootPageNode): RootPageNode =
7482
input.let { root ->
75-
if (dokkaContext.configuration.delayTemplateSubstitution) root
76-
else root.modified(children = input.children + scriptsPages.toRenderSpecificResourcePage())
83+
if (dokkaContext.configuration.delayTemplateSubstitution)
84+
root
85+
else
86+
root.modified(children = input.children + (scriptsPages + copiedScriptDirectories).toRenderSpecificResourcePage())
7787
}.transformContentPagesTree {
7888
it.modified(
7989
embeddedResources = it.embeddedResources + scriptsPages

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-abap.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-abnf.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-actionscript.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-ada.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-agda.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-al.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/components/prism-antlr4.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)