Page loading
Skip to main content

Code blocks (ALPHA!)

You can embed code blocks in your chapters, so learners can run your code, or edit it and play around. Here’s an example Python REPL:

This is implemented with a TigYog iframe. To add one yourself, add an “iframe” block in the TigYog editor, and set the iframe URL to:

https://tigyog-iframe-example-python-repl.glitch.me/

Set the init data to the Python code that should run when it starts. The init data for the above example is:

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 1000)
plt.plot(x, np.tan(x))
plt.show()

Future features 🔮

Let Jim know any problems, or features you need. Here are future features on the radar:

“Solvable” code challenges. This would let you set a problem, in the form of some test that has to pass. The reader then has to solve the problem by coding in the editor.

Other languages. JavaScript is currently next priority after Python.

“Native” interactive code blocks. This would replace the “iframe” implementation. This would help with loading times.

Pre-loaded code. The above example shows the reader all the code that it initially runs. But you may want to show an example with a lot of set-up code that the reader doesn’t need to see.

Next in The TigYog docs:

Coming soon

Newsletters 🗞️

Readers can subscribe for updates on your course. You can email your subscribers whenever you like, e.g. to tell them that a new chapter is out.

Quoted text:

Your feedback will be sent privately to the author. They may reply to you by email. Thanks for helping make this course better!