Skip to content

Commit

Permalink
Fix incorrect rendering of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeshz committed Jan 11, 2021
1 parent 747c6b9 commit f943adf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
20 changes: 4 additions & 16 deletions docs/docs/keyboard/high-level-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ High Level API depends on [Keyboard][1] which is a wrapper around the [NativeKey
- Adding a shortcut (Hotkey).

=== "Kotlin"

```kotlin
keyboard.addShortcut(Key.LeftCtrl + Key.E, trigger = KeyState.KeyDown) {
println("triggered")
Expand All @@ -19,23 +18,20 @@ High Level API depends on [Keyboard][1] which is a wrapper around the [NativeKey
- Send a [KeySet][3] to the host machine.

=== "Kotlin"

```kotlin
keyboard.send(Key.LeftAlt + Key.M)
```

- Write a sentence (String) on the host machine.

=== "Kotlin"

```kotlin
keyboard.write("Hello Keyboard!")
```

- Suspensive wait till a [KeySet][3] is pressed.

=== "Kotlin"

```kotlin
keyboard.awaitTill(Key.LeftCtrl + Key.LeftShift + Key.R, trigger = KeyState.KeyDown)
```
Expand All @@ -44,15 +40,13 @@ High Level API depends on [Keyboard][1] which is a wrapper around the [NativeKey
- Record Key presses till specific [KeySet][3] is pressed into a [KeyPressSequence][1] (Type alias to a list of pair of Duration and KeyEvent).

=== "Kotlin"

```kotlin
val records: KeyPressSequence = keyboard.recordTill(Key.LeftAlt + Key.A)
```

- Play a recorded or created collection of Keys at defined order.

=== "Kotlin"

```kotlin
keyboard.play(records, speedFactor = 1.25)
```
Expand All @@ -65,7 +59,6 @@ High Level API depends on [JKeyboard][4].
- Adding a shortcut (Hotkey).

=== "Java 8"

```java
Set<Key> keys = new HashSet<>();
Collections.addAll(keys, Key.LeftCtrl, Key.E);
Expand All @@ -74,8 +67,8 @@ High Level API depends on [JKeyboard][4].
() -> System.out.println("triggered")
);
```
=== "Java 9 or above"

=== "Java 9 or above"
```java
Set<Key> keys = Set.of(Key.LeftCtrl, Key.E);

Expand All @@ -88,15 +81,14 @@ High Level API depends on [JKeyboard][4].
- Send a [KeySet][3] to the host machine.

=== "Java 8"

```java
Set<Key> keys = new HashSet<>();
Collections.addAll(keys, Key.LeftAlt, Key.M);

keyboard.send(new KeySet(keys));
```
=== "Java 9 or above"

=== "Java 9 or above"
```java
Set<Key> keys = Set.of(Key.LeftAlt, Key.M);

Expand All @@ -106,15 +98,13 @@ High Level API depends on [JKeyboard][4].
- Write a sentence (String) on the host machine.

=== "Java 8 or above"

```java
keyboard.write("Hello Keyboard!");
```

- Asynchronous wait till a [KeySet][3] is pressed.

=== "Java 8"

```java
Set<Key> keys = new HashSet<>();
Collections.addAll(keys, Key.LeftCtrl + Key.LeftShift + Key.R);
Expand All @@ -123,20 +113,19 @@ High Level API depends on [JKeyboard][4].
.thenApply(unit -> {...});
```
=== "Java 9 or above"

```java
Set<Key> keys = Set.of(Key.LeftCtrl + Key.LeftShift + Key.R);

keyboard.completeWhenPressed(new KeySet(keys), KeyState.KeyDown)
.thenApply(unit -> {...});
```

<sup>**Note: `trigger` defaults to KeyState.KeyDown when not provided.**</sup><br>
<sup>**Note: Unit is similar to java.lang.Void, a singleton object which has nothing to do for us.**</sup>

- Record Key presses till specific [KeySet][3] is pressed into a list of pair of Duration and KeyEvent.

=== "Java 8"

```java
Set<Key> keys = new HashSet<>();
Collections.addAll(keys, Key.LeftAlt, Key.A);
Expand All @@ -146,7 +135,6 @@ High Level API depends on [JKeyboard][4].
keyboard.recordTill(new KeySet(keys));
```
=== "Java 9 or above"

```java
Set<Key> keys = Set.of(Key.LeftAlt, Key.A);

Expand All @@ -157,10 +145,10 @@ High Level API depends on [JKeyboard][4].
- Play a recorded or created collection of Keys at defined order at given speed.

=== "Java 8 or above"

```java
CompletableFuture<Unit> onFinish = keyboard.play(records, 1.25)
```

<sup>**Note: `speedFactor` defaults to 1.0 when not provided.**</sup>

[1]: https://github.com/Animeshz/keyboard-mouse-kt/blob/master/keyboard/src/commonMain/kotlin/com/github/animeshz/keyboard/Keyboard.kt
Expand Down
11 changes: 3 additions & 8 deletions docs/docs/keyboard/low-level-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Low Level API depends on [NativeKeyboardHandler][1] that can be obtained via `na
- Listening to events using Flow.

=== "Kotlin"

```kotlin
handler.events
.filter { it.state == KeyState.KeyDown }
Expand All @@ -18,15 +17,13 @@ Low Level API depends on [NativeKeyboardHandler][1] that can be obtained via `na
- Sending a [Key][2] event.

=== "Kotlin"

```kotlin
handler.sendEvent(KeyEvent(Key.A, KeyState.KeyDown))
```

- Get [KeyState][3] (KeyDown or KeyUp) of the [Key][2].

=== "Kotlin"

```kotlin
handler.getKeyState(Key.A)
handler.getKeyState(Key.RightAlt)
Expand All @@ -35,7 +32,6 @@ Low Level API depends on [NativeKeyboardHandler][1] that can be obtained via `na
- Get States of Toggleable Keys (returns a Boolean).

=== "Kotlin"

```kotlin
handler.isCapsLockOn()
handler.isNumLockOn()
Expand All @@ -49,33 +45,32 @@ Low Level API depends on [JNativeKeyboardHandler][4] that can be obtained via `J
- Listening to events using a callback.

=== "Java 8 or above"

```java
handler.addHandler(keyEvent -> {
if (keyEvent.state == KeyState.KeyDown) {
System.out.println(keyEvent.key);
}
});
```

- Sending a [Key][2] event.

=== "Java 8 or above"

```java
handler.sendEvent(new KeyEvent(Key.A, KeyState.KeyDown));
```

- Get [KeyState][3] (KeyDown or KeyUp) of the [Key][2].

=== "Java 8 or above"

```java
handler.getKeyState(Key.A);
handler.getKeyState(Key.RightAlt);
```

- Get States of Toggleable Keys (returns a boolean).

=== "Java 8 or above"

```java
handler.isCapsLockOn();
handler.isNumLockOn();
Expand Down
8 changes: 0 additions & 8 deletions docs/docs/status-and-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
=== "Gradle (build.gradle.kts)"

=== "Kotlin/JVM"

```kotlin
plugins {
kotlin("jvm") version "<kotlin-version>"
Expand All @@ -57,7 +56,6 @@
```

=== "Java/JVM"

```kotlin
plugins {
java
Expand All @@ -78,7 +76,6 @@
```

=== "Kotlin/Multiplatform"

```kotlin
plugins {
kotlin("mutliplatform") version "<kotlin-version>"
Expand Down Expand Up @@ -124,7 +121,6 @@
=== "Gradle (build.gradle)"

=== "Kotlin/JVM"

```groovy
plugins {
id "kotlin-jvm" version "<kotlin-version>"
Expand All @@ -141,7 +137,6 @@
```

=== "Java/JVM"

```groovy
plugins {
java
Expand All @@ -162,7 +157,6 @@
```

=== "Kotlin/Multiplatform"

```groovy
plugins {
id "kotlin-mutliplatform" version "<kotlin-version>"
Expand Down Expand Up @@ -208,7 +202,6 @@
=== "Maven (pom.xml)"

=== "Kotlin/JVM"

```xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand All @@ -235,7 +228,6 @@
```

=== "Java/JVM"

```xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand Down

0 comments on commit f943adf

Please sign in to comment.