added label syntax support and highlighting

This commit is contained in:
sergeych committed 2026-01-06 02:37:16 +01:00
1 parent 660a80a26b
commit 26b8370b01
12 files changed
+122 -19

No files matched your search

+8
View File
@@ -77,6 +77,14 @@ fun HomePage() {
// Create, transform, and verify — the Lyng way
import lyng.stdlib
fun findFirstPositive(list) {
list.forEach {
if (it > 0) return@findFirstPositive it
}
null
}
assertEquals(42, findFirstPositive([-1, 42, -5]))
val data = 1..5 // or [1,2,3,4,5]
val evens2 = data.filter { it % 2 == 0 }.map { it * it }
assertEquals([4, 16], evens2)
@@ -20,6 +20,22 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
class LyngHighlightTest {
@Test
fun highlightsReturnAndLabels() {
val md = """
```lyng
return 42
break@outer null
return@fn val
```
""".trimIndent()
val html = renderMarkdown(md)
assertTrue(html.contains("hl-kw"), "Expected keyword class for 'return': $html")
assertTrue(html.contains("hl-lbl") || html.contains("hl-ann"), "Expected label/annotation class for @outer/@fn: $html")
assertTrue(html.contains(">>>").xor(true), "Should not contain prompt marker unless expected")
}
@Test
fun highlightsLyngFencedBlock() {
val md = """