diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-09-20 14:42:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 14:42:28 +0200 |
commit | c63ec458e94c6236a0002333d852aaa838beaf1e (patch) | |
tree | de50b7f942f4bbb20ca0f97818e9fcfdaa7bf03c /plugins/base/src/main/kotlin/renderers/html | |
parent | e88a21e933ca7cb58898c924afe53e08130abfe9 (diff) | |
download | dokka-c63ec458e94c6236a0002333d852aaa838beaf1e.tar.gz dokka-c63ec458e94c6236a0002333d852aaa838beaf1e.tar.bz2 dokka-c63ec458e94c6236a0002333d852aaa838beaf1e.zip |
Update `prism.js` to match new webhelp highlight colors (#2670)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index cb7f58d2..dfc4e2e3 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -792,11 +792,18 @@ open class HtmlRenderer( TextStyle.Strong -> strong { body() } TextStyle.Var -> htmlVar { body() } TextStyle.Underlined -> underline { body() } - is TokenStyle -> span("token " + styleToApply.toString().toLowerCase()) { body() } + is TokenStyle -> span("token ${styleToApply.prismJsClass()}") { body() } else -> body() } } + private fun TokenStyle.prismJsClass(): String = when(this) { + // Prism.js parser adds Builtin token instead of Annotation + // for some reason, so we also add it for consistency and correct coloring + TokenStyle.Annotation -> "annotation builtin" + else -> this.toString().toLowerCase() + } + override fun render(root: RootPageNode) { shouldRenderSourceSetBubbles = shouldRenderSourceSetBubbles(root) super.render(root) |