Skip to content

Make it easy to integrate livecode with existing tutorials and posts #15

@anandology

Description

@anandology

People typically write tutorials with code snippets. What if the code snippets can become live by adding a couple of javascript?

Here is the plan:

<script type="text/javascript" src=".../livecode.js"></script>
<script type="text/javascript">
    var LIVECODE_RUNTIME = "python";
    var LIVECODE_SELECTOR = "pre";
    var LIVECODE_URL = "https://livevode.example.com";

</script>

On load, it will convert all <pre> elements into livecode editors. Users will be able to click run to execute that code.
This could be added to any webpage.

It may be possible to find the LIVECODE_URL automatically from the location of the script tag. Python has __file__ to find the path of current module, we need something like that for JS. John Resig has suggested a hack to get something close. It would be interesting to try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions