I’ve got a new project that I’ve been working on lately. My thinking is that a lot of programming topics are easier to explain with small interactive tools, but standard publishing tools are targeted towards text and don’t give you a way to incorporate code. If you go your own way and publish a code-driven page you have to reinvent the wheel around lots of tooling for editing, hosting, caching, comments etc.
The widget below is a working Python tokeniser. You can edit the code however you like and see the output, with a pretty accurate emulation of the official cpython tokeniser:
This is just a first step, and it’s not very general at the moment. However, this demonstrates a lot of the required steps and should be a good basis to build from.
It’s actually broken down into two separate projects:
- wp-python-analyzer, a WordPress package that wraps the tools up into blocks that can be deployed into the Gutenberg editor.