8000 Merge branch 'feature/code-example' of https://github.com/SnipMeDev/H… · SnipMeDev/Highlights@cc87b79 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc87b79

Browse files
committed
Merge branch 'feature/code-example' of https://github.com/SnipMeDev/Highlights into feature/code-example
2 parents 74213b8 + 60bae19 commit cc87b79

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,44 @@
33
# Highlights
44
Kotlin Multiplatform syntax highlighting engine
55

6+
## Installation
7+
```sh
8+
implementation("dev.snipme:highlights:0.3.1-SNAPSHOT")
9+
```
10+
11+
## Usage
12+
13+
To start, simply put any code snippet in the default builder
14+
15+
```kotlin
16+
Highlights.default().apply {
17+
setCode("public class ExampleClass {}")
18+
// Keywords = [public, class], Marks = [{, }]
19+
getCodeStructure()
20+
// BoldHighlight, ColorHighlight
21+
getHighlights()
22+
}
23+
```
24+
25+
You can also set language, theme and phrase emphasis.
26+
Language and theme has impact on the ColorHighlight and emphasis is represented by the BoldHighlight.
27+
28+
```kotlin
29+
Highlights.Builder()
30+
.code("public class ExampleClass {}")
31+
.theme(SyntaxThemes.monokai())
32+
.language(SyntaxLanguage.JAVA)
33+
.emphasis(PhraseLocation(13, 25)) // ExampleClass
34+
.build()
35+
.run {
36+
getHighlights()
37+
}
38+
```
39+
40+
## Themes
41+
42+
TBD
43+
644
License
745
=======
846

0 commit comments

Comments
 (0)
0