Skip to content

Commit 73ee3e1

Browse files
committed
feat: first integration of the playground in the language tutorial
1 parent b7f19c5 commit 73ee3e1

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

assets/css/main.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

views/tutorials/language.pug

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ extends ../layout
33
block header
44
include ../headers/generic
55

6+
mixin playground(content)
7+
pre: code.rainbowjs(data-language="arkscript")
8+
| !{content}
9+
- var b64 = btoa(content)
10+
iframe.playground(scrolling="no", src="https://playground.arkscript-lang.dev/#/?termRight&code=" + b64)
11+
612
block content
713
div.off-canvas
814
//- off-screen toggle button
@@ -59,14 +65,14 @@ block content
5965
br
6066
br
6167
| Example:
62-
pre: code.rainbowjs(data-language="arkscript")
63-
| (let a 12) # immutable variable
64-
| (let a "hello") # cannot redefine constant
65-
| (set a "world") # cannot modify constant, will throw an error
66-
|
67-
| (mut b [12 42 64]) # mutable variable
68-
| (mut b "hello") # no problem, the operation is allowed
69-
| (set b "ArkScript is cool!") # no problem, operation is allowed on mutables
68+
- var example = "(let a 12) # immutable variable\n"
69+
- example += "(let a \"hello\") # cannot redefine constant\n"
70+
- example += "(set a \"world\") # cannot modify constant, will throw an error\n"
71+
- example += "\n"
72+
- example += "(mut b [12 42 64]) # mutable variable\n"
73+
- example += "(mut b \"hello\") # no problem, the operation is allowed\n"
74+
- example += "(set b \"ArkScript is cool!\") # no problem, operation is allowed on mutables"
75+
+playground(example)
7076

7177
section#comments
7278
h2 Comments

0 commit comments

Comments
 (0)