Integrate Live Code Editor (SE) into your workflow by injecting code via URL parameters.
Link the core API script from the official domain at the end of your body:
Map your code blocks to a trigger link using unique IDs. The API supports any container tag. We recommend pre tags.
<code> or <div> instead of <pre>, you must apply white-space: pre-wrap; to those elements in your stylesheet. Without this, browsers will strip all line breaks and tabs before the API can read them.
Click below to test a full HTML/CSS/JS injection sequence.
| Attribute | Required | Description |
|---|---|---|
class="sideditor" |
Yes | The hook used by api.js to find active links. |
html="ID" |
Yes | The ID of the element holding your HTML. |
css="ID" |
Optional | The ID of the element holding your CSS. |
js="ID" |
Optional | The ID of the element holding your JS. |
The SE API is designed for sharing code tutorials, component snippets, and live previews. It is optimized for speed and portability. For large-scale projects, please use the standard editor save features.
To ensure your tutorial links work for everyone, follow these guidelines:
| Scenario | Recommendation |
|---|---|
| Small Components | Perfect for the API. Use standard formatting. |
| Large Tutorials | Minify your code before encoding to save space. |
| External Libraries | Don't paste library code. Use a CDN link in your HTML <script> tag. |
| Heavy Assets | Use external URLs for images or SVGs rather than Base64 strings. |