Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Simple piece of code

To display a piece of code, use the following syntax:

```javascript
var a = 2;
var b = 4;
console.log(a+b);
```

javascript specifies the language so that the syntax is correctly highlighted.

Auto fold

You can auto fold some sections of your code by using this syntax:

// { autofold
  code which is collapsed
// }

visible code

Runnable snippet

Syntax

For basic usage, you can make a simple piece of code runnable. To do that you need to create a piece of code by using the standard markdown syntax and then add the runnable keyword:

```javascript runnable
var a = 2;
var b = 4;
console.log(a+b);
```

renders as

1
2
3
4
var a = 2;
var b = 4;
console.log(a+b);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compatible languages

This simple syntax is a shortcut for a given language that automatically selects a runner and a command.

Here you can find a table that summarizes the supported languages and the associated docker image, command and filename.

LanguageDocker imagecommand filename
javajava:latestbash -c "javac Main.java" && java Main"Main.java
 javascriptnode:latestnode index.js index.js
pythonpython:latestpython main.py main.py

For any language in the language column you can create a snippet by specifying the language and the keyword runnable as seen before.

When the user presses the Run button, it automatically saves this piece of code in a file (filename column) stored in the specific docker image and then executes the command.

If you want us to add new language extension, feel free to contact us by giving us all required data (docker image, command, filename): community@tech.io

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content