Skip to content

Commit

Permalink
Improve prism.js highlighting
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
solonovamax committed Aug 14, 2024
1 parent 1a46f82 commit 43850ee
Show file tree
Hide file tree
Showing 303 changed files with 415 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public class FileWriter(
if (Files.isDirectory(file)) {
val dirPath = file.toAbsolutePath().toString()
withContext(Dispatchers.IO) {
Paths.get(root.path, rebase(dirPath)).toFile().mkdirsOrFail()
// Append a slash to fix an issue with removePrefix in the rebase function
// This causes useless directories to be created in some cases
Paths.get(root.path, rebase("$dirPath/")).toFile().mkdirsOrFail()
}
} else {
val filePath = file.toAbsolutePath().toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ public class ScriptsInstaller(private val dokkaContext: DokkaContext) : PageTran
"scripts/symbol-parameters-wrapper_deferred.js",
)

/**
* This directory is copied to the output, but is not included in the page
* header.
*/
private val copiedScriptDirectories = listOf(
"scripts/components/"
)

override fun invoke(input: RootPageNode): RootPageNode =
input.let { root ->
if (dokkaContext.configuration.delayTemplateSubstitution) root
else root.modified(children = input.children + scriptsPages.toRenderSpecificResourcePage())
if (dokkaContext.configuration.delayTemplateSubstitution)
root
else
root.modified(children = input.children + (scriptsPages + copiedScriptDirectories).toRenderSpecificResourcePage())
}.transformContentPagesTree {
it.modified(
embeddedResources = it.embeddedResources + scriptsPages
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 43850ee

Please sign in to comment.