Add runnable code snippets to your docs

Improve developer experience in your documentation by adding interactive and runnable code.

Loading...

How to add runnable code

Add runnable code snippets with the following lines. (Read the documentation for instructions on getting SDK_KEY) and more info.

<div id="code"></div>
<script src="https://cdn.jsdelivr.net/npm/@anyfiddle/runtime-sdk@1.3.0/dist/anyfiddle.js"></script>
<script>
  anyfiddle.runtime
    .init({
      key: 'SDK_KEY',
    })
    .then(() => {
      anyfiddle.runtime.attach(
        {
          files: [
            {
              name: 'main.py',
              content: 'print("Hello, Python!")',
            },
          ],
          command: 'python main.py',
          runtimeId: 'default',
        },
        document.getElementById('code')
      );
    });
</script>
Read documentation