Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 0413090

Browse files
committed
Add README for activecode
1 parent 6039ec2 commit 0413090

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

runestone/activecode/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### activecode
2+
3+
```html
4+
<pre data-component="activecode" id="example1" data-lang="python">
5+
def main()
6+
print("hello world")
7+
8+
main()
9+
</pre>
10+
```
11+
12+
The body of the ``pre`` tag contains code to be loaded into the editor initially. The following attributes are options and control what pieces and parts of the component will be visible.
13+
14+
* ``data-component`` attribute identifies this as an activecode component
15+
* ``class`` The usual CSS class options
16+
* ``id`` must be unique in the document
17+
* ``data-lang`` for activecode can be python javascript or html
18+
* ``data-autorun`` run this activecode as soon as the page is loaded
19+
* ``data-hidecode`` make the editor hidden initially
20+
* ``data-include`` list of ids of other activecodes. The code form each will be prepended to the code to run
21+
* ``data-timelimit`` either False to turn off runtime limit checking or an integer representing the number of milliseconds until timeout.
22+
* ``data-coach`` add a button to display code coach information
23+
* ``data-codelens`` add a button "Run this in Codelens"
24+
25+
26+
For Python to work in the browser you must also obtain and include via a script tag ``skulpt.min.js`` and
27+
``skulpt-stdlib.js`` along with ``codemirror.js`` and of course ``activecode.js``
28+
29+
Soon, many of these requirements will be incorporated into one handy ``runestone.js`` file.
30+
31+
32+

0 commit comments

Comments
 (0)