Simple code editor
You can add a simple code editor such as this:
- python_example.py
- index.html
- base.css
def say(text):
print(text)
say('Hello World!')
<div>
<h1>Hello World!</h1>
<ul>
<li>Item</li>
<li>Item</li>
</ul>
</div>
body {
background: hotpink;
}
Source code
!!! code-editor
```{.py .filename-python_example}
def say(text):
print(text)
say('Hello World!')
```
```html
<div>
<h1>Hello World!</h1>
<ul>
<li>Item</li>
<li>Item</li>
</ul>
</div>
```
```{.css .readonly-file .filename-base}
body {
background: hotpink;
}
```
```{.css .hidden-file .filename-hidden}
body {
/* This file will not be displayed,
but a div with this content will exist */
color: lime;
}
```
Add Javascript
You can add some Javascript to handle editor content changes: