How to format your code

To share your code with others, you can simply link to your repl or paste and format the code into your post!

Linking to a repl

The easiest way to share your code is by linking to your repl. You can find the link by clicking on your repl title, selecting “Spotlight” and then copying the spotlight URL.
NOTE: only share repl join links or use the invite button with people you trust!

Kapture 2022-06-23 at 16.51.07

Sharing short code samples

Share a snippet of your code by wrapping it in backticks: `. This is especially useful when sharing the name of variables or short lines of code.

Example:
someVarName

Raw
`someVarName`

Sharing blocks of code

There are 2 ways to do share longer blocks of code:

The first way (preferred) is with ```. You can even add language abbreviations like js for Javascript and py for Python to enable syntax highlighting.

Example:

console.log("Hello World!")
Raw
```js
console.log("Hello World!")
```

The other way to format large blocks of code are indent it by 4 spaces at the minimum. For example:

console.log("Hello World")
Raw
    console.log("Hello World")
1 Like