-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from InkApplications/codeblocks
Add Code highlighting
- Loading branch information
Showing
11 changed files
with
288 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
render-static-html/src/main/java/ink/ui/render/statichtml/renderer/CodeBlockRenderer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ink.ui.render.statichtml.renderer | ||
|
||
import ink.ui.render.web.elements.CodeBlock | ||
import ink.ui.render.web.elements.CodeBlock.Language.* | ||
import kotlinx.html.* | ||
|
||
val CodeBlockRenderer = renderer<CodeBlock> { element -> | ||
pre(when (element.language) { | ||
Bash -> "bash" | ||
Kotlin -> "kotlin" | ||
Shell -> "shell" | ||
null -> null | ||
}) { | ||
code { | ||
+element.code | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
render-web-common/src/commonMain/composeResources/css/atom-one-dark.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
Atom One Dark by Daniel Gamage | ||
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax | ||
base: #282c34 | ||
mono-1: #abb2bf | ||
mono-2: #818896 | ||
mono-3: #5c6370 | ||
hue-1: #56b6c2 | ||
hue-2: #61aeee | ||
hue-3: #c678dd | ||
hue-4: #98c379 | ||
hue-5: #e06c75 | ||
hue-5-2: #be5046 | ||
hue-6: #d19a66 | ||
hue-6-2: #e6c07b | ||
*/ | ||
|
||
.hljs { | ||
display: block; | ||
overflow-x: auto; | ||
padding: 0.5em; | ||
color: #abb2bf; | ||
background: #282c34; | ||
} | ||
|
||
.hljs-comment, | ||
.hljs-quote { | ||
color: #5c6370; | ||
font-style: italic; | ||
} | ||
|
||
.hljs-doctag, | ||
.hljs-keyword, | ||
.hljs-formula { | ||
color: #c678dd; | ||
} | ||
|
||
.hljs-section, | ||
.hljs-name, | ||
.hljs-selector-tag, | ||
.hljs-deletion, | ||
.hljs-subst { | ||
color: #e06c75; | ||
} | ||
|
||
.hljs-literal { | ||
color: #56b6c2; | ||
} | ||
|
||
.hljs-string, | ||
.hljs-regexp, | ||
.hljs-addition, | ||
.hljs-attribute, | ||
.hljs-meta-string { | ||
color: #98c379; | ||
} | ||
|
||
.hljs-built_in, | ||
.hljs-class .hljs-title { | ||
color: #e6c07b; | ||
} | ||
|
||
.hljs-attr, | ||
.hljs-variable, | ||
.hljs-template-variable, | ||
.hljs-type, | ||
.hljs-selector-class, | ||
.hljs-selector-attr, | ||
.hljs-selector-pseudo, | ||
.hljs-number { | ||
color: #d19a66; | ||
} | ||
|
||
.hljs-symbol, | ||
.hljs-bullet, | ||
.hljs-link, | ||
.hljs-meta, | ||
.hljs-selector-id, | ||
.hljs-title { | ||
color: #61aeee; | ||
} | ||
|
||
.hljs-emphasis { | ||
font-style: italic; | ||
} | ||
|
||
.hljs-strong { | ||
font-weight: bold; | ||
} | ||
|
||
.hljs-link { | ||
text-decoration: underline; | ||
} |
96 changes: 96 additions & 0 deletions
96
render-web-common/src/commonMain/composeResources/css/atom-one-light.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
Atom One Light by Daniel Gamage | ||
Original One Light Syntax theme from https://github.com/atom/one-light-syntax | ||
base: #fafafa | ||
mono-1: #383a42 | ||
mono-2: #686b77 | ||
mono-3: #a0a1a7 | ||
hue-1: #0184bb | ||
hue-2: #4078f2 | ||
hue-3: #a626a4 | ||
hue-4: #50a14f | ||
hue-5: #e45649 | ||
hue-5-2: #c91243 | ||
hue-6: #986801 | ||
hue-6-2: #c18401 | ||
*/ | ||
|
||
.hljs { | ||
display: block; | ||
overflow-x: auto; | ||
padding: 0.5em; | ||
color: #383a42; | ||
background: #fafafa; | ||
} | ||
|
||
.hljs-comment, | ||
.hljs-quote { | ||
color: #a0a1a7; | ||
font-style: italic; | ||
} | ||
|
||
.hljs-doctag, | ||
.hljs-keyword, | ||
.hljs-formula { | ||
color: #a626a4; | ||
} | ||
|
||
.hljs-section, | ||
.hljs-name, | ||
.hljs-selector-tag, | ||
.hljs-deletion, | ||
.hljs-subst { | ||
color: #e45649; | ||
} | ||
|
||
.hljs-literal { | ||
color: #0184bb; | ||
} | ||
|
||
.hljs-string, | ||
.hljs-regexp, | ||
.hljs-addition, | ||
.hljs-attribute, | ||
.hljs-meta-string { | ||
color: #50a14f; | ||
} | ||
|
||
.hljs-built_in, | ||
.hljs-class .hljs-title { | ||
color: #c18401; | ||
} | ||
|
||
.hljs-attr, | ||
.hljs-variable, | ||
.hljs-template-variable, | ||
.hljs-type, | ||
.hljs-selector-class, | ||
.hljs-selector-attr, | ||
.hljs-selector-pseudo, | ||
.hljs-number { | ||
color: #986801; | ||
} | ||
|
||
.hljs-symbol, | ||
.hljs-bullet, | ||
.hljs-link, | ||
.hljs-meta, | ||
.hljs-selector-id, | ||
.hljs-title { | ||
color: #4078f2; | ||
} | ||
|
||
.hljs-emphasis { | ||
font-style: italic; | ||
} | ||
|
||
.hljs-strong { | ||
font-weight: bold; | ||
} | ||
|
||
.hljs-link { | ||
text-decoration: underline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,7 @@ ul > li::before | |
pre | ||
{ | ||
text-align: start; | ||
width: 100%; | ||
} | ||
hr | ||
{ | ||
|
Oops, something went wrong.